How can I make my HorizontalBarChart scrollable?

﹥>﹥吖頭↗ 提交于 2019-12-11 10:06:17

问题


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


回答1:


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.

More here: https://github.com/PhilJay/MPAndroidChart/wiki/Modifying-the-Viewport



来源:https://stackoverflow.com/questions/33195553/how-can-i-make-my-horizontalbarchart-scrollable

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