Skip to content Skip to sidebar Skip to footer

Trouble Getting Axis Centered On Origo In Achartengine

I'm having trouble getting AChartEngine to center the actual visible axises on Origo instead of having them along the left- and bottom of the chart. I need to have the axises like

Solution 1:

I made some modifications to AChartEngine 1.0.0 to make it possible to display axises in the center of the plot. Use code below to set the axises to center.

XYMultipleSeriesRenderer.setXAxisAlign(Align.CENTER, 0);
XYMultipleSeriesRenderer.setYAxisAlign(Align.CENTER, 0);

XYMultipleSeriesRenderer.patchXYChart.patch

And here is an example on how it may look enter image description here

Solution 2:

There isn't a better answer than the one you mentioned. Just make sure that you calculate X and Y ranges such as your data fits inside and also make sure that the range you set is centered on the 0 point:

renderer.setXAxisMin(-value);
randerer.setXAxisMax(value);

and the same for the Y axis.

Post a Comment for "Trouble Getting Axis Centered On Origo In Achartengine"