MPAndroidChart如果值超过常数

时间:2019-02-21 21:11:00

标签: mpandroidchart

我想制作一个折线图

对于许多值,如果存在超过常量的值,

其点颜色更改为另一种颜色

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

我阅读并尝试遵循此方法,但是它改变了条形而不是点

我该怎么办?

这是我的代码

private void setData(int count,int range)

   ArrayList<Integer> color = new ArrayList<>();
   ArrayList<Entry> yVals1 = new ArrayList<>();
   for (int i=0; i<count; i++)
   {
    float val = (float) (Math.random()*range);
    if (val > 50){

        //color.add(Color.RED);
        //color.add(ColorTemplate.rgb("ff0000"));
        yVals1.add(new Entry(i, val));
    } else {


        //color.add(Color.BLACK);
       // color.add(ColorTemplate.rgb("000000"));
        yVals1.add(new Entry(i, val));
    }

}

0 个答案:

没有答案