Page 1 of 1
TeeChart 3 CursorTool
Posted: Fri Jan 25, 2008 6:27 pm
by 13045133
Hello,
I have a problem with the TeeChart CursorTool. I use the lastest version.
private void fastLine1_AfterDrawValues(object sender, Steema.TeeChart.Drawing.Graphics3D g)
{
// Call cursorTool1.XValue -> does not work
cursorTool1.XValue = 100;
// Call cursorTool1.XValue again -> it works....
// Comment this line and try again...
cursorTool1.XValue = 100;
}
Thank you for your help.
Best regards
Andreas Lindenthal
Posted: Mon Jan 28, 2008 11:47 am
by yeray
Hi Andreas,
I seems that the X and Y values for the CursorTool aren't stored correctly if you don't repaint or update chart's the internal values before. You can force it but take care because then OnAfterDraw event will be called. So, don't call those methods inside OnAfterDraw event.
For example:
Code: Select all
public partial class Form1 : Form
{
Steema.TeeChart.Tools.CursorTool cursor1;
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
tChart1.Aspect.View3D = false;
Steema.TeeChart.Styles.Points point1 = new Steema.TeeChart.Styles.Points(tChart1.Chart);
point1.FillSampleValues(25);
cursor1 = new Steema.TeeChart.Tools.CursorTool(tChart1.Chart);
Bitmap bmp = tChart1.Bitmap;
cursor1.XValue = 10;
}
private void tChart1_AfterDraw(object sender, Steema.TeeChart.Drawing.Graphics3D g)
{
tChart1.Header.Text = Convert.ToString(cursor1.XValue);
}
}
In this example, if you don't use
, the first time the Chart title won't be updated.
Finally, note that I've added to the wish-list this issue to be studied if this "repaint" should be done internally or not (TF02012775).
Posted: Mon Feb 11, 2008 11:03 am
by 13045133
Hi Yeray Alonso
Is this the only solution ?
We have to call 'Bitmap bmp = tChart1.Bitmap;' to be shure, that 'cursor1.XValue = value' works correct....?
Best regards
Andreas Lindenthal
Posted: Tue Feb 12, 2008 9:42 am
by narcis
Hi Andreas,
Yes, you need to use this method to force TeeChart being internally repainted and therefore such properties having valid values.
Posted: Tue Feb 12, 2008 12:08 pm
by 13045133
Hello Narcis,
okay but this is more an workaround.
You wrote you add it to as a wish-list issue, but form me is more like a bug.
I hope you will fix it next time.
Best regards
Andreas
Posted: Tue Feb 12, 2008 12:44 pm
by narcis
Hi Andreas,
We think it's a feature request for BeforeDrawAxis and AfterDrawAxis events. The cursor tool needs the axis calculations to work. These are only available after the axis is drawn and the axis is drawn after the series. However, there is no event between the axis being drawn and the tools being drawn, that's why the chart has to be painted twice. Anyway, you could use tChart1.Draw() instead of creating a temporary bitmap.