Mpandroidchart: Change Highlight indicator on Line charts

Created on 27 Jun 2015  路  6Comments  路  Source: PhilJay/MPAndroidChart

Hi Phil,
I've looked in the documentation, and couldn't find anything to change the highlight indicator on line charts.
I'm looking at changing the color, width, and removing the horizontal line.
I've only found a way to change the width so far (chart.setHighlightLineWidth() )
Thank you

Most helpful comment

Hi, while drawing the vertical highlight line in a line chart, i need to show only the line upto the point in the graph.
How can we implement that

All 6 comments

@knseir Have you already tried setHighLightColor(int color) of the BarLineScatterCandleDataSet to change the color?
Your implementation might look something like this to change the color of your highlight indicator:

LineDataSet set = new LineDataSet(mYVals, label);
...
set.setHighLightColor(ctx.getResources().getColor(R.color.color_highlight_indicator));

Not sure what you meant with

removing the horizontal line

though. Did you mean you only want to remove the horizontal line but want the vertical line to be shown?

'Did you mean you only want to remove the horizontal line but want the vertical line to be shown?'
Yes, that's it. The intersection of the highlight indicator and the line chart is marked by a vertical and a horizontal line. I need to show only the vertical line.

Also, if possible, replace that line by a custom drawable

@knseir Sorry, but I'm not aware of a possibility to do something like that. Maybe @PhilJay or @danielgindi can help you there.

@fountaingeyser Thanks for answering. I'll look into making some changes to the library then

Hi, while drawing the vertical highlight line in a line chart, i need to show only the line upto the point in the graph.
How can we implement that

@knseir Have you already tried setHighLightColor(int color) of the BarLineScatterCandleDataSet to change the color?
Your implementation might look something like this to change the color of your highlight indicator:

LineDataSet set = new LineDataSet(mYVals, label);
...
set.setHighLightColor(ctx.getResources().getColor(R.color.color_highlight_indicator));
Not sure what you meant with

removing the horizontal line

though. Did you mean you only want to remove the horizontal line but want the vertical line to be shown?

Set property drawHorizontalHighlightIndicatorEnabled = false on the set you want to remove horizontal line

Was this page helpful?
0 / 5 - 0 ratings

Related issues

AndroidJiang picture AndroidJiang  路  3Comments

andreyfel picture andreyfel  路  3Comments

DarkHelmet67 picture DarkHelmet67  路  3Comments

tsengvn picture tsengvn  路  3Comments

mrZizik picture mrZizik  路  3Comments