AChartEngine move bar graph - android

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();

Related

How to display Y-axis grid lines in bar graph using AChart engine

The Y-Axis grid lines are not getting displayed in bar graph using A-Chart engine.Even after using setShowGrid(true) and using setShowGridY(true),the Y-axis grid lines are not getting displayed in bar graph chart.
It will be of great help,if somebody provides a correct way of doing that.
Use
renderer.setShowCustomTextGrid(true);
Courtesy #Beben06 How to show grid for a custom x axis label: achartengine?

Android achartengine : bar chart - bars appear upside down

Am trying out to plot some values using achartengine in an Android App. The values in y axis are usually negative. This is how the bar chart appears
But I want it to appear from the bottom i.e. I want each bar to start from -100, instead of the current 0. How do I do this? Please help.
I suggest you build a range bar chart instead of the current bar chart. Another suggestion is to use renderer.setBarWidth(widthInPixels) in order to set the width of the bars. This method works best when you have only one item per series.

How to display x-axis label above the axis using AChartEngine in Android?

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);

Android - Using AChartEngine, is it possible to zoom in to a specific point upon displaying the graph?

I have a bar graph with 100+ bars and want to zoom in to a specific range upon displaying the graph. For example, when the graph is displayed on the screen I want only the bars 44-49 to be showing. It is important that the users will be able to zoom out to see all 100+ bars as well.
GraphicalView.zoomIn() would work if it allowed me to specify a point to zoom in to.
Thanks!
You can set the visible range on the X axis:
renderer.setXAxisMin(44);
renderer.setXAxisMax(49);

display recent plotted value on AChartEngine dynamic line graph

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);

Categories

Resources