Only integer values on Y Axis

Hi, my chart is generating decimals values on y axis. Its possible to generate only integer values without using the desiredIntervals​ or interval options?


See an example here: https://stackblitz.com/edit/stackblitz-starters-oe3u7d?file=src%2Fmain.ts



1 Reply 1 reply marked as answer

NP Nishanthi Panner Selvam Syncfusion Team December 13, 2023 09:15 AM UTC

Dylan,


Greetings from Syncfusion.


We have analyzed your query and based on that, we suggest that you use the axisLabelRender event. Through this event we can render only integer values.


We have modified your shared sample for your reference.


Code-snippet:


public axisLabelRender(args: any): void {

        if(args.axis.name === 'primaryYAxis') {

        if (Number(args.text) % 1 !== 0) {

            args.cancel = true;

        }

    }

};


Screenshot:



Sample: https://stackblitz.com/edit/stackblitz-starters-vexh5l?file=src%2Fmain.ts


Kindly revert us if you have any concerns.


Regards,

Nishanthi


Marked as answer
Loader.
Up arrow icon