Unverified 提交 38db8944 authored 作者: fit2cloud-chenyw's avatar fit2cloud-chenyw 提交者: GitHub

Merge pull request #1630 from dataease/pr@v1.6@fix_map_zoom

fix: 地图复位中心点错误
...@@ -26,7 +26,7 @@ export function baseMapOption(chart_option, chart) { ...@@ -26,7 +26,7 @@ export function baseMapOption(chart_option, chart) {
// 处理data // 处理data
if (chart.data) { if (chart.data) {
chart_option.title.text = chart.title chart_option.title.text = chart.title
if (chart.data.series.length > 0) { if (chart.data.series && chart.data.series.length > 0) {
chart_option.series[0].name = chart.data.series[0].name chart_option.series[0].name = chart.data.series[0].name
// label // label
if (customAttr.label) { if (customAttr.label) {
......
...@@ -74,7 +74,7 @@ import { ...@@ -74,7 +74,7 @@ import {
import { import {
baseMixOption baseMixOption
} from '@/views/chart/chart/mix/mix' } from '@/views/chart/chart/mix/mix'
// import eventBus from '@/components/canvas/utils/eventBus' // import eventBus from '@/components/canvas/utils/eventBus'
import { import {
uuid uuid
} from 'vue-uuid' } from 'vue-uuid'
...@@ -130,7 +130,8 @@ export default { ...@@ -130,7 +130,8 @@ export default {
pointParam: null, pointParam: null,
dynamicAreaCode: null, dynamicAreaCode: null,
borderRadius: '0px' borderRadius: '0px',
mapCenter: null
} }
}, },
...@@ -276,6 +277,11 @@ export default { ...@@ -276,6 +277,11 @@ export default {
const base_json = JSON.parse(JSON.stringify(BASE_MAP)) const base_json = JSON.parse(JSON.stringify(BASE_MAP))
const chart_option = baseMapOption(base_json, chart) const chart_option = baseMapOption(base_json, chart)
this.myEcharts(chart_option) this.myEcharts(chart_option)
const opt = this.myChart.getOption()
if (opt && opt.series) {
const center = opt.series[0].center
this.mapCenter = center
}
}, },
myEcharts(option) { myEcharts(option) {
// 指定图表的配置项和数据 // 指定图表的配置项和数据
...@@ -356,6 +362,7 @@ export default { ...@@ -356,6 +362,7 @@ export default {
resetZoom() { resetZoom() {
const options = JSON.parse(JSON.stringify(this.myChart.getOption())) const options = JSON.parse(JSON.stringify(this.myChart.getOption()))
options.series[0].zoom = 1 options.series[0].zoom = 1
options.series[0].center = this.mapCenter
this.myChart.setOption(options) this.myChart.setOption(options)
} }
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论