优化:告警趋势图从堆叠面积改为独立折线图
去掉 stack + areaStyle,每种告警类型独立一条折线, 都从 Y 轴 0 开始,更直观易读。
This commit is contained in:
@@ -28,7 +28,7 @@ const LEVEL_COLORS: Record<number, string> = {
|
||||
3: '#8c8c8c',
|
||||
};
|
||||
|
||||
/** 告警趋势面积图 */
|
||||
/** 告警趋势折线图(每种类型独立一条线,都从0开始) */
|
||||
export function getTrendChartOptions(data: AiotAlarmApi.TrendItem[]): any {
|
||||
const dates = data.map((d) => d.date.slice(5)); // MM-DD
|
||||
const types = Object.keys(TYPE_NAMES);
|
||||
@@ -36,7 +36,7 @@ export function getTrendChartOptions(data: AiotAlarmApi.TrendItem[]): any {
|
||||
return {
|
||||
tooltip: {
|
||||
trigger: 'axis',
|
||||
axisPointer: { type: 'cross', label: { backgroundColor: '#6a7985' } },
|
||||
axisPointer: { type: 'line' },
|
||||
},
|
||||
legend: {
|
||||
data: types.map((t) => TYPE_NAMES[t]),
|
||||
@@ -53,10 +53,11 @@ export function getTrendChartOptions(data: AiotAlarmApi.TrendItem[]): any {
|
||||
name: TYPE_NAMES[type],
|
||||
type: 'line',
|
||||
smooth: true,
|
||||
stack: 'total',
|
||||
areaStyle: { opacity: 0.25 },
|
||||
symbol: 'circle',
|
||||
symbolSize: 6,
|
||||
emphasis: { focus: 'series' },
|
||||
itemStyle: { color: TYPE_COLORS[type] },
|
||||
lineStyle: { width: 2 },
|
||||
data: data.map((d) => (d[type] as number) || 0),
|
||||
})),
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user