- Home
- Forum
- ASP.NET MVC
- Sum of labels in Stacking Chart
Sum of labels in Stacking Chart
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
SIGN IN To post a reply.
4 Replies
SK
Saravana Kumar Kanagavel
Syncfusion Team
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
Regards,
Saravana Kumar K
AS
Alicia Serrano
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
AS
Alicia Serrano
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
SK
Saravana Kumar Kanagavel
Syncfusion Team
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.
SIGN IN To post a reply.
- 4 Replies
- 2 Participants
-
AS Alicia Serrano
- May 31, 2016 03:06 PM UTC
- Jun 1, 2016 12:04 PM UTC