From 2b404c7bb5cf9c34719957ab8afab5765691d2ab Mon Sep 17 00:00:00 2001 From: zhangyu Date: Fri, 8 Oct 2021 14:08:08 +0800 Subject: [PATCH] =?UTF-8?q?NEZ-1036=20=20fix=EF=BC=9Agroup=20chart=20?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E6=8A=98=E5=8F=A0=EF=BC=8C=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E6=97=B6=E5=B1=95=E5=BC=80=E6=A0=B7=E5=BC=8F=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nezha-fronted/src/components/charts/chart-bar-statistics.vue | 5 +++-- nezha-fronted/src/components/charts/chart-list-group.vue | 5 +++-- nezha-fronted/src/components/charts/chart-pie.vue | 4 +++- nezha-fronted/src/components/charts/line-chart-block.vue | 3 ++- nezha-fronted/src/components/page/config/system.vue | 5 +++-- 5 files changed, 14 insertions(+), 8 deletions(-) diff --git a/nezha-fronted/src/components/charts/chart-bar-statistics.vue b/nezha-fronted/src/components/charts/chart-bar-statistics.vue index 834969a3e..83ac7d33e 100644 --- a/nezha-fronted/src/components/charts/chart-bar-statistics.vue +++ b/nezha-fronted/src/components/charts/chart-bar-statistics.vue @@ -98,7 +98,7 @@ import * as echarts from 'echarts' import { getChart, setChart, getMousePoint } from '../common/js/common' import chartConfig from '../page/dashboard/overview/chartConfig' import { randomcolor } from '../common/js/radomcolor/randomcolor' -import {formatScientificNotation} from "@/components/common/js/tools"; +import {chartResizeTool, formatScientificNotation} from "@/components/common/js/tools"; import chartDataList from '@/components/common/mixin/chartDataList' export default { name: 'pieChart', // 饼图 或者 柱状图的统计 @@ -301,7 +301,8 @@ export default { }, resize (chartItem) { if (getChart(this.chartIndex)) { - getChart(this.chartIndex).resize() + const divHeight = this.$refs.legendArea.offsetHeight + getChart(this.chartIndex).resize({ height: (this.data.height * this.stepWidth - divHeight - chartResizeTool.titleHeight - chartResizeTool.chartBlankHeight) }) } }, // 设置数据, filter区分 diff --git a/nezha-fronted/src/components/charts/chart-list-group.vue b/nezha-fronted/src/components/charts/chart-list-group.vue index 4d61a3686..d18f421a4 100644 --- a/nezha-fronted/src/components/charts/chart-list-group.vue +++ b/nezha-fronted/src/components/charts/chart-list-group.vue @@ -1569,8 +1569,9 @@ export default { const that = this setTimeout(function () { const itemHeight = item.height - // 1.元素距离页面顶部的距离 - const mainOffsetTop = ele.offsetTop// offsetTop: 当前元素顶部距离最近父元素顶部的距离,和有没有滚动条没有关系。单位px,只读元素。 + // 1.元素距离页面顶部的距离 + group的高度 + const groupHeight = item.groupId ? document.getElementById('chart-' + item.groupId).offsetTop : 0 + const mainOffsetTop = ele.offsetTop + groupHeight// offsetTop: 当前元素顶部距离最近父元素顶部的距离,和有没有滚动条没有关系。单位px,只读元素。 // 2.元素的高度 const mainHeight = itemHeight// ele.offsetHeight;//itemHeight; // 3.页面滚动的距离 diff --git a/nezha-fronted/src/components/charts/chart-pie.vue b/nezha-fronted/src/components/charts/chart-pie.vue index 55b88d92a..e3831dff4 100644 --- a/nezha-fronted/src/components/charts/chart-pie.vue +++ b/nezha-fronted/src/components/charts/chart-pie.vue @@ -99,6 +99,7 @@ import { getChart, setChart, getMousePoint } from '../common/js/common' import chartConfig from '../page/dashboard/overview/chartConfig' import { randomcolor } from '../common/js/radomcolor/randomcolor' import chartDataList from '@/components/common/mixin/chartDataList' +import {chartResizeTool} from "@/components/common/js/tools"; export default { name: 'pieChart', components: { @@ -296,7 +297,8 @@ export default { }, resize (chartItem) { if (getChart(this.chartIndex)) { - getChart(this.chartIndex).resize() + const divHeight = this.$refs.legendArea.offsetHeight + getChart(this.chartIndex).resize({ height: (this.data.height * this.stepWidth - divHeight - chartResizeTool.titleHeight - chartResizeTool.chartBlankHeight) }) } }, // 设置数据, filter区分 diff --git a/nezha-fronted/src/components/charts/line-chart-block.vue b/nezha-fronted/src/components/charts/line-chart-block.vue index 7bad61f6d..471766df9 100644 --- a/nezha-fronted/src/components/charts/line-chart-block.vue +++ b/nezha-fronted/src/components/charts/line-chart-block.vue @@ -1983,7 +1983,8 @@ export default { }, chartResize () { if (getChart(this.chartIndex)) { - getChart(this.chartIndex).resize() + const divHeight = this.$refs.legendArea.offsetHeight + getChart(this.chartIndex).resize({ height: (this.data.height * this.stepWidth - divHeight - chartResizeTool.titleHeight - chartResizeTool.chartBlankHeight) }) } } }, diff --git a/nezha-fronted/src/components/page/config/system.vue b/nezha-fronted/src/components/page/config/system.vue index 2423c09b8..42f9072f5 100644 --- a/nezha-fronted/src/components/page/config/system.vue +++ b/nezha-fronted/src/components/page/config/system.vue @@ -74,8 +74,9 @@ - - + + +