From c4c8d5fffefcf75f9da51b903ff2c8606534a21a Mon Sep 17 00:00:00 2001 From: wisonic Date: Thu, 17 Oct 2024 19:32:04 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E5=9B=BE=E8=A1=A8):=20=E5=9C=A8=E7=BA=BF?= =?UTF-8?q?=E5=9C=B0=E5=9B=BE=E6=94=AF=E6=8C=81=E6=8E=A7=E5=88=B6=E6=A0=87?= =?UTF-8?q?=E7=AD=BE=E6=98=BE=E9=9A=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/core-frontend/src/locales/zh-CN.ts | 3 ++- core/core-frontend/src/models/chart/chart-attr.d.ts | 4 ++++ .../editor-style/components/BasicStyleSelector.vue | 11 ++++++++++- .../src/views/chart/components/editor/util/chart.ts | 3 ++- .../chart/components/js/panel/charts/map/flow-map.ts | 5 +++-- .../chart/components/js/panel/charts/map/heat-map.ts | 9 +++++---- .../components/js/panel/charts/map/symbolic-map.ts | 12 ++++++++++-- 7 files changed, 36 insertions(+), 11 deletions(-) diff --git a/core/core-frontend/src/locales/zh-CN.ts b/core/core-frontend/src/locales/zh-CN.ts index 13386a2ee9..ce23c85708 100644 --- a/core/core-frontend/src/locales/zh-CN.ts +++ b/core/core-frontend/src/locales/zh-CN.ts @@ -1541,7 +1541,8 @@ export default { map_symbol_octagon: '八角形', map_symbol_hexagram: '菱形', tip: '提示', - hide: '隐藏' + hide: '隐藏', + show_label: '显示标签' }, dataset: { scope_edit: '仅编辑时生效', diff --git a/core/core-frontend/src/models/chart/chart-attr.d.ts b/core/core-frontend/src/models/chart/chart-attr.d.ts index 746a28ddd6..68b4a12cb5 100644 --- a/core/core-frontend/src/models/chart/chart-attr.d.ts +++ b/core/core-frontend/src/models/chart/chart-attr.d.ts @@ -289,6 +289,10 @@ declare interface ChartBasicStyle { * 符号地图符号大小最大值 */ mapSymbolSizeMax: number + /** + * 显示标签 + */ + showLabel: boolean } /** * 表头属性 diff --git a/core/core-frontend/src/views/chart/components/editor/editor-style/components/BasicStyleSelector.vue b/core/core-frontend/src/views/chart/components/editor/editor-style/components/BasicStyleSelector.vue index 04fba8a550..c81edad34b 100644 --- a/core/core-frontend/src/views/chart/components/editor/editor-style/components/BasicStyleSelector.vue +++ b/core/core-frontend/src/views/chart/components/editor/editor-style/components/BasicStyleSelector.vue @@ -603,12 +603,21 @@ onMounted(() => { + + + {{ t('chart.show_label') }} + + {{ t('chart.show_zoom') }} diff --git a/core/core-frontend/src/views/chart/components/editor/util/chart.ts b/core/core-frontend/src/views/chart/components/editor/util/chart.ts index 423c93ee27..55dcdc8d7d 100644 --- a/core/core-frontend/src/views/chart/components/editor/util/chart.ts +++ b/core/core-frontend/src/views/chart/components/editor/util/chart.ts @@ -1585,7 +1585,8 @@ export const DEFAULT_BASIC_STYLE: ChartBasicStyle = { seriesColor: [], layout: 'horizontal', mapSymbolSizeMin: 4, - mapSymbolSizeMax: 30 + mapSymbolSizeMax: 30, + showLabel: true } export const BASE_VIEW_CONFIG = { diff --git a/core/core-frontend/src/views/chart/components/js/panel/charts/map/flow-map.ts b/core/core-frontend/src/views/chart/components/js/panel/charts/map/flow-map.ts index 8f741e2aa1..e42d01bd0c 100644 --- a/core/core-frontend/src/views/chart/components/js/panel/charts/map/flow-map.ts +++ b/core/core-frontend/src/views/chart/components/js/panel/charts/map/flow-map.ts @@ -30,7 +30,7 @@ export class FlowMap extends L7ChartView { ] propertyInner: EditorPropertyInner = { ...MAP_EDITOR_PROPERTY_INNER, - 'basic-style-selector': ['mapBaseStyle', 'mapLineStyle', 'zoom'] + 'basic-style-selector': ['mapBaseStyle', 'mapLineStyle', 'zoom', 'showLabel'] } axis: AxisType[] = ['xAxis', 'xAxisExt', 'filter', 'flowMapStartName', 'flowMapEndName', 'yAxis'] axisConfig: AxisConfig = { @@ -84,7 +84,8 @@ export class FlowMap extends L7ChartView { token: key ?? undefined, style: mapStyle, pitch: misc.mapPitch, - zoom: 2.5 + zoom: 2.5, + showLabel: !(basicStyle.showLabel === false) }) }) mapRendering(container) diff --git a/core/core-frontend/src/views/chart/components/js/panel/charts/map/heat-map.ts b/core/core-frontend/src/views/chart/components/js/panel/charts/map/heat-map.ts index 21fdf99bd4..dd7c50c7db 100644 --- a/core/core-frontend/src/views/chart/components/js/panel/charts/map/heat-map.ts +++ b/core/core-frontend/src/views/chart/components/js/panel/charts/map/heat-map.ts @@ -27,7 +27,7 @@ export class HeatMap extends L7ChartView { ] propertyInner: EditorPropertyInner = { ...MAP_EDITOR_PROPERTY_INNER, - 'basic-style-selector': ['colors', 'heatMapStyle', 'zoom'] + 'basic-style-selector': ['colors', 'heatMapStyle', 'zoom', 'showLabel'] } axis: AxisType[] = ['xAxis', 'yAxis', 'filter'] axisConfig: AxisConfig = { @@ -50,8 +50,8 @@ export class HeatMap extends L7ChartView { const { chart, container } = drawOption const xAxis = deepCopy(chart.xAxis) const yAxis = deepCopy(chart.yAxis) - let basicStyle - let miscStyle + let basicStyle: DeepPartial + let miscStyle: DeepPartial if (chart.customAttr) { basicStyle = parseJson(chart.customAttr).basicStyle miscStyle = parseJson(chart.customAttr).misc @@ -66,7 +66,8 @@ export class HeatMap extends L7ChartView { token: key ?? undefined, style: mapStyle, pitch: miscStyle.mapPitch, - zoom: 2.5 + zoom: 2.5, + showLabel: !(basicStyle.showLabel === false) }) }) mapRendering(container) diff --git a/core/core-frontend/src/views/chart/components/js/panel/charts/map/symbolic-map.ts b/core/core-frontend/src/views/chart/components/js/panel/charts/map/symbolic-map.ts index 8552c32efa..3a4b3bde03 100644 --- a/core/core-frontend/src/views/chart/components/js/panel/charts/map/symbolic-map.ts +++ b/core/core-frontend/src/views/chart/components/js/panel/charts/map/symbolic-map.ts @@ -30,7 +30,14 @@ export class SymbolicMap extends L7ChartView { ] propertyInner: EditorPropertyInner = { ...MAP_EDITOR_PROPERTY_INNER, - 'basic-style-selector': ['colors', 'alpha', 'mapBaseStyle', 'symbolicMapStyle', 'zoom'], + 'basic-style-selector': [ + 'colors', + 'alpha', + 'mapBaseStyle', + 'symbolicMapStyle', + 'zoom', + 'showLabel' + ], 'label-selector': ['color', 'fontSize', 'showFields', 'customContent'], 'tooltip-selector': [ 'color', @@ -89,7 +96,8 @@ export class SymbolicMap extends L7ChartView { style: mapStyle, pitch: miscStyle.mapPitch, center: [104.434765, 38.256735], - zoom: 1.8 + zoom: 2.5, + showLabel: !(basicStyle.showLabel === false) }) }) mapRendering(container)