Chartjs - Stacked Bar Chart Blocking Other Values
My problem is that chart js is rendering the bar chart based on the order defined on the dataset. As you can see below, the values at index 0 of the arrays are 2500 and 1000. Since
Solution 1:
As Per the example of Chartjs for Stacked bar chart stacked: true
for both xAxes
and Axes
varbarData= {
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]
}]
};varcontext=document.getElementById('clients').getContext('2d');varclientsChart=newChart(context, {
type :'bar',
data :barData,
options : {
scales : {
xAxes : [{
stacked :true,
}],
yAxes : [{
stacked :true
}]
}
}
});
This may help you. Fiddle
Post a Comment for "Chartjs - Stacked Bar Chart Blocking Other Values"