改变teechart中的单点颜色 [英] change single point color in teechart
本文介绍了改变teechart中的单点颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在java中使用teechart。我想要更改系列中的某些点颜色,而不是所有点。如果点的值超过特定值,则将该点变为红色。
i只知道如何更改所有点的颜色,这是我的代码。
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.
i just know how to change all the point's color,and here is my code.
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);
有人可以告诉我一些如何执行此操作的代码吗?
can someone show me some code on how to do this?
推荐答案
您可以为每个点设置颜色。即:
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);
}
}
这篇关于改变teechart中的单点颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文