From 31e4aa1eb784477a917cd2c601857693be2a872d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BB=B2=E4=B9=88=E4=BA=86?= Date: Mon, 26 Feb 2024 16:12:09 +0800 Subject: [PATCH] =?UTF-8?q?=E7=94=B5=E5=8E=8B=E6=9A=82=E9=99=8D=E8=A1=A8?= =?UTF-8?q?=E5=8F=8A=E5=AF=86=E5=BA=A6=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 1 + pnpm-lock.yaml | 17 + src/components/echarts/MyEchart.vue | 88 ++++- src/main.ts | 1 - .../dianyazanjiangbiaojimidu/index.vue | 310 +++++++++++------- .../online/eventStatistics/index.vue | 2 +- 6 files changed, 288 insertions(+), 131 deletions(-) diff --git a/package.json b/package.json index f72be292..6124def0 100644 --- a/package.json +++ b/package.json @@ -17,6 +17,7 @@ "axios": "^1.6.2", "crypto-js": "^4.2.0", "echarts": "^5.4.3", + "echarts-gl": "^2.0.9", "echarts4": "npm:echarts@^4.9.0", "element-plus": "^2.5.3", "exceljs": "^4.4.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 5e814934..04cdbc8c 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -25,6 +25,9 @@ dependencies: echarts: specifier: ^5.4.3 version: 5.4.3 + echarts-gl: + specifier: ^2.0.9 + version: 2.0.9(echarts@5.4.3) echarts4: specifier: npm:echarts@^4.9.0 version: /echarts@4.9.0 @@ -1743,6 +1746,10 @@ packages: optionalDependencies: fsevents: 2.3.3 + /claygl@1.3.0: + resolution: {integrity: sha512-+gGtJjT6SSHD2l2yC3MCubW/sCV40tZuSs5opdtn79vFSGUgp/lH139RNEQ6Jy078/L0aV8odCw8RSrUcMfLaQ==} + dev: false + /color-convert@1.9.3: resolution: {integrity: sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==} dependencies: @@ -1876,6 +1883,16 @@ packages: readable-stream: 2.3.8 dev: false + /echarts-gl@2.0.9(echarts@5.4.3): + resolution: {integrity: sha512-oKeMdkkkpJGWOzjgZUsF41DOh6cMsyrGGXimbjK2l6Xeq/dBQu4ShG2w2Dzrs/1bD27b2pLTGSaUzouY191gzA==} + peerDependencies: + echarts: ^5.1.2 + dependencies: + claygl: 1.3.0 + echarts: 5.4.3 + zrender: 5.4.4 + dev: false + /echarts@4.9.0: resolution: {integrity: sha512-+ugizgtJ+KmsJyyDPxaw2Br5FqzuBnyOWwcxPKO6y0gc5caYcfnEUIlNStx02necw8jmKmTafmpHhGo4XDtEIA==} dependencies: diff --git a/src/components/echarts/MyEchart.vue b/src/components/echarts/MyEchart.vue index 833385f7..782e68ed 100644 --- a/src/components/echarts/MyEchart.vue +++ b/src/components/echarts/MyEchart.vue @@ -6,7 +6,7 @@ import { onBeforeUnmount, onMounted, ref, defineExpose, watch } from 'vue' // import echarts from './echarts' import * as echarts from 'echarts' // 全引入 - +import 'echarts-gl'; import 'echarts/lib/component/dataZoom' const chartRef = ref() @@ -24,6 +24,90 @@ const initChart = () => { chart?.dispose() chart = echarts.init(chartRef.value as HTMLDivElement) + console.log({ + title: { + left: 'center', + textStyle: { + color: '#000', + fontSize: 18 + }, + ...(props.options.title || null) + }, + tooltip: { + trigger: 'axis', + + axisPointer: { + type: 'shadow', + label: { + color: '#fff', + fontSize: 16 + } + }, + textStyle: { + color: '#fff', + fontStyle: 'normal', + opacity: 0.35, + fontSize: 14 + }, + backgroundColor: 'rgba(0,0,0,0.35)', + borderWidth: 0, + ...(props.options.tooltip || null) + }, + legend: { + right: 20, + top: 0, + itemGap: 10, + itemStyle: {}, + textStyle: { + fontSize: 12, + padding: [2, 0, 0, 0] //[上、右、下、左] + }, + itemWidth: 15, + itemHeight: 10, + ...(props.options.legend || null) + }, + grid: { + top: '50px', + left: '10px', + right: '60px', + bottom: props.options.options?.dataZoom === null ? '10px' : '40px', + containLabel: true + }, + xAxis: handlerXAxis(), + yAxis: handlerYAxis(), + dataZoom: [ + { + type: 'inside', + height: 13, + start: 0, + bottom: '20px', + end: 100, + ...(props.options.dataZoom || null) + }, + { + start: 0, + height: 13, + bottom: '20px', + end: 100, + ...(props.options.dataZoom || null) + } + ], + color: [ + ...(props.options.color || ''), + '#07CCCA ', + '#00BFF5', + '#FFBF00', + '#77DA63', + '#D5FF6B', + '#Ff6600', + '#FF9100', + '#5B6E96', + '#66FFCC', + '#B3B3B3' + ], + series: props.options.series, + ...props.options.options + }) chart.setOption({ title: { left: 'center', @@ -66,7 +150,6 @@ const initChart = () => { itemHeight: 10, ...(props.options.legend || null) }, - grid: { top: '50px', left: '10px', @@ -106,6 +189,7 @@ const initChart = () => { '#66FFCC', '#B3B3B3' ], + series: props.options.series, ...props.options.options }) setTimeout(() => { diff --git a/src/main.ts b/src/main.ts index 0b7b5cb2..d552c70f 100644 --- a/src/main.ts +++ b/src/main.ts @@ -17,7 +17,6 @@ import { ElDialog } from 'element-plus' import BaiduMap from 'vue-baidu-map-3x' import ExcelJS from 'exceljs' import VXETablePluginExportXLSX from 'vxe-table-plugin-export-xlsx' - // 方式1:NPM 安装,注入 ExcelJS 对象 VXETable.use(VXETablePluginExportXLSX, { ExcelJS diff --git a/src/views/pms/voltageSags/monitoringPoint/online/eventStatistics/dianyazanjiangbiaojimidu/index.vue b/src/views/pms/voltageSags/monitoringPoint/online/eventStatistics/dianyazanjiangbiaojimidu/index.vue index d32ce2cf..9335cbc1 100644 --- a/src/views/pms/voltageSags/monitoringPoint/online/eventStatistics/dianyazanjiangbiaojimidu/index.vue +++ b/src/views/pms/voltageSags/monitoringPoint/online/eventStatistics/dianyazanjiangbiaojimidu/index.vue @@ -1,5 +1,5 @@