Mark centre between two points or determined point on one.

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
Hallo_Thomas
Newbie
Newbie
Posts: 7
Joined: Mon Sep 26, 2005 4:00 am

Mark centre between two points or determined point on one.

Post by Hallo_Thomas » Thu Apr 13, 2006 10:01 am

I would like to make a mark between two horizontal points
How does this go?

I alternatively wanted to make a centred point and make a mark there.

Code: Select all

   var
   Series1:TFastLineseries;
   begin
    Series1.AddXY(5+(25-5)/2,y); //alternatively Point
    Series1.AddXY(5,y);   ///Point 1
    Series1.AddXY(25,y);///Point 2
   end;

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 Apr 13, 2006 10:22 am

Hi Hallo_Thomas,

You could use a TAnnotationTool and something similar to this:

Code: Select all

procedure TForm1.SetCallout(AIndex: Integer);
begin
  // Re-position annotation callout
  with ChartTool1.Callout do
  begin
    Visible:=True;
    XPosition:= Series1.CalcXPos(AIndex) + ((Series1.CalcXPos(AIndex+1)-Series1.CalcXPos(AIndex)) div 2);
    YPosition:=Series1.CalcYPos(AIndex);
    ZPosition:=0;

    ChartTool1.Left:=XPosition-20;
    ChartTool1.Top:=YPosition-50;
  end;
end;

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

  // force a first-time chart redrawing, to obtain valid
  // coordinates (Series1.CalcYPos, etc).
  Chart1.Draw;

  // Start positioning annotation callout at point index 5
  SetCallout(Index);

  ChartTool1.Callout.Arrow.Visible:=True;
end;

procedure TForm1.Chart1AfterDraw(Sender: TObject);
begin
  SetCallout(Index);
end;

procedure TForm1.Chart1Zoom(Sender: TObject);
begin
  Chart1.Draw;
end;

procedure TForm1.Chart1UndoZoom(Sender: TObject);
begin
  Chart1.Draw;
end;

procedure TForm1.Chart1Scroll(Sender: TObject);
begin
  Chart1.Draw;
end;
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