Hello,
I want to format my axis label as
'{value} l/min'but I also want to round value to one decimal. How can I do that? The documentation gives me either/or.
Ewa,
Greetings from Syncfusion.
We have analyzed your query based on that we suggest you to set labelFormat as ‘n1’. This will round values to one decimal place and using axisLabelRender event we can add ‘l/min’ to the label.
We have attached code-snippet, sample and screenshot for your reference.
Code-snippet:
|
public primaryYAxis: Object = { labelFormat: 'n1' }; public axisLabelRender(args): void { if(args.axis.name === "primaryYAxis") { args.text = args.text + ' l/min'; } }; |
Screenshot:
Sample: https://stackblitz.com/edit/angular-su2b64-eizhbg?file=src%2Fapp.component.ts
Documentation: https://ej2.syncfusion.com/angular/documentation/chart/data-labels#format
Kindly revert us if you have any concerns.
Regards,
Nishanthi
Hello Nishanti,
thank you for your reply, that does indeed sound like the solution to my problem. Would it perhaps be possible to update the documentation? It makes no mention of AxisLabelRender that I have been able to find.
Thank you!
Ewa,
We have logged task for the request to add documentation for the axisLabelRender event. This will be available in our Volume 1 release in 2024, which is tentatively scheduled to be rolled out at the end of March 2024.
Kindly revert us if you have any concerns.
Regards,
Nishanthi
Ewa,
Thank you for your patience,
We're pleased to inform you that we've added a Knowledge Base (KB) article covering the axisLabelRender event. For your convenience, we've attached the KB document for your reference.
Kindly revert us if you have any concerns.
Regards,
Nishanthi