Trouble getting axis centered on Origo in AChartEngine

十年热恋 提交于 2019-12-13 04:35:34

问题


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:

Any ideas?

(This question is similar to question #2 [2]: Make x-axis in vertical center using AChartEngine but I thought that a more specific question might get an answer)


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

And here is an example on how it may look




回答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.



来源:https://stackoverflow.com/questions/12156801/trouble-getting-axis-centered-on-origo-in-achartengine

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!