JavaScript
var chart = new CanvasJS.Chart("chartContainer", {
axisX: {
valueFormatString: "DD MMM"
},
toolTip: {
shared: true
},
data: [{
type: "stackedBar100",
xValueFormatString: "DD MMM",
toolTipContent: "{x}<br><b>{name}:</b> {y} (#percent%)",
name: "The Guardian",
showInLegend: true,
dataPoints: [{
x: new Date(2021, 05, 27),
y: 103,
//indexLabel: "The Guardian",
},
{
x: new Date(2021, 05, 28),
y: 34,
//indexLabel: "The Guardian",
},
{
x: new Date(2021, 05, 29),
y: 57,
//indexLabel: "The Guardian",
},
{
x: new Date(2021, 05, 30),
y: 23,
//indexLabel: "The Guardian",
},
{
x: new Date(2021, 06, 01),
y: 73,
//indexLabel: "The Guardian",
},
]
}, {
type: "stackedBar100",
toolTipContent: "<b>{name}:</b> {y} (#percent%)",
name: "Daily Mail",
showInLegend: true,
dataPoints: [{
x: new Date(2021, 05, 27),
y: 64,
//indexLabel: "Daily Mail",
},
{
x: new Date(2021, 05, 28),
y: 57,
//indexLabel: "Daily Mail",
},
{
x: new Date(2021, 05, 29),
y: 48,
//indexLabel: "Daily Mail",
},
{
x: new Date(2021, 05, 30),
y: 82,
//indexLabel: "Daily Mail",
},
{
x: new Date(2021, 06, 01),
y: 24,
//indexLabel: "Daily Mail",
},
]
}, {
type: "stackedBar100",
toolTipContent: "<b>{name}:</b> {y} (#percent%)",
name: "CNBC",
showInLegend: true,
dataPoints: [{
x: new Date(2021, 05, 27),
y: 81,
//indexLabel: "CNBC",
},
{
x: new Date(2021, 05, 28),
y: 27,
//indexLabel: "CNBC",
...