MPAndroidChart Logarithmic Y Axis

会有一股神秘感。 提交于 2019-12-12 21:21:51

问题


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

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