Formating of Data Labels in bar chart

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
Zach A
Newbie
Newbie
Posts: 8
Joined: Mon Oct 05, 2020 12:00 am

Formating of Data Labels in bar chart

Post by Zach A » Fri May 03, 2024 6:01 pm

Hello

I have been trying to format the data labels to only display 2 decimal digits. The attached screenshot displays 3 decimal digits.

I have tried a number of things, including

Code: Select all

Chart1.Series[iseries].AddXY(QYear, QVal, Format('%7.2f',[Qval])); //this will also change the Xaxis label (XLabel); 

Chart1.Series[iseries].Marks.Items[iPoint].text.Add(Format('%7.2f',[Qval])); // this adds text to the existing label; even if cleared.
The values format for the left axis is set to 2 decimals, but this does not seem to affect the data labels.

Code: Select all

LeftAxis.AxisValuesFormat := '0.00' ; 
Please advise.
Attachments
datalabels.PNG
datalabels.PNG (40.1 KiB) Viewed 20571 times

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

Re: Formating of Data Labels in bar chart

Post by Yeray » Tue May 07, 2024 6:19 am

Hello,

Try with the ValueFormat property of the Series:

Code: Select all

Chart1.Series[iseries].ValueFormat:='#,##0.00';  // '#,##0.###' by default
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

Zach A
Newbie
Newbie
Posts: 8
Joined: Mon Oct 05, 2020 12:00 am

Re: Formating of Data Labels in bar chart

Post by Zach A » Wed May 08, 2024 1:51 pm

That worked. Thank you very much for your help!

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

Re: Formating of Data Labels in bar chart

Post by Yeray » Thu May 09, 2024 8:23 am

Hello,

Great! Glad to be helpful! :)
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