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

How to show column total in stacked column chart

Hi,


I was wondering if there is some way of display the total of the column on a stacked column chart?

Something like this:



3 Replies 1 reply marked as answer

SB Swetha Babu Syncfusion Team February 1, 2023 12:41 PM UTC

Hi Valeria,


Greetings from Syncfusion.


We can get the total value of the stacking column by using the stackedValues property in the series argument of the pointRender event and render the values in the data label by using the text argument in the textRender event of the chart. We have created an application to demonstrate the same. Please find the below stackblitz link for your reference.


Sample link: https://stackblitz.com/edit/angular-yyxyyi?file=src%2Fapp.component.html


Code Snippet:


<ejs-chart (pointRender)="getEndPoint($event)" (textRender)="changeText($event)">           

    </ejs-chart>

 

public getEndPoint(args: IPointRenderEventArgs): void {

        if (args.series.name === "Honda") {

            this.values = args.series.stackedValues.endValues;

        }

    };

 

    public changeText(args: ITextRenderEventArgs): void {

        args.text = (this.values[this.count]).toString();

        this.count++;

        if (this.count > 12) {

            this.count = 0;

        }

    }


Screenshot:



Kindly, revert us if you have any concerns.


Regards,

Swetha


Marked as answer

VD Valeria de la Torre February 21, 2023 11:49 PM UTC

Thank you so much, this work perfectly!!



SB Swetha Babu Syncfusion Team February 23, 2023 04:15 AM UTC

Valeria,


Most Welcome! Please get back to us if you need further assistance.


Loader.
Live Chat Icon For mobile
Up arrow icon