We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Essential JS 1 ejChart

Thread ID:

Created:

Updated:

Platform:

Replies:

146096 Jul 19,2019 10:43 AM UTC Jul 24,2019 04:51 AM UTC JavaScript - EJ 2 3
loading
Tags: Chart
Dídac Castellet Menchón
Asked On July 19, 2019 10:43 AM UTC

Hi,

I would like to configure the primaryYAxis.labelFormat, in order to decide how many decimals I want and the unit. 
I've seen I can choose the unit by adding: '{value} unit'. However, I cannot choose how many decimals. If I write: 'N3' I will receive always 3 decimals, but I cannot choose the unit.

Is there a way where I can choose both things at the same time? 

Thanks,

Best Regards,

Dídac

B&R

Kalaimathi Chellaiah [Syncfusion]
Replied On July 22, 2019 09:40 AM UTC

Hi Dídac, 
 
Greetings from Syncfusion. 
 
We have analyzed your query. We can achieve your requirement using labelFormat property of the axis and axesLabelRendering event of the chart. By using axelabeRendering event we can customize the axis labels text based on axis name. We have created a simple sample for your reference. Please find below sample and code snippet, 
 
Code Snippet: 
//To customize the decimal points 
primaryYAxis: 
            { 
                labelFormat: "N3", 
                title: { text: 'Power Consumption' }, 
                range: { min: 5, max: 54, interval:8.534 } 
            }, 
//To display both units and decimalpoints 
axesLabelRendering: function(args){ 
if(args.data.axis.name == "SecondaryAxis"){ 
args.data.label.Text= args.data.label.Text + 'unit'; 
} 
}, 
 
Screenshot: 
 
 
Hope this helps. 
 
Regards, 
Kalai. 



Dídac Castellet Menchón
Replied On July 23, 2019 07:19 AM UTC

Thank you very much. That was what I needed it!

Kalaimathi Chellaiah [Syncfusion]
Replied On July 24, 2019 04:51 AM UTC

Hi Dídac, 
 
Most welcome. Kindly get in touch with us, if you would require further assistance. We are always happy in assisting you.   
   
Thanks,   
Kalai.  


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon