Charts: Clearing all highlighted values

Created on 23 Jun 2015  Â·  7Comments  Â·  Source: danielgindi/Charts

I am highlighting a value on my chart with a BalloonMarker when it is tapped, like what is done in the ChartsDemo application.

Now, I need to remove a selection programmatically. I looked in the Android documentation and saw in "Interacting with the Chart" it says:

highlightValues(Highlight[] highs): Highlights the values at the given indices in the given DataSets. Provide null or an empty array to undo all highlighting.

However, this doesn't seem to be exposed to my object anywhere. Is this implemented? Any ideas how to accomplish this?

Most helpful comment

@carlosandresSanchez yes it is. In my case, I'm using a CombinedChartView and have an instance of that class named chartView.

In order to clear all highlighted values, I had to do:

[self.chartView highlightValues:NULL];

Hope this helps!

All 7 comments

It actually is exposed, as highlightValues exactly, on every chart view.

@danielgindi I honestly have no idea how I missed that..

It's possible I was looking for that property on the data set, not the chart itself.

Either way, sorry about that! Thanks for the help!

No problem! Have fun!

On Mon, Jun 29, 2015 at 11:28 PM, Matt Cooksey [email protected]
wrote:

@danielgindi https://github.com/danielgindi I honestly have no idea how
I missed that..

It's possible I was looking for that property on the data set, not the
chart itself.

Either way, sorry about that! Thanks for the help!

—
Reply to this email directly or view it on GitHub
https://github.com/danielgindi/ios-charts/issues/171#issuecomment-116833610
.

Is exposed highlightValues in Combined Chart View? It does not appear to me

@carlosandresSanchez yes it is. In my case, I'm using a CombinedChartView and have an instance of that class named chartView.

In order to clear all highlighted values, I had to do:

[self.chartView highlightValues:NULL];

Hope this helps!

@mcooksey good! This helps me a lot!!

in Version 3.0.2 I use a combinedChartView for different data sets. When switching over to a new data set I call
combinedChartView.initialize()
However this misses out to clear previous highlights. I would expect that .initialize() provides me a clean chart with no left overs.

update: I overlooked the function combinedChartView.clear() which might do the entire job. So I wonder why .initialize() is there. I have not verified the functionality of .clear().

Was this page helpful?
0 / 5 - 0 ratings

Related issues

guoyutaog picture guoyutaog  Â·  3Comments

ahmedsafadii picture ahmedsafadii  Â·  3Comments

sjdevlin picture sjdevlin  Â·  3Comments

PrashantKT picture PrashantKT  Â·  3Comments

Aungbandlab picture Aungbandlab  Â·  4Comments