How to plot data from right to left in MPAndroidChart?

杀马特。学长 韩版系。学妹 提交于 2020-01-02 06:47:26

问题


I recently update the MPAndroidChart library from 1.7.4 to 2.0.9 and I forgot what I did to customize the linechart to make the data displaying from right to left. Does anyone know? I am wondering if there is a method to call to do that.


回答1:


There is no method. But it can still be done because it only depends on how you add the data.

Just add values at higher x-indices first.

Say you got a chart with x-axis labels from January to December with an x-axis range from 0 - 11 (12 values).

Now add the december value at index 11, and so on.




回答2:


If you want to set the first data point other than zero and have the data display in left to right manner use moveViewToX(float xValue).

moveViewToX(float xValue): Moves the left side (edge) of the current viewport to the specified xValue.



来源:https://stackoverflow.com/questions/29809282/how-to-plot-data-from-right-to-left-in-mpandroidchart

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