Reputation: 113
I'm using achartengine in my Android Application, it works well but i have a question.
Is it possible to reverse plot?
I mean in my graph, new values which are added to my XY series with the function add, are added at end of the series, and then the graph is redrawn, so new values appears at right of the graph.
But i want to add my new value at index 0, in order to show on the graph only the last X values.
Sorry if it's not very clear
Thanks
Upvotes: 2
Views: 625
Reputation: 113
So, i've found a trick:
Dataset is my XYseries and mRenderer my multipleSeriesRenderer
mRenderer.setYAxisAlign(Align.RIGHT, 0);
mRenderer.setXLabels(0);
mRenderer.setXAxisMax(dataset.getItemCount() - 1); mRenderer.addXTextLabel(dataset.getItemCount() - 1, "0");
mRenderer.setXAxisMin(dataset.getItemCount() - scale - 1);
Upvotes: 0
Reputation: 32391
There is no support for inserting data to XYSeries
at a given index. However you could get to this behavior by clearing the current data and adding it back, with the new value included. I know this would not be a very optimal way, but it helps you get to your needed behavior.
Edit: I added an add(index, x, y)
method in XYSeries
. You can download a version including this feature here.
Upvotes: 1