0

How can I paint selected point on TeeChart.Java in Swing?

this is the effect I want

I've serached the question: How to paint selected point on 3D surface.It says there is aValueColor[ValueIndex] property to change the color,but i don't find it in java version.

Here is the code i tryed to change the pointer's color:

line.fillSampleValues();
tChart2.addSeries(line);
line.getPointer().setVisible(true);
line.getPointer().setStyle(PointerStyle.CIRCLE);
line.getPointer().setColor(Color.BLACK);        
colorline=new ColorLine(line.getVertAxis());
colorline.setAllowDrag(false);                     
colorline.setValue((line.getMaxYValue()+line.getMinYValue())/2);
for(int i=0;i<line.getCount();i++)
{
    System.out.println(line.getYValues().getValue(i));
    if(line.getYValues().getValue(i)>colorline.getValue()){
        SeriesXYPoint point=line.getPoint(i);                       
        System.out.println(i);
        line.getPointer().draw((int)point.getX(),(int)point.getY(),Color.RED);
    }
}

There is a NullPointerException in line.getPointer().draw((int)point.getX(),(int)point.getY(),Color.RED); and i don't know why.

Community
  • 1
  • 1
Mai
  • 11
  • 2
  • The thing that can be `null` is `point`. – kiheru May 16 '15 at 08:10
  • I modify the code from the example code of Teechart. There is a `JCombobox` above these code. **NullPointerException** shows in the begining ,but after i select the same `JCombobox`, there isn't any exception. – Mai May 16 '15 at 08:32
  • Very similar to [this other question](http://stackoverflow.com/questions/30219595/change-single-point-color-in-teechart). [Here](http://stackoverflow.com/a/30297336/509369) my reply there. – Yeray May 18 '15 at 07:29

0 Answers0