2👍
✅
Workaround Answer based of @adeel suggestions:
So from the fiddle below, I used stacking on both y and x-axis, to get the desired effect. The first dataset (just an offset dataset) is used as the basis to stack the second dataset (actual) to get the desired effect.
var ctx = document.getElementById("myChart").getContext("2d");
var data = {
labels: ["January", "February", "March", "April", "May", "June"],
datasets: [{
label: "Offset",
backgroundColor: "transparent",
data: [50,100,70,60,100,100]
},{
label: 'Actual Dataset',
backgroundColor: 'Blue',
borderWidth: 1,
data: [50,20,30,40,30,70]
}]
};
var myBarChart = new Chart(ctx, {
type: 'bar',
data: data,
options: {
scales: {
xAxes: [{
stacked: true
}],
yAxes: [{
stacked: true,
}]
},
}
});
5👍
Just add
ticks: {
min:100
}
in your options under the y-axis scales your option should look like this.
options: {
scales: {
yAxes:[{
ticks: {
min:10
}
}],
},
responsive: true,
legend: {
position: 'top',
},
title: {
display: true,
text: 'Chart.js Bar Chart'
}
}
P.s: check the indentation because i was not using the editor.
Edit May be you have stacked in this case removed the stack type. See this fiddle
Source:stackexchange.com