Java GraphView水平轴标签填充

Java GraphView水平轴标签填充,java,android,android-graphview,Java,Android,Android Graphview,我正在使用GraphView库在android应用程序上创建图形,我的水平(X)轴标签有问题。 正如您所看到的,X轴中的数字标签存在问题,数字彼此悬停,我愿意使用填充来避免这种情况 虽然经过长时间的网上研究,我还没有找到任何答案 以下是我的图形设计代码: GraphView graph = (GraphView) findViewById(R.id.graph); LineGraphSeries<DataPoint> series = new LineGraphSer

我正在使用GraphView库在android应用程序上创建图形,我的水平(X)轴标签有问题。 正如您所看到的,X轴中的数字标签存在问题,数字彼此悬停,我愿意使用填充来避免这种情况

虽然经过长时间的网上研究,我还没有找到任何答案

以下是我的图形设计代码:

    GraphView graph = (GraphView) findViewById(R.id.graph);
    LineGraphSeries<DataPoint> series = new LineGraphSeries<>(getDataPoint());
    GridLabelRenderer gridLabel = graph.getGridLabelRenderer();
    gridLabel.setHumanRounding(true);
    gridLabel.setNumHorizontalLabels(this.numberAxis);
    gridLabel.setHorizontalAxisTitle(getApplicationContext().getString(R.string.updates));
    gridLabel.setLabelHorizontalHeight(50);
    gridLabel.setVerticalAxisTitle(getApplicationContext().getString(R.string.weight));
    graph.addSeries(series);
GraphView graph=(GraphView)findViewById(R.id.graph);
LineGraphSeries=newlinegraphseries(getDataPoint());
GridLabelRenderer gridLabel=graph.getGridLabelRenderer();
gridLabel.setHumanRounding(true);
gridLabel.SetNumHorizontaLabels(此.numberAxis);
setHorizontalAxisTitle(getApplicationContext().getString(R.string.updates));
gridLabel.SetLabel水平高度(50);
setVerticalExistitle(getApplicationContext().getString(R.string.weight));
图.addSeries(系列);
如何避免水平轴标签彼此悬停?

尝试添加

graph.getViewport().setScrollable(true)


您正在尝试添加1个屏幕可以处理的大量数字。

我也遇到了同样的问题,我所做的是将“水平角度”属性设置为90度,并在垂直方向显示标签

但我最终将其设置为135度,因为它提供了更好的结果,如下所示:


graph.getGridLabelRenderer().setHorizontalLabelsAngle(135)

没有足够的空间,因此您应该通过
setnumhorizontallables(5)
减少水平标签的数量,例如