This commit is contained in:
HuangHai
2026-01-21 09:59:09 +08:00
parent 2fda6f0dcf
commit 0f4435b51c
9 changed files with 158 additions and 79 deletions

View File

@@ -194,12 +194,37 @@ createApp({
textStyle: { color: "#94a3b8" },
top: 10
},
grid: { left: 50, right: 30, top: 60, bottom: 40 },
grid: { left: 50, right: 30, top: 60, bottom: 60 },
xAxis: {
type: "category",
data: data.dates.map(d => d.split('-').slice(1).join('/')), // Show MM/DD
axisLine: { lineStyle: { color: "#475569" } },
axisLabel: { color: "#94a3b8" }
type: 'category',
data: data.dates,
axisLabel: {
show: true,
color: '#94a3b8',
interval: function(index, value) {
// 强制显示 00:00, 06:00, 12:00, 18:00
if (value && value.includes(' ')) {
const time = value.split(' ')[1];
return time === '00:00' || time === '06:00' || time === '12:00' || time === '18:00';
}
return index % 6 === 0; // 每6个点显示一个(对应 6 小时)
},
formatter: function(value) {
if (!value) return '';
const parts = value.split(' ');
if (parts.length === 2) {
const time = parts[1];
// 如果是零点,显示日期和时间
if (time === '00:00') {
return parts[0] + '\n' + time;
}
return time;
}
return value;
}
},
axisLine: { lineStyle: { color: '#334155' } },
axisTick: { show: true, lineStyle: { color: '#334155' } }
},
yAxis: {
type: "value",