I wish to display several horizontal bars or lines of different widths but same height at the same Y Value whose individual bar or line segments are disconnected from each other and can be individually colored. The will be more than one of the "series" of such groups of values.
For example, a bar or line would be drawn between the following X data values all having the same Y value of 1 : (Similar data sets would be drawn at Y=2 and Y=3, etc)
1.5 to 2.2
2.7 to 3.5
4.0 to 7.1
Nothing would be displayed between 2.2 and 2.7 or 3.5 to 4.0. I have not been able to come up with a way to use a bar series to accomplish this. It can be done with a line series using :
Series1.ColorEachPoint := true;
Series1 ColorEachLine := true;
Series1.LinePen.EndStyle := esFlat;
Series1.LinePen.Width := 4;
with Series1 do
begin
AddXY(2,1,'',clred);
AddXY(3,1,'',clred);
AddNullXY(3,1,'');
AddXY(3.5,1,'',cllime);
AddXY(4,1,'',cllime);
AddNullXY(4,1,'');
AddXY(5,1,'',clred);
AddXY(6,1,'',clred);
end;
Creating the line series at run time and setting its line pen end style gives Undeclared identifier error for esFlat :
(chart1.Series[0] as TLineSeries).LinePen.EndStyle := esFlat;
Disconnected Self-Stacked Horizontal Bar or Line segments
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi SteveP,
It must be because you need to add TeCanvas unit to your form uses section. It works fine here including the unit and using:
It must be because you need to add TeCanvas unit to your form uses section. It works fine here including the unit and using:
Code: Select all
procedure TForm1.FormCreate(Sender: TObject);
begin
Chart1.AddSeries(TLineSeries.Create(self));
with (Chart1[0] as TLineSeries) do
begin
ColorEachPoint := true;
ColorEachLine := true;
LinePen.EndStyle := esFlat;
LinePen.Width := 4;
AddXY(2,1,'',clred);
AddXY(3,1,'',clred);
AddNullXY(3,1,'');
AddXY(3.5,1,'',cllime);
AddXY(4,1,'',cllime);
AddNullXY(4,1,'');
AddXY(5,1,'',clred);
AddXY(6,1,'',clred);
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 |