From dca26bac2c05fcfc9c7ed477b32a7fab1295a688 Mon Sep 17 00:00:00 2001
From: riku <risaku@163.com>
Date: 星期二, 21 十月 2025 17:48:10 +0800
Subject: [PATCH] 2025.10.21 修改嫉妒报告生成逻辑
---
src/components/chart/RealTimeLineChart.vue | 47 +++++++++++++++++++++++++++++++++++------------
1 files changed, 35 insertions(+), 12 deletions(-)
diff --git a/src/components/chart/RealTimeLineChart.vue b/src/components/chart/RealTimeLineChart.vue
index fa8da32..5ed46c8 100644
--- a/src/components/chart/RealTimeLineChart.vue
+++ b/src/components/chart/RealTimeLineChart.vue
@@ -1,11 +1,15 @@
<template>
<div class="chart-wrap">
- <div ref="lineChart" class="line-chart"></div>
+ <div
+ ref="lineChart"
+ class="line-chart"
+ :style="'height:' + chartHeight + ';'"
+ ></div>
</div>
</template>
<script>
import * as echarts from 'echarts';
-import { smallLineOption } from '@/utils/chart/chart-option';
+import { smallLineOption, baseVisualMap } from '@/utils/chart/chart-option';
export default {
props: {
@@ -17,7 +21,21 @@
// series: []
// };
// }
- }
+ },
+ // 鎶樼嚎鍥惧睍绀洪珮搴�
+ chartHeight: {
+ type: String,
+ default: '140px'
+ },
+ // 鎶樼嚎鍥綴杞村埢搴﹂棿璺�
+ yMinInterval: {
+ type: Number,
+ default: 1
+ },
+ // 寮傚父鏁版嵁绱㈠紩鑼冨洿闆嗗悎锛孾[i1,i2], [i3,i4],...]
+ exceptionIndexArr: Array,
+ // 鑷畾涔塝杞磋寖鍥�
+ customRange: Boolean
},
data() {
return {
@@ -37,14 +55,18 @@
refreshChart() {
const { xAxis, series } = this.modelValue;
if (!this.option) {
- this.option = smallLineOption(xAxis, series);
+ this.option = smallLineOption(xAxis, series, this.yMinInterval);
+ if (this.exceptionIndexArr) {
+ const visualMap = baseVisualMap(this.exceptionIndexArr);
+ this.option.visualMap = visualMap;
+ }
} else {
this.option.xAxis[0].data = xAxis;
this.option.series = series;
}
if (this.lineChart) {
this.lineChart.setOption(this.option, { notMerge: true });
- console.log('鎶樼嚎鍥剧敓鎴愶細绔嬪嵆');
+ // console.log('鎶樼嚎鍥剧敓鎴愶細绔嬪嵆');
} else {
this.onChartCreated = () => {
this.lineChart.setOption(this.option, { notMerge: true });
@@ -54,12 +76,13 @@
},
mounted() {
this.lineChart = echarts.init(this.$refs.lineChart);
- setTimeout(() => {
- if (typeof this.onChartCreated === 'function') {
- this.onChartCreated();
- console.log('鎶樼嚎鍥剧敓鎴愶細婊炲悗');
- }
- }, 500);
+ this.onChartCreated();
+ // setTimeout(() => {
+ // if (typeof this.onChartCreated === 'function') {
+ // this.onChartCreated();
+ // // console.log('鎶樼嚎鍥剧敓鎴愶細婊炲悗');
+ // }
+ // }, 500);
}
};
</script>
@@ -71,7 +94,7 @@
}
.line-chart {
width: 318px;
- height: 140px;
+ /* height: 140px; */
/* border-bottom: 1px solid rgba(255, 255, 255, 0.329); */
}
</style>
--
Gitblit v1.9.3