About Legend not showing Series color

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
johnnix
Newbie
Newbie
Posts: 5
Joined: Mon Jun 18, 2007 12:00 am

About Legend not showing Series color

Post by johnnix » Wed Jul 04, 2007 2:55 pm

Hello,

I use the following procedure to load my data on a chart. The problem I am facing is that the legend does not display the horizontal line with the color of the Series (if I set ColorEachPoint to false then the legend is shown correctly). Am I doing something wrong here?

Code: Select all

procedure TSignal.LoadDataToChart(chart: TChart;color : TColor);
var l : TLineSeries;
    d : PDataElement;
    i : integer;
begin
l := TLineSeries.Create(chart);
l.Title := floattostrf(depth,fffixed,10,2)+ ' m';
l.Color := color;
l.ShowInLegend := true;
l.ColorEachPoint := true;
l.Tag := Handle;
chart.Legend.LegendStyle := lsSeries;
for i := 0 to data.Count - 1 do
  begin
    d := data.Items[i];
    if (i > leftIndex) and (i<RightIndex) then
      l.AddXY(d^.time,d^.value,'',color)
      else
      l.AddXY(d^.time,d^.value,'',clsilver);

  end;
chart.AddSeries(l);
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 » Wed Jul 04, 2007 3:07 pm

Hi johnix,

No, when using ColorEachPoint:=true legend symbol has no color because it doesn't know which color should display for each series.

Anyway, you may be interested in having a look at the All Features\Welcome!\Miscellaneous\Legend\Symbol OnDraw example at TeeChart's features demo. You'll find the demo at TeeChart's program group.
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

johnnix
Newbie
Newbie
Posts: 5
Joined: Mon Jun 18, 2007 12:00 am

Post by johnnix » Wed Jul 04, 2007 3:11 pm

Thank you very much for your prompt reply. I will give it a try this way.

Kindest regards

Post Reply