Detect which series is being clicked when clicking legend
Posted: Fri Apr 01, 2005 7:58 am
when user click in the legend area. Suppose i have 5 series, how to detect which series is being clicked.
thank you
thank you
Steema Software - Customer Support Forums
http://216.92.101.67/support/
Code: Select all
procedure TForm1.FormCreate(Sender: TObject);
var
i: Integer;
begin
for i:=0 to Chart1.SeriesCount-1 do
begin
Chart1[i].FillSampleValues();
Chart1[i].SeriesColor:=clRed;
end;
end;
procedure TForm1.Chart1ClickLegend(Sender: TCustomChart;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
var
SeriesIndex: Integer;
begin
SeriesIndex:=Chart1.Legend.Clicked(X,Y);
Chart1[SeriesIndex].SeriesColor:=clBlue;
Chart1.Title.Text.Clear;
Chart1.Title.Text.Add(IntToStr(SeriesIndex));
end;