Chart Y-axis rounding to 2 decimals

Hi,

using the WChart class in Syncfusion.DocIO.DLS library, it's not possible to have Y-axis labels rounded to 2 decimals.

Even if you set 

 _chart.PrimaryValueAxis.NumberFormat = "n2";

a small scale like:

0.05

0.10

0.15

becomes something like:

0.00

0.00

0.00

In other Syncfusion chart classes usually there is this property:

chartControl1.PrimaryYAxis.RoundingPlaces = 2;

where you can define the precision, but not in WChart class.


Is there another way to solve the problem?


thanks.




2 Replies

MZ maurizio ziraldo February 21, 2022 02:07 PM UTC

NOTE: the platform is not exactly ASP.NET Core - EJ 2. it is a more general ASP.NET Core, but the problem is the same on all platforms




MR Manikandan Ravichandran Syncfusion Team February 22, 2022 06:04 PM UTC

Hi Maurizio,

From the given details, we have found that your requirement is to display the Y axis with 2 decimal number. You can use the below code to achieve the same.

 
//set the value axis formatt as 2decimal number format
chart.PrimaryValueAxis.NumberFormat = "#,##0.00"; 

Regards,
Manikandan Ravichandran 


Loader.
Up arrow icon