3๐
โ
As Per the example of Chartjs for Stacked bar chart stacked: true
for both xAxes
and Axes
var barData = {
labels : ['Italy', 'UK', 'USA', 'Germany', 'France', 'Japan'],
datasets : [{
label : '2010 customers #',
backgroundColor : '#382765',
data : [2500, 1902, 1041, 610, 1245, 952]
}, {
label : '2014 customers #',
backgroundColor : '#7BC225',
data : [1000, 1689, 1318, 589, 1199, 1436]
}]
};
var context = document.getElementById('clients').getContext('2d');
var clientsChart = new Chart(context, {
type : 'bar',
data : barData,
options : {
scales : {
xAxes : [{
stacked : true,
}],
yAxes : [{
stacked : true
}]
}
}
});
This may help you. Fiddle
Source:stackexchange.com