jQWidgets Forums
jQuery UI Widgets › Forums › Chart › Show sum in Chart with multiple series
Tagged: Angular chart, chart, jquery chart, jqxChart, stackedcolumn, sum
This topic contains 5 replies, has 3 voices, and was last updated by kantorg 9 years, 5 months ago.
-
Author
-
Hi
I have a stackedcolumn chart with 4 series.
I can see the direct value if I hover one, but how to show the sum of all in one column?Thanks!
Hello Commifreak,
Unfortunately, it is not possible to show the sum of all values in a stacked column.
Best Regards,
DimitarjqWidgets team
http://www.jqwidgets.com/Thanks for your reply.
But this could be a nice feature for future versions
Thanks for your help!
Hi Dimitar!
3 years past, is it still not possible??
Thanks in advance!
Hi kantorg,
Here is the solution we can offer you at the moment:
<!DOCTYPE html> <html lang="en"> <head> <link rel="stylesheet" href="../../jqwidgets/styles/jqx.base.css" type="text/css" /> <script type="text/javascript" src="../../../scripts/jquery-1.11.1.min.js"></script> <script type="text/javascript" src="../../../jqwidgets/jqxcore.js"></script> <script type="text/javascript" src="../../../jqwidgets/jqxdata.js"></script> <script type="text/javascript" src="../../../jqwidgets/jqxdraw.js"></script> <script type="text/javascript" src="../../../jqwidgets/jqxchart.core.js"></script> <script type="text/javascript"> $(document).ready(function () { // prepare chart data as an array var sampleData = [ { Day: 'Monday', Running: 30, Swimming: 0, Cycling: 25 }, { Day: 'Tuesday', Running: 25, Swimming: 25, Cycling: 0 }, { Day: 'Wednesday', Running: 30, Swimming: 0, Cycling: 25 }, { Day: 'Thursday', Running: 35, Swimming: 25, Cycling: 45 }, { Day: 'Friday', Running: 0, Swimming: 20, Cycling: 25 }, { Day: 'Saturday', Running: 30, Swimming: 0, Cycling: 30 }, { Day: 'Sunday', Running: 60, Swimming: 45, Cycling: 0 } ]; // prepare jqxChart settings var settings = { title: "Fitness & exercise weekly scorecard", description: "Time spent in vigorous exercise by activity", enableAnimations: true, showLegend: true, padding: { left: 5, top: 5, right: 5, bottom: 5 }, titlePadding: { left: 90, top: 0, right: 0, bottom: 10 }, source: sampleData, xAxis: { dataField: 'Day', unitInterval: 1, axisSize: 'auto', tickMarks: { visible: true, interval: 1, color: '#BCBCBC' }, gridLines: { visible: true, interval: 1, color: '#BCBCBC' }, labels: { visible: true, formatFunction: function (value, index) { var currentDayData = sampleData[index], total = currentDayData.Running + currentDayData.Swimming + currentDayData.Cycling; return value + '<br> (Total: ' + total + ')'; } } }, valueAxis: { unitInterval: 10, minValue: 0, maxValue: 120, title: { text: 'Time in minutes' }, labels: { horizontalAlignment: 'right' }, tickMarks: { color: '#BCBCBC' } }, colorScheme: 'scheme06', seriesGroups: [ { type: 'stackedcolumn', columnsGapPercent: 50, seriesGapPercent: 0, series: [ { dataField: 'Running', displayText: 'Running' }, { dataField: 'Swimming', displayText: 'Swimming' }, { dataField: 'Cycling', displayText: 'Cycling' } ] } ] }; // setup the chart $('#chartContainer').jqxChart(settings); }); </script> </head> <body class='default'> <div id='chartContainer' style="width: 850px; height: 500px;" /> </body> </html>
Best Regards,
DimitarjQWidgets team
http://www.jqwidgets.com/Hey Dimitar,
Thank you, excellent job!
Kind regards,
kantorg -
AuthorPosts
You must be logged in to reply to this topic.