当我尝试设置包含日/值对的LineGraph时。传奇在右侧被裁剪。即最后的~3个值显示在图表中,但在图例中没有条目。
这是库中的错误还是我错过了什么?
下面是活动的屏幕截图以及我用于创建图表的代码
GraphView graph = (GraphView) findViewById(R.id.graph);
LineGraphSeries<DataPoint> series = new LineGraphSeries<>(points);
graph.addSeries(series);
// set date label formatter
// graph.getGridLabelRenderer().setLabelFormatter(new DateAsXAxisLabelFormatter(HRVViewer.this));
final DateFormat dateTimeFormatter = DateFormat.getDateInstance();
graph.getGridLabelRenderer().setLabelFormatter(new DefaultLabelFormatter() {
@Override
public String formatLabel(double value, boolean isValueX)
{
if( isValueX ) // dateTimeFormatter.format(new Date((long) value));
return dateTimeFormatter.format(new Date((long) value)); // super.formatLabel(value, isValueX);
else
return super.formatLabel(value, isValueX);
}
});
graph.getGridLabelRenderer().setHumanRounding(true);
// graph.getGridLabelRenderer().setNumHorizontalLabels(Math.min(8, points.length)); // only 4 because of the space
graph.getGridLabelRenderer().setNumHorizontalLabels(points.length); // only 4 because of the space
graph.getGridLabelRenderer().setHorizontalLabelsAngle(90);
graph.getGridLabelRenderer().setTextSize(12);
// set manual x bounds to have nice steps
graph.getViewport().setMinX(min_d);
graph.getViewport().setMaxX(max_d+1);
graph.getViewport().setXAxisBoundsManual(true);