Problem with OnGetAxisLabel event

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
lolo1988
Newbie
Newbie
Posts: 9
Joined: Tue Jul 26, 2005 4:00 am

Problem with OnGetAxisLabel event

Post by lolo1988 » Thu Aug 17, 2017 11:58 am

Hello,
I've got an issue when using the OnGetAxisLabel.
I've got a couple of TLineSeries, created at runtime, with ParentChart assigned to Chart1 for instance.

Those Series are drawn correctly in Chart1.
But when the Chart1.OnGetAxisLabel(Sender : TChartAxis; Series: TChartSeries; ValueIndex: integer; var LabelText: string) events occur, Series is not assigned and ValueIndex is always equal to -1, whatever the actual position of LabelText.
I want to custom the new LabelText with Series.XValues and ValueIndex, but I failed in connecting the runtime series with the actual Chart axis...

Thanks for any help,
Regards,
Laurent

- Delphi6 / Teechart 7.04 -

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: Problem with OnGetAxisLabel event

Post by Sandra » Fri Aug 18, 2017 3:32 pm

Hello Laurent,

Maybe the problem is caused because you need set the LabelStyle as Text. The code below works fine for me using latest TeeChart Pro 707:

Code: Select all

procedure TForm1.Chart1GetAxisLabel(Sender: TChartAxis;
  Series: TChartSeries; ValueIndex: Integer; var LabelText: String);
begin
if valueIndex>-1 then
Caption:= 'ValueInex'+ FloatToStr(valueIndex); //Change that for your code.
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
Series1.FillSampleValues(10);
Chart1.Axes.Bottom.LabelStyle := talText;
end;
Hoping this helps you.
Thanks in advance
Best Regards,
Sandra Pazos / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

lolo1988
Newbie
Newbie
Posts: 9
Joined: Tue Jul 26, 2005 4:00 am

Re: Problem with OnGetAxisLabel event

Post by lolo1988 » Mon Aug 21, 2017 10:14 am

Hello Sandra,
Thank you for your reply.

Actually, my problem came from the fact that the "Series" parameter of the event is not assigned when the event occurs. So calling properties of this local parameter failed.
I solve my problem by using the global Chart1.Series parameter instead of the local 'Series' parameter of the event.

But I'm interested in having information about how the "series" local parameter of the OnGetAxisLabel event works and how it is fed when several series share the same axis?

Thank you again for your help,
Regards,
Laurent

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

Re: Problem with OnGetAxisLabel event

Post by Yeray » Tue Aug 22, 2017 7:31 am

Hello Laurent,
lolo1988 wrote:But I'm interested in having information about how the "series" local parameter of the OnGetAxisLabel event works and how it is fed when several series share the same axis?
The OnGetAxisLabel event should be fired with an assigned Series parameter when there are labels in that series and the Axis LabelStyle property is set to talAuto, talText or talMark.
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