MPAndroidChart对数Y轴 [英] MPAndroidChart Logarithmic Y Axis

查看:228
本文介绍了MPAndroidChart对数Y轴的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在我的应用程序中实现一个折线图,我想使用MPAndroidChart. 问题在于y轴上的值将介于1到1x10 ^ -12之间.这就是为什么我需要该轴上的对数视图.

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?)

感谢您的帮助.

推荐答案

此图表库使用Matrix乘积进行值到像素的转换. 这些是线性变换,这意味着它们不能对数拉伸.

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?

此外,您还可以使用ValueFormatter界面选择在y轴上将任何内容显示为标签.

Also, you can choose to display whatever you want on the y-axis as labels, by using the ValueFormatter interface.

因此只需在y轴上转换值即可,例如从"y"到"10 ^ y".

So simply transform the values on the y-axis e.g. from "y" to "10^y".

这篇关于MPAndroidChart对数Y轴的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆