When I dynamically plot values I wish to display the recent plotted value on line graph (drawn with the help of AChartEngine library). In other words I wish to scroll my line graph along x-axis towards left to show the latest plotted value and hide the oldest plotted value. How to achieve this?
Whenever you add values to the datasets, if you call chartView.repaint(); the chart is updated with the new values.
In order to have the values scroll to the left, you need to change the visible area on the X axis:
renderer.setXAxisMin(theMinimumVisibleValue);
// this may be optional
// renderer.setXAxisMax(theMaximumVisibleValue);
Related
I want to create a time-distance chart that will show the position (on the x axis) at a certain time (on the y axis). I successfully integrated the library in my project and I rendered an empty chart. However, I'm not sure what kind of chart to use a Line Chart, a XY Line Chart or a Time Series Chart and I don't know how should I provide the data (the position at a certain time e.g. at second 5 the distance is 10 meters) for the chart to be drawn.
Check this thread for reference.
http://www.android-graphview.org/
I want to create graph like above.
In this graph titles are on top. User can select particular time to view more detail.
How to show this X-axis labels on top of axis using AChartEngine or any other graph api for android?
You can use annotations, which are text labels that can be placed anywhere in the graph.
series.addAnnotation("Vacation", 6, 30);
I have implemented a bar graph using AChartEngine. I have added all the required values to the dataset as an XYSeries.The graph is drawn with the first 10 bars drawn when the app is started.I want to programmatically move the graph to a point further on the X-axis i.e I want to move the graph programmatically to display bars 25-35 or some other bars on X-axis.
Could someone please tell me how this can be achieved?
You first need to modify the visible range for the X axis:
renderer.setXAxisMin(25);
renderer.setXAxisMax(35);
Then, just call repaint() on your chart view:
chartView.repaint();
How to stop scrolling of AChartEngine dynamic line graph along the y-axis?
When I dynamically plot values I wish to display the recent plotted value. How to do that?
I wish to plot y- axis values in range 20 to 200 and want to display only 5 values so I have used mRenderer.setYLabels(5); But, when I do so grid lines are displayed for only those values. And user will not be able to know the exact y axis co-ordinate. How to show grid lines for each value and show labels for only some values?
If I manually scroll graph horizontally towards right or left, x-axis labels change. I set range as 0-10 with setXLables(2); but it changes to 0,5,10… How to control this behavior?
These should be 4 separate questions, not numbered ones. So, I will only answer the first one of them:
You can set the min and max displayed values:
renderer.setXAxisMin(minValue);
renderer.setXAxisMax(maxValue);
If by scrolling you mean panning, then this is the way to do:
renderer.setPanEnabled(false, false);
renderer.setZoomEnabled(false, false);
I am able to display the AChartEngine's TimeChartView to user, but when the graph renders, the grid lines (vertical - set by showGridLines(true)) and the line drawn on graph to display corresponding y-axis value (time in secs) against the dates on x-axis don't intersect with each other.
The y-axis value pt shows up either before the x-axis value or after it, but not exactly on it.
Please suggest, if there's any achartengine property which needs to be set to get this done / any other thing that needs to be done for getting this done.
Thanks
Omkar Ghaisas
Sample Image --
As can be seen, the points marked with ovals don't coincide with the vertical grid lines and with x axis values, but start before that. E.g the first y value for 7200 should start at vertical line of 02/03/2012, but instead starts before that. Similarly for all other data points.
This was fixed in the AChartEngine SVN.
Please see this for extra information.