Siddhesh Pawar
Siddhesh Pawar

Reputation: 259

Click event on bar chart and gradient color MP chart library

enter image description here

I have a made the bar chart it is almost done, just I need a popup as shown in the image above on click of every item, how can I achieve this. I tried referring to https://github.com/PhilJay/MPAndroidChart/wiki/Interaction-with-the-Chart

But I can't understand. Also how can I add gradient colors in the bar chart?

Upvotes: 0

Views: 996

Answers (1)

Pallavi Tapkir
Pallavi Tapkir

Reputation: 781

When You initialize your graph, Use the following code to show marker view

MarkerView mv = new MarkerView(mContext, R.layout.chart_marker);
    mv.setChartView(graph); // For bounds control i.e graph
    graph.setMarker(mv); // Set marker
    graph.setHighlightPerDragEnabled(false);
    graph.setHighlightPerTapEnabled(false);

Here R.layout.chart_marker is optional, this is used for custom layout. You can remove this one.

It will show marker over your bar chart.

Upvotes: 1

Related Questions