diff --git a/core/core-frontend/src/views/chart/components/editor/index.vue b/core/core-frontend/src/views/chart/components/editor/index.vue index 24bb5a1f5c..5fc2addb4e 100644 --- a/core/core-frontend/src/views/chart/components/editor/index.vue +++ b/core/core-frontend/src/views/chart/components/editor/index.vue @@ -205,17 +205,17 @@ watch( if (showAxis('area')) { if (!state.worldTree?.length) { getWorldTree().then(res => { - state.worldTree = [res.data] + state.worldTree.splice(0, state.worldTree.length, res.data) state.areaId = view.value?.customAttr?.map?.id }) } else { state.areaId = view.value?.customAttr?.map?.id } areaSelect.value?.blur() - expandKeys.value = [] - areaSelect.value?.setCurrentKey(state.areaId, state.areaId) + expandKeys.value.splice(0) + areaSelect.value?.setCurrentKey(state.areaId) } - state.chartTypeOptions = [getViewConfig(newVal[0])] + state.chartTypeOptions.splice(0, state.chartTypeOptions.length, getViewConfig(newVal[0])) state.useless = newVal[0] }, { immediate: true, deep: false } diff --git a/core/core-frontend/src/views/chart/components/js/panel/charts/map/bubble-map.ts b/core/core-frontend/src/views/chart/components/js/panel/charts/map/bubble-map.ts index 7fe3d46f42..c4a59fb7c8 100644 --- a/core/core-frontend/src/views/chart/components/js/panel/charts/map/bubble-map.ts +++ b/core/core-frontend/src/views/chart/components/js/panel/charts/map/bubble-map.ts @@ -104,7 +104,6 @@ export class BubbleMap extends L7PlotChartView { view.once('loaded', () => { view.addLayer(dotLayer) view.on('fillAreaLayer:click', (ev: MapMouseEvent) => { - console.log(view) const data = ev.feature.properties action({ x: ev.x, @@ -120,14 +119,14 @@ export class BubbleMap extends L7PlotChartView { } private getDotLayer(chart: Chart, data: any[], geoJson: FeatureCollection): IPlotLayer { - const areaMap = data.reduce((obj, value) => { + const areaMap = data?.reduce((obj, value) => { obj[value['field']] = value.value return obj }, {}) const dotData = [] geoJson.features.forEach(item => { const name = item.properties['name'] - if (areaMap[name]) { + if (areaMap?.[name]) { dotData.push({ x: item.properties['centroid'][0], y: item.properties['centroid'][1], diff --git a/core/core-frontend/src/views/chart/components/js/panel/charts/map/common.ts b/core/core-frontend/src/views/chart/components/js/panel/charts/map/common.ts index e624352d88..e9c87be3fd 100644 --- a/core/core-frontend/src/views/chart/components/js/panel/charts/map/common.ts +++ b/core/core-frontend/src/views/chart/components/js/panel/charts/map/common.ts @@ -41,6 +41,7 @@ export const MAP_EDITOR_PROPERTY_INNER: EditorPropertyInner = { export const MAP_AXIS_TYPE: AxisType[] = [ 'xAxis', 'yAxis', + 'area', 'drill', 'filter', 'extLabel', diff --git a/core/core-frontend/src/views/chart/components/views/components/ChartComponentG2Plot.vue b/core/core-frontend/src/views/chart/components/views/components/ChartComponentG2Plot.vue index ac84688c29..cdd2833a93 100644 --- a/core/core-frontend/src/views/chart/components/views/components/ChartComponentG2Plot.vue +++ b/core/core-frontend/src/views/chart/components/views/components/ChartComponentG2Plot.vue @@ -150,6 +150,7 @@ const country = ref('') const appStore = useAppStoreWithOut() const isDataEaseBi = computed(() => appStore.getIsDataEaseBi) let mapTimer +const chartContainer = ref(null) const renderL7Plot = (chart, chartView: L7PlotChartView, callback?) => { const map = parseJson(chart.customAttr).map let areaId = map.id @@ -160,6 +161,9 @@ const renderL7Plot = (chart, chartView: L7PlotChartView, callback?) => mapTimer && clearTimeout(mapTimer) mapTimer = setTimeout(async () => { myChart?.destroy() + if (chartContainer.value) { + chartContainer.value.textContent = '' + } myChart = await chartView.drawChart({ chartObj: myChart, container: containerId, @@ -301,7 +305,7 @@ onBeforeUnmount(() => { :style="state.trackBarStyle" @trackClick="trackClick" /> -
+