From b2162703d9a6aac1e8a59e6ba101ff00cc66e965 Mon Sep 17 00:00:00 2001 From: junjie Date: Tue, 10 Aug 2021 18:27:11 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E8=A7=86=E5=9B=BE=E8=BF=94=E5=9B=9E?= =?UTF-8?q?=E5=AD=97=E6=AE=B5=E6=9E=84=E5=BB=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/views/chart/chart/chart.js | 2 +- frontend/src/views/chart/chart/map/map.js | 18 ++++++++++++------ .../views/chart/components/ChartComponent.vue | 2 +- frontend/src/views/system/map/index.vue | 2 +- 4 files changed, 15 insertions(+), 9 deletions(-) diff --git a/frontend/src/views/chart/chart/chart.js b/frontend/src/views/chart/chart/chart.js index cdce29e33d..3a453fee24 100644 --- a/frontend/src/views/chart/chart/chart.js +++ b/frontend/src/views/chart/chart/chart.js @@ -625,7 +625,7 @@ export const BASE_MAP = { { name: '', type: 'map', - map: 'HK', + map: 'MAP', roam: true, // label: { // show: true diff --git a/frontend/src/views/chart/chart/map/map.js b/frontend/src/views/chart/chart/map/map.js index f6da490cea..a336f534e7 100644 --- a/frontend/src/views/chart/chart/map/map.js +++ b/frontend/src/views/chart/chart/map/map.js @@ -33,16 +33,22 @@ export function baseMapOption(chart_option, chart) { } // visualMap const valueArr = chart.data.series[0].data - chart_option.visualMap.min = Math.min(...valueArr) - chart_option.visualMap.max = Math.max(...valueArr) + const values = [] + valueArr.forEach(function(ele) { + values.push(ele.value) + }) + chart_option.visualMap.min = Math.min(...values) + chart_option.visualMap.max = Math.max(...values) if (customAttr.color && customAttr.color.colors) { chart_option.visualMap.inRange.color = customAttr.color.colors } for (let i = 0; i < valueArr.length; i++) { - const y = { - name: chart.data.x[i], - value: valueArr[i] - } + // const y = { + // name: chart.data.x[i], + // value: valueArr[i] + // } + const y = valueArr[i] + y.name = chart.data.x[i] // color // y.itemStyle = { // color: hexColorToRGBA(customAttr.color.colors[i % 9], customAttr.color.alpha), diff --git a/frontend/src/views/chart/components/ChartComponent.vue b/frontend/src/views/chart/components/ChartComponent.vue index f8fe08573e..7e46dc6e99 100644 --- a/frontend/src/views/chart/components/ChartComponent.vue +++ b/frontend/src/views/chart/components/ChartComponent.vue @@ -152,7 +152,7 @@ export default { }, initMapChart(geoJson, chart) { // this.$echarts.registerMap('HK', geoJson) - this.$echarts.getMap('HK') || this.$echarts.registerMap('HK', geoJson) + this.$echarts.getMap('MAP') || this.$echarts.registerMap('MAP', geoJson) const base_json = JSON.parse(JSON.stringify(BASE_MAP)) const chart_option = baseMapOption(base_json, chart) this.myEcharts(chart_option) diff --git a/frontend/src/views/system/map/index.vue b/frontend/src/views/system/map/index.vue index b57ec0cf05..4f0377cdd6 100644 --- a/frontend/src/views/system/map/index.vue +++ b/frontend/src/views/system/map/index.vue @@ -37,7 +37,7 @@ export default { series: [ { type: 'map', - map: 'HK', // 自定义扩展图表类型 + map: 'MAP', // 自定义扩展图表类型 roam: true, label: { show: false