From 286c96cd573c60d1af5d6d332df1825b4c600289 Mon Sep 17 00:00:00 2001 From: WX <1377869194@qq.com> Date: 星期一, 18 九月 2023 10:56:15 +0800 Subject: [PATCH] 图表样式 --- src/components/BarGraph.vue | 32 ++++++++++++-------------------- src/views/plotting/plottingInquire.vue | 8 +++++--- src/components/BarGraphAxisLine.vue | 12 +++++------- 3 files changed, 22 insertions(+), 30 deletions(-) diff --git a/src/components/BarGraph.vue b/src/components/BarGraph.vue index 72e0d0b..e6919f3 100644 --- a/src/components/BarGraph.vue +++ b/src/components/BarGraph.vue @@ -2,10 +2,7 @@ <div class="title"> {{ layerData.layerName }} </div> - <div - :id="`myEcharts${chartsId}`" - :style="{ width: width, height: height }" - ></div> + <div id="myEcharts" :style="{ width: width, height: height }"></div> </template> <script lang="ts" setup> import { @@ -27,7 +24,6 @@ width: String, height: String, layerData: Object, - chartsId: String, }); let myEcharts = echarts; let seriesData = ref([]); @@ -51,13 +47,11 @@ type: "line", smooth: true, symbol: "none", //鍙栨秷鎶樼偣鍦嗗湀 - itemStyle: { - normal: { - label: { - show: false, - position: "top", - formatter: "{c}", - }, + label: { + label: { + show: false, + position: "top", + formatter: "{c}", }, }, }); @@ -84,13 +78,11 @@ type: "line", smooth: true, symbol: "none", //鍙栨秷鎶樼偣鍦嗗湀 - itemStyle: { - normal: { - label: { - show: false, - position: "top", - formatter: "{c}", - }, + label: { + label: { + show: false, + position: "top", + formatter: "{c}", }, }, }); @@ -118,7 +110,7 @@ } function initChart() { let chart = myEcharts.init( - document.getElementById(`myEcharts${props.chartsId}`), + document.getElementById(`myEcharts`), "purple-passion" ); chart.setOption({ diff --git a/src/components/BarGraphAxisLine.vue b/src/components/BarGraphAxisLine.vue index 7e582b2..04e42c2 100644 --- a/src/components/BarGraphAxisLine.vue +++ b/src/components/BarGraphAxisLine.vue @@ -41,13 +41,11 @@ type: "line", smooth: true, symbol: "none", //鍙栨秷鎶樼偣鍦嗗湀 - itemStyle: { - normal: { - label: { - show: false, - position: "top", - formatter: "{c}", - }, + label: { + label: { + show: false, + position: "top", + formatter: "{c}", }, }, }); diff --git a/src/views/plotting/plottingInquire.vue b/src/views/plotting/plottingInquire.vue index ce948db..65c8b01 100644 --- a/src/views/plotting/plottingInquire.vue +++ b/src/views/plotting/plottingInquire.vue @@ -98,7 +98,6 @@ :width="'100%'" :height="'260px'" :layerData="layerData" - :chartsId="0" ></Bar-graph> <div class="select"> <el-select @@ -445,12 +444,15 @@ const selectPolyline = async (res) => { layerArr.value = []; const dt = await selectByPolyline(res); - console.log(dt); + dt.result.forEach((e) => { e.points.forEach((element) => { - element = keepThreeNum(element); + element.vals.forEach((v) => { + v = keepThreeNum(v); + }); }); }); + layeroptions.value = dt.result; layerArr.value.push(dt.result[0]); chartIsshow.value = true; -- Gitblit v1.9.3