TeeChart for Java (NetBeans, Eclipse, Android Studio, etc)
-
Turc
- Newbie
- Posts: 34
- Joined: Wed Feb 03, 2010 12:00 am
Post
by Turc » Wed Aug 04, 2010 11:25 pm
Few issues regarding the Annotation Tool.
1. How do you move an Annotation during runtime on a chart?
2. I can set the text in an Annotation during runtime, but if i write something into the annotation again, it throws multiple errors.
Code: Select all
annotation.setText(JOptionPane.showInputDialog((Annotation)e.getSource()).toString());
Thank you
-
Turc
- Newbie
- Posts: 34
- Joined: Wed Feb 03, 2010 12:00 am
Post
by Turc » Thu Aug 05, 2010 12:06 am
Is there something similar to the .net rectangle tools in java? That seems to do everything that i need it to do.
-
Yeray
- Site Admin
- Posts: 9613
- Joined: Tue Dec 05, 2006 12:00 am
- Location: Girona, Catalonia
-
Contact:
Post
by Yeray » Thu Aug 05, 2010 4:49 pm
Hi Turc,
I have a Chart and a Button in a NetBeans project. The
clicked Action is executed when I press the button.
It seems to work as expected here. Doesn't it for you?
Code: Select all
private com.steema.teechart.styles.Line line1;
private com.steema.teechart.tools.Annotation annotation1;
private void initChart() {
tChart1.getAspect().setView3D(false);
line1 = new com.steema.teechart.styles.Line(tChart1.getChart());
line1.getPointer().setVisible(true);
line1.fillSampleValues(25);
annotation1 = new com.steema.teechart.tools.Annotation(tChart1.getChart());
annotation1.setActive(false);
}
@Action
public void clicked() {
java.util.Random rnd = new java.util.Random();
int ValueIndex = rnd.nextInt(line1.getCount());
annotation1.setActive(true);
annotation1.setLeft(tChart1.getSeries(0).calcXPos(ValueIndex) + 25);
annotation1.setTop(tChart1.getSeries(0).calcYPos(ValueIndex) - 25);
annotation1.setText("P(" + Double.toString(tChart1.getSeries(0).getXValues().getValue(ValueIndex)) + ";" + Double.toString(tChart1.getSeries(0).getYValues().getValue(ValueIndex)) + ")");
annotation1.getCallout().getArrow().setVisible(true);
annotation1.getCallout().setXPosition(tChart1.getSeries(0).calcXPos(ValueIndex));
annotation1.getCallout().setYPosition(tChart1.getSeries(0).calcYPos(ValueIndex));
annotation1.setText(javax.swing.JOptionPane.showInputDialog(annotation1.getText()));
}
-
Turc
- Newbie
- Posts: 34
- Joined: Wed Feb 03, 2010 12:00 am
Post
by Turc » Thu Aug 05, 2010 5:18 pm
Yeray,
Thanks, that works great. I also figured out how to move the Annotation. Thank you again for assisting me!
-
Yeray
- Site Admin
- Posts: 9613
- Joined: Tue Dec 05, 2006 12:00 am
- Location: Girona, Catalonia
-
Contact:
Post
by Yeray » Thu Aug 05, 2010 7:54 pm
Hi Turc,
You're welcome!