Problemas para centrar el eje en Origo en 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 so:

enter image description here

¿Alguna idea?

(This question is similar to question #2 [2]: Haga el eje x en el centro vertical usando AChartEngine but I thought that a more specific question might get an answer)

preguntado el 28 de agosto de 12 a las 10:08

2 Respuestas

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.patch
XYChart.patch

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

Respondido 29 ago 12, 12:08

Has this been fixed in recent release of achartengine ? Can i achieve this without modifying acharengine library - Shakti Malik

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.

Respondido 28 ago 12, 11:08

But that will not move the axis to the center, just make sure that the origo is in the middle of the plot. - mach

The axis themselves cannot be moved to the center. - Dan D.

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.