Series created by crosstab: SeriesMouseEnter event?

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
MVBobj
Newbie
Newbie
Posts: 34
Joined: Fri Jul 17, 2015 12:00 am
Contact:

Series created by crosstab: SeriesMouseEnter event?

Post by MVBobj » Mon Aug 17, 2015 5:05 pm

Hi,

Is it possible to establish a SeriesMouseEnter event for a series that is created by a crosstab and therefore doesn't exist until runtime?

I have one series at design time and at runtime, through the actions of the crosstab, it morphs into a total of 6 series. I have a SeriesMouseEnter & SeriesMouseLeave for Series1 and I want the same events to fire for each of the other series.

How do I do this?

Thanks.

Yeray
Site Admin
Site Admin
Posts: 9514
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Series created by crosstab: SeriesMouseEnter event?

Post by Yeray » Tue Aug 18, 2015 11:58 am

Hello,

When you use TDBCrossTabSource, the series are created when you activate the dataset associated to it; it can be at runtime but also at designtime.
If you are activating it at runtime, you can loop the series in the chart after it to assign the events for the new series. Ie:

Code: Select all

procedure TForm1.FormCreate(Sender: TObject);
var i: Integer;
begin
  Table1.Active:=true;

  for i:=0 to Chart1.SeriesCount-1 do
  begin
    Chart1[i].OnMouseEnter:=SeriesMouseEnter;
    Chart1[i].OnMouseLeave:=SeriesMouseLeave;
  end;
end;

procedure TForm1.SeriesMouseEnter(Sender: TObject);
begin
  with Sender as TChartSeries do
    Caption:='Series ' + Title + ' entered';
end;

procedure TForm1.SeriesMouseLeave(Sender: TObject);
begin
  with Sender as TChartSeries do
    Caption:='Series ' + Title + ' left';
end;
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Post Reply