Page 1 of 1

Formating of Data Labels in bar chart

Posted: Fri May 03, 2024 6:01 pm
by 16589592
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.

Re: Formating of Data Labels in bar chart

Posted: Tue May 07, 2024 6:19 am
by yeray
Hello,

Try with the ValueFormat property of the Series:

Code: Select all

Chart1.Series[iseries].ValueFormat:='#,##0.00';  // '#,##0.###' by default

Re: Formating of Data Labels in bar chart

Posted: Wed May 08, 2024 1:51 pm
by 16589592
That worked. Thank you very much for your help!

Re: Formating of Data Labels in bar chart

Posted: Thu May 09, 2024 8:23 am
by yeray
Hello,

Great! Glad to be helpful! :)