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. Image for the cookie policy date
close icon

Essential JS 1 ejChart

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

3 Replies

KC Kalaimathi Chellaiah Syncfusion Team 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. 




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

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


KC Kalaimathi Chellaiah Syncfusion Team 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.  


Loader.
Live Chat Icon For mobile
Up arrow icon