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.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Sum of labels in Stacking Chart

Thread ID:

Created:

Updated:

Platform:

Replies:

124318 May 31,2016 03:06 PM UTC Jun 1,2016 12:04 PM UTC ASP.NET MVC 4
loading
Tags: Chart
Alicia Serrano
Asked On May 31, 2016 03:06 PM UTC


I am using Stacking Chart to represent a set of values in different period of time. Each column is a set of stacked values.

What I would like to have is a label on the top of each column with the sum of values in the stacked column.

How could I do it? Is there any settings to handle this behaviour

Thanks in advance

Best regards,
Alicia Serrano

Saravana Kumar Kanagavel [Syncfusion]
Replied On June 1, 2016 05:46 AM UTC

Hi Alicia, 
 
Thanks for contacting Syncfusion Support. 
We have analyzed your query and created sample based on your requirement .This can be achieved by using “DisplayTextRendering” event. 
 
Please follow the code example below 
 
[CSHTML] 
@(Html.EJ().Chart("container") 
   .DisplayTextRendering("sumofLabels") 
) 
 
[JS] 
function sumofLabels(sender)   //Display text rendering event triggered 
    { 
            var value=0; 
            for (var i = 0; i < sender.model.series.length; i++) 
            { 
                
                value += sender.model.series[i].points[sender.data.pointIndex].y; 
            } 
            sender.data.text = "Sum:"+ value;                   
    } 
 
In the above code, we are triggering “DisplayTextRendering” event. In the event, we have added the point of Y-values for each column series and that sum of value is assigned to the data label text. 
 
We have also made a sample for your reference and attached in the below location. 
 
  
Please find the output of the sample below 
 
 
Please let us know if you have any concern.

Regards,
Saravana Kumar K 
 


Alicia Serrano
Replied On June 1, 2016 07:01 AM UTC

Hi Saravana,

Thank you very much for your answer. That is exactly what I want.

Regards,
Alicia Serrano

Alicia Serrano
Replied On June 1, 2016 09:13 AM UTC

Hi Saravana

I found a new problem. When you have in the last set of points, some of them with value '0', the label is going to the bottom. Then,... to set the visibility of Marker is not that easy. It could set the visibility of each point to false or true depend on value of next point in next serie. But.... is too messy, don't think so?

Is there other way to do it??

Regards,
Alicia Serrano

Saravana Kumar Kanagavel [Syncfusion]
Replied On June 1, 2016 12:04 PM UTC

Hi Alicia, 
 
Sorry for inconvenience caused.  
We have analyzed your query and consider this is an issue. So we have logged an issue report for this and working on it. For more details regarding this, kindly follow up the incident which we have created under your account. 
 
Please let us know if you have concern. 
 
Regards, 
Saravana Kumar K. 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;