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

查看:29
本文介绍了如何使我的 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天全站免登陆