JavaScript
var chart = new CanvasJS.Chart("chartContainer",{
title:{
text: "Grouped Stacked Chart"
},
legend: {
cursor: "pointer",
itemclick: toggleDataSeries,
horizontalAlign: "right",
verticalAlign: "center"
},
theme: "light1",
axisY: {
// maximum: 15
},
axisY2: {
// maximum: 15,
lineThickness: 0,
tickLength: 0,
labelFormatter: function(e){
return "";
}
},
data: [
{
type: "stackedColumn",
showInLegend: true,
legendText: "Millions-1",
dataPoints: [
{ x: 1, y: 60000000, label:"Apple" },
{ x: 2, y: 70000000, label:"Mango" },
{ x: 3, y: 90000000, label:"Orange" },
{ x: 4, y: 70000000, label:"Banana" },
{ x: 5, y: 70000000, label:"Pineapple" },
{ x: 6, y: 50000000, label:"Pears" }
]
},
{
type: "stackedColumn",
showInLegend: true,
legendText: "Thousand-1",
dataPoints: [
{ x: 1, y: 10000, label:"Apple" },
{ x: 2, y: 40000, label:"Mango" },
{ x: 3, y: 70000, label:"Orange" },
{ x: 4, y: 50000, label:"Banana" },
{ x: 5, y: 20000, label:"Pineapple" },
{ x: 6, y: 70000, label:"Pears" }
]
},
{
type: "stackedColumn",
axisYType: "secondary",
showInLegend: true,
legendText: "Millions-2",
dataPoints: [
{ x: 1, y: 90000000, label:"Apple" },
{ x: 2, y: 80000000, label:"Mango" },
{ x: 3, y: 80000000, label:"Orange" },
{ x: 4, y: 80000000, label:"Banana" },
{ x: 5, y: 70000000, label:"Pineapple" },
{ x: 6, y: 60000000, label:"Pears" }
]
},
{
type: "stackedColumn",
axisYType: "secondary",
showInLegend: true,
legendText: "Thousand-2",
dataPoints: [
{ x: 1, y: 35000, label:"Apple" },
{ x: 2, y: 18000, label:"Mango" },
{ x: 3, y: 20000, label:"Orange" },
{ x: 4, y: 30000,...