From c84d328cb6448786aee00f1b0684aaa07186e410 Mon Sep 17 00:00:00 2001 From: whyczyk <525500596@qq.com> Date: 星期四, 04 三月 2021 10:56:56 +0800 Subject: [PATCH] chart字体自适应 --- src/components/charts/abeamProChart.vue | 16 +++++++++++----- 1 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/components/charts/abeamProChart.vue b/src/components/charts/abeamProChart.vue index 3f920db..fdaf635 100644 --- a/src/components/charts/abeamProChart.vue +++ b/src/components/charts/abeamProChart.vue @@ -8,8 +8,10 @@ <script> import * as echarts from 'echarts'; - //寮曞叆鎻愮ず妗� - import "echarts/lib/component/tooltip"; + //寮曞叆chart瀛椾綋鑷�傚簲 + import { + chartFontsize + } from '@/assets/js/chartFontsize' export default { name: "abeamProChart", chart: "", @@ -31,6 +33,7 @@ this.$options.chart.setOption(opt); }, setData(sendData) { + this.$options.chartData = sendData; let dataColor = sendData.color; let bgColor = sendData.bgColor; let yData = sendData.yData; @@ -69,7 +72,8 @@ axisLabel: { show: true, textStyle: { - color: '#fff' + color: '#fff', + fontSize: chartFontsize(12), }, }, splitLine: { @@ -88,7 +92,8 @@ axisLabel: { show: true, textStyle: { - color: '#fff' + color: '#fff', + fontSize: chartFontsize(12), }, }, splitLine: { @@ -130,7 +135,7 @@ normal: { show: true, position: 'insideRight', - fontSize: 20, + fontSize: chartFontsize(20), color: '#021750' } }, @@ -167,6 +172,7 @@ }, resize() { this.$options.chart.resize(); + this.setData(this.$options.chartData); } }, mounted() { -- Gitblit v1.9.1