Page 1 of 1

Active Series

Posted: Thu Mar 27, 2008 3:13 pm
by 9337074
I am using Delphi VCL with TeeChart 7. At runtime, I need to know if a user has clicked a series off from the DBChart Legend. How can I get the information? Is the list of active series kept in a collection that I can access?

Posted: Thu Mar 27, 2008 3:50 pm
by narcis
Hi McMClark,

Yes, you can use OnClickLegend event like this:

Code: Select all

procedure TForm1.DBChart1ClickLegend(Sender: TCustomChart;
  Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
var SeriesIndex: Integer;
begin
  SeriesIndex := DBChart1.Legend.Clicked(X,Y);

  if SeriesIndex <> -1 then
    DBChart1.Title.Text[0] := 'Series ' + IntToStr(SeriesIndex) + ' selected'
  else
    DBChart1.Title.Text[0] := 'No series selected';
end;
Hope this helps!