0
// generate Dates
Calendar calendar = Calendar.getInstance();
Date d1 = calendar.getTime();
calendar.add(Calendar.SECOND, 1);
Date d2 = calendar.getTime();
calendar.add(Calendar.SECOND, 1);
Date d3 = calendar.getTime();
GraphView graph = (GraphView) findViewById(R.id.graph);
// you can directly pass Date objects to DataPoint-Constructor
// this will convert the Date to double via Date#getTime()
LineGraphSeries<DataPoint> series = new LineGraphSeries<DataPoint>(new DataPoint[] {
new DataPoint(d1, 1),
new DataPoint(d2, 5),
new DataPoint(d3, 3)
});
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(d1.getTime());
graph.getViewport().setMaxX(d3.getTime());
graph.getViewport().setXAxisBoundsManual(true);
XAxis 그래프가 표시되지 않을 때 초를 사용할 때. 하지만 60 초 이상 사용하면 그래프가 표시됩니다. 나는 그 이유를 모른다. 누구나 GRaphView와 비슷한 문제가 있습니다.축 X 축의 시간 - 안드로이드 용 그래프 뷰