Page 1 of 1

About Legend not showing Series color

Posted: Wed Jul 04, 2007 2:55 pm
by 9245569
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;

Posted: Wed Jul 04, 2007 3:07 pm
by narcis
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.

Posted: Wed Jul 04, 2007 3:11 pm
by 9245569
Thank you very much for your prompt reply. I will give it a try this way.

Kindest regards