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/triangleBarChart.vue | 15 ++++++++++----- 1 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/components/charts/triangleBarChart.vue b/src/components/charts/triangleBarChart.vue index 5fdb2f4..f230114 100644 --- a/src/components/charts/triangleBarChart.vue +++ b/src/components/charts/triangleBarChart.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: "triangleBarChart", chart: "", @@ -31,6 +33,7 @@ this.$options.chart.setOption(opt); }, setData(sendData) { + this.$options.chartData = sendData; let inData = [] sendData.data.map(item => { inData.push(item - 10); @@ -70,7 +73,7 @@ }, axisLabel: { color: '#FFFFFF', - fontSize: 12, + fontSize: chartFontsize(12), interval: 0 } }, { @@ -87,7 +90,7 @@ }, axisLabel: { color: '#FFFFFF', - fontSize: 12, + fontSize: chartFontsize(12), interval: 0 } }], @@ -108,7 +111,8 @@ }, axisLabel: { textStyle: { - color: '#FFFFFF' + color: '#FFFFFF', + fontSize: chartFontsize(12) }, }, }], @@ -165,6 +169,7 @@ }, resize() { this.$options.chart.resize(); + this.setData(this.$options.chartData); } }, mounted() { -- Gitblit v1.9.1