Reputation: 4256
I am using achartengine(God bless the folks behind this) for data that my application is continuously receiving over a socket connection. The point are plotted against time which is my x axis. To achieve a moving graph i am having to remove items from the TimeChart if the count goes beyond 20.
timeSeries.add(Float.parseFloat(xAxisData), yAxisData);
if(timeSeries.getItemCount() > 20){
timeSeries.remove(0);
}
So far so good.
But now the problem is that if a user pans through the graph and wants to see some of the older points the graph does not show them. Understandably so because i have already deleted those points from the TimeSeries.
So the question is how to show the older data when i pan through the graph along the X axis?
Is there an alternative way to give a the graph a moving effect other than deleting points from the TimeSeries because i understand if the TimeSeries hold all the point my problem will be solved?
Upvotes: 2
Views: 338
Reputation: 32391
There is an alternative. Whenever you want the graph to "move", just call the methods below and then do a repaint:
renderer.setXAxisMin(minVisibleValue);
renderer.setXAxisMax(maxVisibleValue);
chartView.repaint();
Upvotes: 2