我正在使用GraphView库(请参阅:https://github.com/jjoe64/GraphView或http://www.jjoe64.com/p/graphview-library.html)。 使用GraphView-Demos-master,我修改"公共类DateAsXAxis .."对于秒的日期小增量而不是日增量。在X轴上增加秒数,比例和滚动功能不起作用。
Calendar calendar = Calendar.getInstance();
Date d1 = calendar.getTime();
DataPoint[] datos = new DataPoint[50];
for (int i=0; i<50; i++){
datos[i]= new DataPoint(d1,i%4);
// d1.setTime(d1.getTime() + 86400000); // 1 day works ok, but with some jumps in scale
d1.setTime(d1.getTime() + 60000); // 1 min doesn't work scrolling not scaling.
}
LineGraphSeries<DataPoint> series = new LineGraphSeries<DataPoint>(datos);
graph.addSeries(series);
// set date label formatter
graph.getGridLabelRenderer().setLabelFormatter(new DateAsXAxisLabelFormatter(getActivity()));
graph.getGridLabelRenderer().setNumHorizontalLabels(3); // only 4 because of the space
// set manual x bounds to have nice steps
graph.getViewport().setMinX(datos[0].getX());
graph.getViewport().setMaxX(datos[3].getX());
graph.getViewport().setXAxisBoundsManual(true);
graph.getViewport().setScalable(true);