Arjun Issar
Arjun Issar

Reputation: 654

MarkerView in MPAndroidChart

Can we add MarkerView to PieChart and HorizontalBarChart from MPAndroidChart library?

I did try adding the MarkerView to the pie chart as the following:

TooltipView tooltipView = new TooltipView(context,R.layout.tooltip_layout, metadata);
chart.setMarkerView(tooltipView);

But when I click on the slice of the pie chart, no MarkerView is shown. Also, the same thing happens for horizontal bar chart.

Upvotes: 1

Views: 1912

Answers (2)

Philipp Jahoda
Philipp Jahoda

Reputation: 51411

As of today, PieChart and HorizontalBarChart do not support MarkerView. Nevertheless, this is high on my list and will probably be added soon in the future.

Upvotes: 1

CDVN
CDVN

Reputation: 171

It's difficult to tell from your question, but here are some things to check:

  • Ensure that ToolTipView extends MarkerView
  • Also make sure that you implement the refreshContent(), getXOffSet() and getYOffSet() methods.

That should allow you to view the marker view item.

I am not sure what the metadata value you are entering does, as the refresh method should allow you access the currently selected value and its data.

Upvotes: 0

Related Questions