今天过得愉快, 我希望黄线从垂直线绘制到垂直线(y轴)。 这样黄线不会在列的中间开始。
https://imgur.com/a/nOO9pNx“情况图片”
var barChartData = {
labels: [{!$resSum['sektornazev']}],
datasets: [{
label: 'Tolerované',
backgroundColor: 'blue',
stack: 'Stack 0',
data: [{!$resSum['pocNO']}]
}, {
label: 'Archiv',
backgroundColor: 'green',
stack: 'Stack 0',
data: [{!$resSum['pocNU']}]
}, {
label: 'Netolerované',
backgroundColor: 'red',
stack: 'Stack 0',
data: [{!$resSum['pocND']}]
},{
label: 'Cíl',
backgroundColor: 'yellow',
type: 'line',
fill: 'end',
steppedLine: 'after',
stack: 'Stack 1',
data: [{!$resSum['graflimit']}]
}]
};
window.onload = function() {
var ctx = document.getElementById('chartM').getContext('2d');
window.myBar = new Chart(ctx, {
type: 'bar',
data: barChartData,
options: {
title: {
display: true,
text: 'Přehled všech akcí za období {!$obdobi['mesicName']} {!$obdobi['rok']}'
},
tooltips: {
mode: 'index',
intersect: false
},
responsive: true,
scales: {
xAxes: [{
stacked: true
}],
yAxes: [{
stacked: true,
ticks: {
stepSize: 1
}
}]
}
}
});
};
所需的结果显示在“最终”部分的所附图像中。