change single point color in teechart

后端 未结 1 1102
死守一世寂寞
死守一世寂寞 2021-01-29 14:00

i\'m using teechart in java.I want to change some points color in a series,not all of the points.If the point\'s value is over a specific value,then turn the point into red.

相关标签:
1条回答
  • 2021-01-29 15:01

    You can set a color per each point. Ie:

        tChart1.getAspect().setView3D(false);
        Line xline = new Line(tChart1.getChart());
        xline.fillSampleValues();
    
        xline.getPointer().setVisible(true); // 数据点突出显示
        // xline.getPointer().setStyle(PointerStyle.CIRCLE);
        xline.getPointer().setHorizSize(2);
        xline.getPointer().setVertSize(2);
        //xline.getPointer().setColor(Color.black);
        //xline.getPointer().getPen().setColor(Color.black);
    
        double thr = xline.getYValues().getMinimum() + (xline.getYValues().getMaximum() - xline.getYValues().getMinimum()) / 3;
        for (int i=0; i<xline.getCount(); i++) {
            if (xline.getYValues().getValue(i) > thr) {
                xline.getColors().setColor(i, Color.black);
            }
        }
    
    0 讨论(0)
提交回复
热议问题