user5658783
user5658783

Reputation: 55

How to highlight multiple values with MPAndroidChart?

Is it possible to highlight several values in MPAndroidChart ?

I highlight one value thanks to : barChart.highlightValue(high[0]) but how to highlight 2 values..

Thanks for your answer

Upvotes: 5

Views: 7526

Answers (2)

AmrDeveloper
AmrDeveloper

Reputation: 4682

The code in Kotlin

barChart.highlightValues(arrayOf(
    Highlight(),
    Highlight()
))

Upvotes: 0

Philipp Jahoda
Philipp Jahoda

Reputation: 51411

Yes, that is possible.

The library has a method called highlightValues(Highlight[] highs).

This method allows to provide an array of Highlight objects to highlight multiple values.

Example:

Highlight h1 = new Highlight(...); // 1st value to highlight
Highlight h2 = new Highlight(...); // 2nd value to highlight

chart.highlightValues(new Highlight[] {h1, h2});

An in-depth tutorial on highlighting can be found here.

Upvotes: 12

Related Questions