问题
I need to implement a line chart inside my application and I would like to make use of MPAndroidChart. The problem is that the value on the y axis will be somewhere between 1 and 1x10^-12. Thats why i need an Logarithmic view on that axis.
Is there any way to achieve this with that libary? (or maybe other chart libary?)
Thanks for your help.
回答1:
This chart library uses Matrix
-multiplication for value to pixel transformation. Those are linear-transformations, which means they cannot stretch logarithmically.
However, with some work on your own, you could modify the values you provide for the chart in a way that they fit into the chart: Is there a transformation matrix that can scale the x and/or y axis logarithmically?
Also, you can choose to display whatever you want on the y-axis as labels, by using the ValueFormatter
interface.
So simply transform the values on the y-axis e.g. from "y" to "10^y".
来源:https://stackoverflow.com/questions/28996941/mpandroidchart-logarithmic-y-axis