Scrollable BarChart with possibility to touch each bar using MpAndroidChart?

Virthuss picture Virthuss · Sep 15, 2015 · Viewed 7.5k times · Source

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

My aim is to get a graph looking like this one: enter image description here

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.

Answer

Philipp Jahoda picture Philipp Jahoda · Sep 15, 2015

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.