Mpandroidchart: How to programmatically de-highlight a value?

Created on 22 Jan 2015  路  2Comments  路  Source: PhilJay/MPAndroidChart

How do I progammatically deselect a chart value in code? I would do it in onFling.

Most helpful comment

Maybe this

mChart.highlightValues(null);

Highlights the values at the given indices in the given DataSets. Provide null or an empty array to undo all highlighting. This should be used to programmatically highlight values. This DOES NOT generate a callback to the OnChartValueSelectedListener.

All 2 comments

Maybe this

mChart.highlightValues(null);

Highlights the values at the given indices in the given DataSets. Provide null or an empty array to undo all highlighting. This should be used to programmatically highlight values. This DOES NOT generate a callback to the OnChartValueSelectedListener.

I know this post is old, but this is how I implemented this (in case anyone is wondering):

    mChart.setOnChartValueSelectedListener(new OnChartValueSelectedListener() {
        @Override
        public void onValueSelected(Entry e, int dataSetIndex, Highlight h) {
            final Handler handler = new Handler();
            Runnable runnable = new Runnable() {
                @Override
                public void run() {
                    mChart.highlightValues(null);
                }
            };
            //un-highlight after 2 seconds
            handler.postDelayed(runnable, 2000);
        }

        @Override
        public void onNothingSelected() {

        }
    });
Was this page helpful?
0 / 5 - 0 ratings

Related issues

OnlyInAmerica picture OnlyInAmerica  路  3Comments

JungYongWook picture JungYongWook  路  3Comments

SutharRohit picture SutharRohit  路  3Comments

ChenZeFengHi picture ChenZeFengHi  路  3Comments

blotfi picture blotfi  路  3Comments