You must be logged in to post your query.
Home › Forums › Report Bugs › Stacked bar chart index total not correct with mix of positive & negative valueu
With a mix of positive and negative values in a stacked bar chart… the total index label is wrong… it appears to treat all the negative values as positive producing the wrong total… The problem is in the Other Row…. in the example below
$(function () {
var chart = new CanvasJS.Chart(“chartContainer”, {
title: {
text: “Orders”
},
animationEnabled: true,
axisY2: {
valueFormatString: “$ 0”,
},
toolTip: {
shared: true
},
legend: {
cursor: “pointer”,
verticalAlign: “top”,
itemclick: function (e) {
if (typeof (e.dataSeries.visible) === “undefined” || e.dataSeries.visible) {
e.dataSeries.visible = false;
}
else {
e.dataSeries.visible = true;
}
chart.render();
}
},
subtitles: [
{
text: “Click on Legends to Enable/Disable DataSeries”
}
],
data: [
{
type: “stackedBar”,
showInLegend: true,
name: “Q1”,
axisYType: “secondary”,
color: “#7E8F74”,
dataPoints: [{“y”:0.4,”label”:”Accessory (BCS)”},{“y”:3.8,”label”:”Integrity”},{“y”:0.8,”label”:”NonStop”},{“y”:0.1,”label”:”Pre Integrity”},{“y”:4.4,”label”:”Scale-Up x86″},{“y”:0.6,”label”:”Other”}] },
{
type: “stackedBar”,
showInLegend: true,
name: “Q2”,
axisYType: “secondary”,
color: “#F0E6A7”,
dataPoints: [{“y”:0.2,”label”:”Accessory (BCS)”},{“y”:3,”label”:”Integrity”},{“y”:4.2,”label”:”NonStop”},{“y”:0,”label”:”Pre Integrity”},{“y”:5.1,”label”:”Scale-Up x86″},{“y”:0.5,”label”:”Other”}] },
{
type: “stackedBar”,
showInLegend: true,
name: “Q3”,
axisYType: “secondary”,
color: “#EBB88A”,
dataPoints: [{“y”:0.3,”label”:”Accessory (BCS)”},{“y”:6.6,”label”:”Integrity”},{“y”:4.8,”label”:”NonStop”},{“y”:0,”label”:”Pre Integrity”},{“y”:3.4,”label”:”Scale-Up x86″},{“y”:0,”label”:”Other”}] },
{
type: “stackedBar”,
showInLegend: true,
name: “Q4”,
axisYType: “secondary”,
color: “#EBB83A”,
dataPoints: [{“y”:0.3,”label”:”Accessory (BCS)”},{“y”:4,”label”:”Integrity”},{“y”:6.8,”label”:”NonStop”},{“y”:0.1,”label”:”Pre Integrity”},{“y”:3.4,”label”:”Scale-Up x86″},{“y”:0.1,”label”:”Other”}] },
{
type: “stackedBar”,
showInLegend: true,
name: “Q5”,
axisYType: “secondary”,
color: “#EBB885”,
dataPoints: [{“y”:0.3,”label”:”Accessory (BCS)”},{“y”:4.3,”label”:”Integrity”},{“y”:2.4,”label”:”NonStop”},{“y”:0,”label”:”Pre Integrity”},{“y”:4.1,”label”:”Scale-Up x86″},{“y”:-0.3,”label”:”Other”}] },
{
type: “stackedBar”,
showInLegend: true,
name: “Q6”,
axisYType: “secondary”,
color: “#DB9079”,
indexLabel: “$#total”,
indexLabelPlacement: “outside”,
dataPoints: [{“y”:0.3,”label”:”Accessory (BCS)”},{“y”:5.3,”label”:”Integrity”},{“y”:15.5,”label”:”NonStop”},{“y”:0.1,”label”:”Pre Integrity”},{“y”:4.6,”label”:”Scale-Up x86″},{“y”:-3.3,”label”:”Other”}] }
]
});
chart.render();
});
</script>
Thank you for reporting this. We are looking into the issue and will get back to you at the earliest.
—-
Bivek Singh,
Team CanvasJS
You must be logged in to reply to this topic.