I have to draw a TLineSeries breaking it in some points.
For example, points 1 to 10 must be connected, and also points 11 to 20, but point 10 and 11 must be not connected.
Is it possible?
Thanks
Best Regards
FM
Breaking TLineSeries
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi FM,
Yes, this is possible adding null values to the series:
Yes, this is possible adding null values to the series:
Code: Select all
procedure TForm1.FormCreate(Sender: TObject);
var i: Integer;
begin
Randomize;
for i:=0 to 20 do
if i=11 then Series1.AddNull('')
else Series1.Add(random);
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 |
Instructions - How to post in this forum |
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi FM,
To achieve what you request you have 2 options:
1) Using a TLineSeries and adding an additional null point between the two points where the gap has to be:
2) Using a TPointSeries and TChart's OnAfterDraw event to custom draw a line between the points you want need and not drawing the line for the null point gap:
To achieve what you request you have 2 options:
1) Using a TLineSeries and adding an additional null point between the two points where the gap has to be:
Code: Select all
procedure TForm1.FormCreate(Sender: TObject);
var i: Integer;
begin
Randomize;
for i:=0 to 20 do
begin
if i=11 then Series1.AddNullXY(i-0.5,random);
Series1.AddXY(i,random);
end;
end;
Code: Select all
procedure TForm1.FormCreate(Sender: TObject);
begin
Series1.FillSampleValues();
Series1.Pointer.Visible:=false;
end;
procedure TForm1.Chart1AfterDraw(Sender: TObject);
var
Index: Integer;
begin
With Chart1.Canvas, Series1 do
for Index:=1 to Count-1 do
if Index <> 11 then
begin
MoveTo(CalcXPos(Index-1),CalcYPos(Index-1));
LineTo(CalcXPos(Index),CalcYPos(Index));
end;
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 |
Instructions - How to post in this forum |