问题
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 specifiedxValue
.
来源:https://stackoverflow.com/questions/29809282/how-to-plot-data-from-right-to-left-in-mpandroidchart