Page 1 of 1

Add Tcolorline in Code vs GUI

Posted: Mon Feb 24, 2014 10:07 pm
by 16565592
Hello,

How do I add a TColorLine in the GUI compared to the GUI? I want to be able to add X number of ColorLine which varies depending on the situation. Right, I can double click on the Tchart GUI and add them through the gui. How do I do that through code?

-Mike

Re: Add Tcolorline in Code vs GUI

Posted: Tue Feb 25, 2014 3:41 pm
by yeray
Hi Mike,
sunman4008 wrote: How do I do that through code?
Here you have a simple example:

Code: Select all

uses Series, TeeTools;

procedure TForm1.FormCreate(Sender: TObject);
begin
  Chart1.View3D:=false;

  Chart1.AddSeries(TPointSeries).FillSampleValues;

  with Chart1.Tools.Add(TColorLineTool) as TColorLineTool do
  begin
    Axis:=Chart1.Axes.Left;
    Value:=Chart1[0].YValues.MaxValue*2/3;
    Pen.Color:=clRed;
  end;
end;