How to change dot colors if value is higher than constant in MPAndroidChart

余生颓废 提交于 2019-11-29 17:59:05

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!