1
我正在制作混合图表,我需要在条形图上绘制阶梯线图。在我的线型图的数据点都在栏的中间默认情况下是这样排列的:在混合图表中对齐线条和条纹
我想使该行的开始与小节的开始,像这样排列:
我已经通过Chartjs的文档,但我无法找到一种方法,使我的酒吧开始行开始。
我安装一个小例子来说明我的问题远一点:
var opc = $("#chart");
var myChart = new Chart(opc, {
type: 'bar',
data: {
labels: ['Item 1', 'Item 2', 'Item 3'],
datasets: [{
type: 'bar',
label: 'Bar Component',
data: [10, 20, 30],
}, {
type: 'line',
steppedLine: true,
label: 'Line Component',
data: [25, 5, 20],
fill: false
}]
},
options: {
scales: {
yAxes: [{
display: true,
ticks: {
suggestedMin: 0, // minimum will be 0, unless there is a lower value.
// OR //
beginAtZero: true // minimum value will be 0.
}
}]
}
}
});
这里是链接到工作小提琴:https://jsfiddle.net/7yheenc6/1/