-
Notifications
You must be signed in to change notification settings - Fork 204
Open
Description
Hi everyone
I'm very pleased with the library, great works!
Problem is, I don't understand why it behaves inconsistently, meaning that one time it shows like this (without date X labels and incorrect Y axis rounding)
in place of the correct display

I'm following the example Dates.java
https://github.com/jjoe64/GraphView-Demos/blob/master/app/src/main/java/com/jjoe64/graphview_demos/examples/Dates.java
if (story.getId().equals(storyId)) {
GraphView graph = (GraphView) findViewById(R.id.graph);
DataPoint[] dataPoints = new DataPoint[story.getMetrics().size()];
int i = 0;
for (Story.Metric metric : story.getMetrics()) {
dataPoints[i] = new DataPoint(metric.getDate(), (int)metric.getConversations());
i++;
}
LineGraphSeries<DataPoint> series = new LineGraphSeries<DataPoint>(dataPoints);
series.setAnimated(true);
graph.addSeries(series);
graph.getGridLabelRenderer().setLabelFormatter(new DateAsXAxisLabelFormatter(graph.getContext(), new SimpleDateFormat(LABEL_DATE_FORMAT)));
graph.getGridLabelRenderer().setNumHorizontalLabels(dataPoints.length);
// as we use dates as labels, the human rounding to nice readable numbers
// is not nessecary
graph.getGridLabelRenderer().setHumanRounding(false);
// set manual x bounds to have nice steps
graph.getViewport().setMinX(story.getMetrics().get(0).getDate().getTime());
graph.getViewport().setMaxX(story.getMetrics().get(story.getMetrics().size() - 1).getDate().getTime());
graph.getViewport().setXAxisBoundsManual(true);
}
I'm really puzzled..
thanks
nicola
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels


