TCursor tool options

Ideas and wishes for TeeChart
Post Reply
nisbus
Newbie
Newbie
Posts: 18
Joined: Wed Jan 18, 2006 12:00 am
Location: Iceland
Contact:

TCursor tool options

Post by nisbus » Mon Sep 10, 2007 5:17 pm

Hi,

I would very much like to see another version of the Cursor tool that didn't just display the value of a single series.

This would be a vertical line that showed the values of all series it goes through at the point it's cutting the line.

Image

thanks,
nisbus

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 Sep 12, 2007 10:12 am

Hi nisbus,

You can easily achieve that as shown in the interpolating example I posted here.

Hope this helps!
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

nisbus
Newbie
Newbie
Posts: 18
Joined: Wed Jan 18, 2006 12:00 am
Location: Iceland
Contact:

Post by nisbus » Thu Sep 13, 2007 1:06 am

Thank you,

This example does exactly what I am trying to do except it shows the values in the chart title.

I would like just the value at the x coordinate of the cursor and the y coordinate of the series (as my screenshot implied).

If I try to use Canvas.TextOut for example how would I then get the y coordinate of each series at the x coordinate of the cursortool?

thanks,
nisbus

nisbus
Newbie
Newbie
Posts: 18
Joined: Wed Jan 18, 2006 12:00 am
Location: Iceland
Contact:

Post by nisbus » Thu Sep 13, 2007 1:26 am

I added some thing to your code with the TextOut of the charts canvas and it works pretty well except that the chart always erases my text immediately after drawing the textout.
How can I make it stick?

Code: Select all

procedure TForm1.ChartTool1Change(Sender: TCursorTool; x, y: Integer;
  const XValue, YValue: Double; Series: TChartSeries; ValueIndex: Integer);
var
  i: Integer;
  ypos : integer;
  idx : integer;
begin
  With Chart1.Title.Text do
  begin
    Clear;
    for i:=0 to Chart1.SeriesCount - 1 do
    begin
      idx := Chart1[i].XValues.Locate(Round(XValue));
      if idx > -1 then
      begin
        ypos := Chart1[i].CalcYPos(idx);
        Chart1.Canvas.TextOut(x,ypos,FloatToStr(InterpolateLineSeries(Chart1[i],XValue))+#13#10);
      end;
        Add(Chart1[i].Name + ': Y('+FloatToStr(XValue)+')= ' +
            FloatToStr(InterpolateLineSeries(Chart1[i],XValue))+#13#10);
    end;
  end;
thanks,
nisbus

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

Post by Narcís » Thu Sep 13, 2007 8:14 am

Hi nisbus,

I couldn't see your screenshot because the image doesn't open properly. Maybe you didn't add it as an URL.

Regarding the problem you are having, it is most likely that it is erased because of the tool being moved again. Maybe the easiest way to solve this would be an annotation or rectangle tool setting its position to custom. You can see an example here.
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

nisbus
Newbie
Newbie
Posts: 18
Joined: Wed Jan 18, 2006 12:00 am
Location: Iceland
Contact:

Post by nisbus » Thu Sep 13, 2007 12:12 pm

I added it as an url but my webserver seems to be down :(

Thank you, I managed to get the results I wanted using a combination of TCursorTool and TAnnotationTool.


thanks,
nisbus

Post Reply