可滚动的BarChart,可以使用MpAndroidChart触摸每个条吗? [英] Scrollable BarChart with possibility to touch each bar using MpAndroidChart?

查看:202
本文介绍了可滚动的BarChart,可以使用MpAndroidChart触摸每个条吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 MPAndroidChart 在我的应用中创建图表.

I'm trying to create a chart in my app using MPAndroidChart.

我的目标是得到一个看起来像这样的图:

My aim is to get a graph looking like this one:

但具有一些特定功能.

  • 图形将比屏幕的宽度宽,因此它必须具有最小宽度并且可以滚动(对于我使用此变通方法的宽度,但不可滚动):chart.getLayoutParams().width=100*entries.size();
  • 我希望在单击栏时出现相同类型的气泡(我不知道是否可以同时使用滚动条和滚动条,因为对于滚动条,我猜是使用布局的一种解决方法如果尚未实现此功能,则只有滚动视图是一种解决方案)
  • 最后,当触摸该栏的上方时,不要选择其下方的栏(如果有方法的话,这可能会阻止用户滚动!).

  • The graph will be wider than the screen's width so it must have a minimum width and be scrollable ( for the width I'm using this workaround, but its not scrollable ): chart.getLayoutParams().width=100*entries.size();
  • I would like to have the same kind of speech bubble on click on a bar ( I don't know if there is a way to have it and the scroll in the same time since for the scroll I guess a workaround using layout and scrollview is the only solution if this feature is not implemented yet)
  • and finally, when touching above one of the bar, not selecting the bar under ( which could prevent the user to scroll if there is a way to do so! ).

使用MPAndroidChart在技术上还可以吗?预先感谢.

Is it technically possible with MPAndroidChart yet? Thanks in advance.

推荐答案

是的.并且请不要使用ScrollView.

Yes, it is. And please do not use ScrollView.

请阅读以下内容以修改视口​​并扩大图表范围": https://github.com /PhilJay/MPAndroidChart/wiki/修改视口

Read this for modifying the viewport and "making the chart wider": https://github.com/PhilJay/MPAndroidChart/wiki/Modifying-the-Viewport

您正在谈论的语音泡沫"是MarkerView,是的,滚动时也可以显示它.

The "speech bubble" you are talking about is the MarkerView, and yes, it can be displayed when scrolling as well.

这篇关于可滚动的BarChart,可以使用MpAndroidChart触摸每个条吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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