Page 1 of 1

Mark centre between two points or determined point on one.

Posted: Thu Apr 13, 2006 10:01 am
by 9040391
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;

Posted: Thu Apr 13, 2006 10:22 am
by narcis
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;