TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
-
PoLabs
- Newbie
- Posts: 35
- Joined: Fri Feb 05, 2010 12:00 am
Post
by PoLabs » Fri Jun 18, 2010 8:31 am
Hi,
I have a problem with setting TCurosorTool.YValue property.
I have the code like:
Code: Select all
Cursor.Visible := true;
Cursor.Series := TCustomSeries(Chart.SeriesList[Idx]);
// prevent calling event handler on changing Cursor
T := Trigger.OnChange;
Cursor.OnChange := nil;
if (Level * Koef > Chart.LeftAxis.Maximum) then
Cursor.YValue := Chart.LeftAxis.Maximum else
if (Level * Koef < Chart.LeftAxis.Minimum) then
Cursor.YValue := Chart.LeftAxis.Minimum else
Cursor.YValue := Level * Koef ;
// set old event handler
Cursor.OnChange := T;
First time when I call this code the cursor's YValue is always set at 0, regardles the product of Level*Koef is different than zero. So if I add breakpoint and add Cursor.YValue to watch list I can see 0 all the time. If I inspect the Level * Koef I get something that is it different from 0 (eg. -8,9) but cursor Y value remains 0 (and only the first time I call this).
Thanks for your help.
Br
-
PoLabs
- Newbie
- Posts: 35
- Joined: Fri Feb 05, 2010 12:00 am
Post
by PoLabs » Fri Jun 18, 2010 8:54 am
I attached some screenshot of debugging:
-
Yeray
- Site Admin
- Posts: 9612
- Joined: Tue Dec 05, 2006 12:00 am
- Location: Girona, Catalonia
-
Contact:
Post
by Yeray » Fri Jun 18, 2010 4:00 pm
Hi PoLabs,
Maybe you need to force a Chart repaint so that the internal values will be calculated.
If you still have problems with it, please try to arrange a simple example project we can run as-is to reproduce the problem here.
-
PoLabs
- Newbie
- Posts: 35
- Joined: Fri Feb 05, 2010 12:00 am
Post
by PoLabs » Mon Jun 21, 2010 7:30 am
Hi,
I added Chart.Repaint after OnChange := nil and it works now. I guess there needs to be done some recalulations before setting YValue value of cursor.
Thanks again.
Br,
PoLabs
-
Yeray
- Site Admin
- Posts: 9612
- Joined: Tue Dec 05, 2006 12:00 am
- Location: Girona, Catalonia
-
Contact:
Post
by Yeray » Mon Jun 21, 2010 8:13 am
Hi PoLabs,
You're welcome!