Moving Cursor under Program Control

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
Satish
Newbie
Newbie
Posts: 37
Joined: Fri Mar 04, 2005 5:00 am

Moving Cursor under Program Control

Post by Satish » Sun Apr 24, 2005 6:16 pm

I have a vertical cursor MyCursor (type TCursorTool) and have set the following statements in my program:-

MyCursor:=TCursorTool.Create(Self);
MyCursor.ParentChart:=Chart1;
MyCursor.Series:=Series1;
MyCursor.FollowMouse:=true;
MyCursor.Style:=cssVertical;
MyCursor.Visible:=true;
MyCursor.UseChartRect:=true;
MyCursor.snap:=true;

The manual cursor movement is fine. How does one force the cursor under program control to the last point in Series1. I need to do this so that the cursor highlights the most current data of stock prices.

Will appreciate ideas/suggestions.

Satish

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Mon Apr 25, 2005 7:53 am

Hi Satish,

You should use:

Code: Select all

MyCursor.XValue:=Series1.XValue[Series1.Count-1];
However it doesn't work properly. I've done some testing and the why to get it work is:

Code: Select all

procedure TForm1.FormCreate(Sender: TObject);
begin
  Series1.FillSampleValues();

  ChartTool1.XValue:=Series1.XValue[Series1.Count-1];
end;

procedure TForm1.Chart1BeforeDrawSeries(Sender: TObject);
begin
    ChartTool1.XValue:=Series1.XValue[Series1.Count-1];
end;
It's weird but this is the combination that works by now. I've already introduced this to our deffect list to be fixed for our next releases.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Satish
Newbie
Newbie
Posts: 37
Joined: Fri Mar 04, 2005 5:00 am

Post by Satish » Tue Apr 26, 2005 7:12 pm

Narcis,

Thanks - this works fine when I bring up the chart first time. When I move to another chart (by clicking a button) the cursor really does not go to the last date. Do I need to refresh/repaint the chart/series for this ?

Regards,

Satish

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Wed Apr 27, 2005 7:18 am

Hi Satish,

Are you positioning the cursor to the last value after populating the chart and at OnBeforeDrawSeries event for the other charts?

If you are doing this and still doesn't work please send un an application we can run "as-is" to reproduce the problem here. Please send your examples at [url]news://www.steema.net/steema.public.attachments[/url] newsgroup.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Post Reply