Skip to content Skip to sidebar Skip to footer

How To Change Dot Colors If Value Is Higher Than Constant In Mpandroidchart

I need to draw red circles if value higher than 3. How to realize that? I've read that I should override method drawCircles but I dont understand where I should do this. LineDa

Solution 1:

Try with this:

Define one ArrayList:

ArrayList<Integer> color = new ArrayList<>();

And add your condition as:

if (YOUR_CONDITION) {
    color.add(ColorTemplate.rgb("#f8bf94"));
    yVals1.add(new Entry(VALUE, COUNTER));
} else {
    color.add(ColorTemplate.rgb("#e0e0e0"));
    yVals1.add(new Entry(VALUE, COUNTER));
}

And before adding dataset, add

set1.setColors(color);

For your reference, you can check this link. Hope this answer will help you.

Post a Comment for "How To Change Dot Colors If Value Is Higher Than Constant In Mpandroidchart"