numeric axis label format

Hi!

I would like to format my numeric axis labels with 2 decimal places and  "°C" at the end.

I can use labelFormat: 'n2' and labelFormat: '{value}\xB0C' but I want a combination of the two.
How can I achieve this ?

Thanks


3 Replies

BP Baby Palanidurai Syncfusion Team March 23, 2018 10:16 AM UTC

Hi Jose Simoes, 

Thanks for using syncfusion products, 

We have analyzed your query. We can achieved your requirement by using axisLabelRender event. In that event, you can customize the axis labels. In your scenario, you can format numeric axis with 2 decimal places using labelFormat property and then you can add °C using axisLabelRender event. Please find the code snippet below to achieve this requirement. 


public primaryYAxis: Object = { 
        labelFormat: 'n2', 
    }; 

public axisLabelRender(args: IAxisLabelRenderEventArgs): void { 
            if(args.axis.orientation === 'Vertical') { 
               args.text = args.text + '°C'; 
            } 
    }; 

Screenshot:  
 

Sample for your reference can be find from below link, 

Kindly revert us, if you have any concerns. 

Thanks, 
Baby. 



JS Jose Simoes March 23, 2018 12:14 PM UTC

That woks for me.
Thanks


BP Baby Palanidurai Syncfusion Team March 24, 2018 02:16 PM UTC

Hi Manu, 

Thanks for your update, 

Please let us know if you need any further assistance on this. 

Regards, 
baby 
  
  


Loader.
Up arrow icon