Just wondering if anyone has figured out how to set the highlight color for a bar chart in MPAndroidChart? Currently it's like a dark black (somewhat transparent) overlay. I would like to make it a white (somewhat transparent) overlay, and maybe even a gradient. Kind of like this:
The BarDataSet
extends BarLineScatterCandleBubbleDataSet
which has a setHighLightColor
method:
/**
* Sets the color that is used for drawing the highlight indicators. Dont
* forget to resolve the color using getResources().getColor(...) or
* Color.rgb(...).
*
* @param color
*/
public void setHighLightColor(int color) {
mHighLightColor = color;
}
The BarDataSet
also has a setHighLightAlpha
method:
/**
* Set the alpha value (transparency) that is used for drawing the highlight
* indicator bar. min = 0 (fully transparent), max = 255 (fully opaque)
*
* @param alpha
*/
public void setHighLightAlpha(int alpha) {
mHighLightAlpha = alpha;
}
Neither of these methods would support a gradient but you can change the appearance of the highlight.
If you are looking to implement the gradient highlighting you can probably extend the BarChartRenderer
and override the drawHighlighted(Canvas c, Highlight[] indices)
and apply it to your chart via the setRenderer
method (I haven't tried this personally).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With