From 640034fb4f659cbcecbd23df75016d97231ad7bd Mon Sep 17 00:00:00 2001 From: whychw <858544502@qq.com> Date: 星期五, 20 十一月 2020 08:27:26 +0800 Subject: [PATCH] U 修改参试设备配置 --- src/components/chart/LineChartMul.vue | 9 ++++++++- 1 files changed, 8 insertions(+), 1 deletions(-) diff --git a/src/components/chart/LineChartMul.vue b/src/components/chart/LineChartMul.vue index bb637f4..9c62f07 100644 --- a/src/components/chart/LineChartMul.vue +++ b/src/components/chart/LineChartMul.vue @@ -80,6 +80,11 @@ default: false } ,subTitleWidth: [String, Number] + // 鏍囬锛堝睘鎬э級杩囬暱 鍋氬垏鍒嗘崲琛屽鐞� 姝ゅ鍒囧垎鐗囨柇鐨勯暱搴� 榛樿20 灏戜簬20鐨勪笉浼氬垏鍒� + ,titleSplitLen: { + type: Number, + default: 20 + } }, data() { return { @@ -170,13 +175,14 @@ let yAxis = []; let series = []; let xAxisIndex = []; + const reg = new RegExp('(\\S{' + this.titleSplitLen + '})', 'g'); opt.series.forEach((v, i, a) => { /*let subtext = xLabel.length ? ('鏈�鏂版暟鎹�: ' + xLabel[xLabel.length - 1] + ' ' + v.data[v.data.length - 1] + v.unit) : '';*/ // 鐢熸垚 title title.push({ left: 'left', - text: v.name, + text: v.name.length > this.titleSplitLen ? v.name.replace(reg, '$1\n') : v.name, // subtext: subtext, textStyle: { fontSize: 12 @@ -250,6 +256,7 @@ }]; } + // 缁樺埗鍥捐〃 this.$G.chartManage.get(this.id).setOption(option); // console.log(this.$G.chartManage.get(this.id).getOption(), 'options'); -- Gitblit v1.9.1