From 5d19d580d2fa8cfcd14b4e9bce7087f0089e5f22 Mon Sep 17 00:00:00 2001 From: hyx Date: Fri, 6 May 2022 16:13:27 +0800 Subject: [PATCH] =?UTF-8?q?CN-525=20=E9=94=99=E8=AF=AF=E6=81=A2=E5=A4=8D?= =?UTF-8?q?=EF=BC=9AY=E8=BD=B4=E6=95=B0=E6=8D=AE=E6=A0=BC=E5=BC=8F?= =?UTF-8?q?=E5=8C=96=E6=81=A2=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/tools.js | 120 +++++++++--------- src/views/charts/charts/chart-echart-mixin.js | 2 + 2 files changed, 62 insertions(+), 60 deletions(-) diff --git a/src/utils/tools.js b/src/utils/tools.js index 2c8ddb4f..21f12bd7 100644 --- a/src/utils/tools.js +++ b/src/utils/tools.js @@ -665,71 +665,71 @@ export function handleEchartFontSize (option) { const echartLegendFontSize = localStorage.getItem(storageKey.echartLegendFontSize) const echartLabelFontSize = localStorage.getItem(storageKey.echartLabelFontSize) let chartOption = option - try { - const newSeries = [] - const chartType = chartOption.series[0].type - chartOption.series.forEach((series) => { - const seriesNew = { - ...series, + const newSeries = [] + const chartType = chartOption.series[0].type + chartOption.series.forEach((series) => { + const seriesNew = { + ...series, + label: { + ...series.label, + fontSize: echartLabelFontSize + }, + markLine: { + ...series.markLine, label: { - ...series.label, fontSize: echartLabelFontSize - }, - markLine: { - ...series.markLine, - label: { - fontSize: echartLabelFontSize - } } } - newSeries.push(seriesNew) - }) - - if (chartType === 'pie') { - chartOption = { - ...chartOption, - legend: { - ...chartOption.legend, - textStyle: { - fontSize: echartLegendFontSize - } - }, - axisLabel: { - ...chartOption.axisLabel, - fontSize: echartLabelFontSize - }, - series: newSeries - } - } else { - chartOption = { - ...chartOption, - legend: { - ...chartOption.legend, - textStyle: { - fontSize: echartLegendFontSize - } - }, - xAxis: { - ...chartOption.xAxis, - axisLabel: { - fontSize: echartLabelFontSize - } - }, - yAxis: { - ...chartOption.yAxis, - axisLabel: { - fontSize: echartLabelFontSize - } - }, - axisLabel: { - ...chartOption.axisLabel, - fontSize: echartLabelFontSize - }, - series: newSeries - } } - } catch (e) { - console.error(e) + newSeries.push(seriesNew) + }) + + if (chartType === 'pie') { + chartOption = { + ...chartOption, + legend: { + ...chartOption.legend, + textStyle: { + ...chartOption.legend.textStyle, + fontSize: echartLegendFontSize + } + }, + axisLabel: { + ...chartOption.axisLabel, + fontSize: echartLabelFontSize + }, + series: newSeries + } + } else { + chartOption = { + ...chartOption, + legend: { + ...chartOption.legend, + textStyle: { + ...chartOption.legend.textStyle, + fontSize: echartLegendFontSize + } + }, + xAxis: { + ...chartOption.xAxis, + axisLabel: { + ...chartOption.xAxis.axisLabel, + fontSize: echartLabelFontSize + } + }, + yAxis: { + ...chartOption.yAxis, + axisLabel: { + ...chartOption.yAxis.axisLabel, + fontSize: echartLabelFontSize + } + }, + axisLabel: { + ...chartOption.axisLabel, + fontSize: echartLabelFontSize + }, + series: newSeries + } } return chartOption } diff --git a/src/views/charts/charts/chart-echart-mixin.js b/src/views/charts/charts/chart-echart-mixin.js index 79b0f859..46f5bb51 100644 --- a/src/views/charts/charts/chart-echart-mixin.js +++ b/src/views/charts/charts/chart-echart-mixin.js @@ -145,12 +145,14 @@ export default { xAxis: { ...chartOption.xAxis, axisLabel: { + ...chartOption.xAxis.axisLabel, fontSize: echartLabelFontSize } }, yAxis: { ...chartOption.yAxis, axisLabel: { + ...chartOption.yAxis.axisLabel, fontSize: echartLabelFontSize } },