Scrollable BarChart with possibility to touch each bar using MpAndroidChart?

↘锁芯ラ 提交于 2019-12-08 17:06:21

问题


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

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

But with some specific features.

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

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


回答1:


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

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

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



来源:https://stackoverflow.com/questions/32577563/scrollable-barchart-with-possibility-to-touch-each-bar-using-mpandroidchart

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