About Legend not showing Series color
Posted: 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?
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;