如何在MPAndroidChart中设置最大缩放

Bir*_*lem 3 android pinchzoom mpandroidchart

我使用MPAndroidChart编写折线图,我的代码没有任何错误,但是缩放缩放变为无穷大,因为在某些设备中CPU有100%.我如何限制最大捏缩放?

rgu*_*rra 8

mpandroidhchart开发人员在此提交中实现了这一点:https: //github.com/PhilJay/MPAndroidChart/commit/ba152072a6a7adbf8e9e166904798219c1200172

但我还在等待新的发布版本.此外,你只需要打电话

chart.getViewPortHandler().setMaximumScaleX(2f);
chart.getViewPortHandler().setMaximumScaleY(2f);
Run Code Online (Sandbox Code Playgroud)

这将限制因子2的缩放


Ale*_*ilo 0

setScaleMinima(2f, 1f)

将最小比例设置为 0f 与缩小到无限大相同。1f 允许您调整缩放比例,以便您可以看到整个图表。