如何使我的Horizo​​ntalBarChart可滚动? [英] How can I make my HorizontalBarChart scrollable?

查看:51
本文介绍了如何使我的Horizo​​ntalBarChart可滚动?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当前尝试使用MPAndroidChart实现Horizo​​ntalBarChart.但是,条形太多,无法完全显示在屏幕上.仅当我放大时,Horizo​​ntalBarChart才会滚动,但永远不会超过屏幕上已经显示的内容.不知道这是一个XML问题(我在相对布局中有Horizo​​ntalBarChart,尝试过ScrollView但没有用)还是已经有一个诸如chart.enableScroll()的实现(我已经尝试过了,但不起作用) ).

Currently trying to implement a HorizontalBarChart using MPAndroidChart. However, there are too many bars and they won't all fit on the screen. HorizontalBarChart will scroll only if I zoom in, but will never go past what was already on the screen. Not sure if this is an XML problem (I have the HorizontalBarChart in a Relative Layout, tried ScrollView but didn't work) or if there's already an implementation like chart.enableScroll() (which I have tried, and it doesn't work).

推荐答案

您可以使用chart.setVisibleXRangeMaximum(10)来控制应该一次可见的条目数.如果图表包含更多值,它将自动允许滚动.

You can use chart.setVisibleXRangeMaximum(10) to control the number of entries that should be visible at once. If the chart contains more values, it will automatically allow scrolling.

更多信息在这里: https://github.com/PhilJay/MPAndroidChart/wiki /修改视口

这篇关于如何使我的Horizo​​ntalBarChart可滚动?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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