Page 1 of 1

How to get Legend Text

Posted: Tue Jun 21, 2005 6:23 am
by 9339722
Hi,

I have a normal line series chart with couple of line series displayed. I also have legend visible for each series.

I am assigning the following procedure to Chart's OnClickSeries event

Code: Select all

procedure DoOnClickSeries(Sender: TCustomChart; Series: TChartSeries; ValueIndex: Integer; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); 
So whenever someone clicks on the series I want to show the legend text of that series

Is this possible..? Please help.

Thanks :)

Posted: Tue Jun 21, 2005 7:29 am
by narcis
Hi Command Alkon,

Yes, you can do something like:

Code: Select all

  if Series.Title='' then Caption:=Series.Name
  else Caption:=Series.Title;

Posted: Tue Jun 21, 2005 9:22 pm
by 9339722
Thank a lot. You da man.

BTW Series.Name gave me nothing while Series.Title gives me what I want.

Cheers again :)

Posted: Wed Jun 22, 2005 7:09 am
by narcis
Hi,

You're welcome. I'm glad to hear this solved your problem.
BTW Series.Name gave me nothing while Series.Title gives me what I want.
Yes, this will depend on if you give your series a name or not. That's why I included both options.