最近发现的问题 chart.js x 坐标配置为 time 后 值不显示的问题
图表类型为 line 可以显示 , 改成 bar 即不行了
let data = [
9656226.35,
9656226.35,
10465119.373,
10465119.373,
];
let labels =[
1693526400000,
1693528200000,
1696118400000,
1696120200000,
];
let options = {
scales: {
x: {
type: 'time'
/* type: 'time',
time: {
unit: 'day'
} */
},
y0: {
ticks: {
min: 0
}
},
},
};
let chartData = {
labels: labels,
datasets: [{
data: data,
label: 'Amount of Stuff',
backgroundColor: '#035e7b',
}]
};
let ctx = document.getElementById('mychart').getContext('2d');
new Chart(ctx, {
data: chartData,
"type": "line",
options: options,
});