feat(图表): 符号地图、流向地图、热力地图对经纬度增加字段类型校验

This commit is contained in:
ulleo 2024-12-25 15:54:32 +08:00 committed by fit2cloud-chenyw
parent 0a213eda4d
commit a26513f073
5 changed files with 30 additions and 0 deletions

View File

@ -1815,6 +1815,8 @@ export default {
error_not_number: 'Drag of non-numeric indicators is not supported',
error_q_2_d: 'Drag of indicators to dimensions is not supported',
error_d_2_q: 'Drag of dimensions to indicators is not supported',
error_d_not_coordinates:
'Drag of dimensions that are not of coordinates types is not supported',
error_d_not_time_2_q: 'Drag of non-time dimensions is not supported',
error_bar_range_axis_type_not_equal:
'The start value and end value must be set to the same type',

View File

@ -1852,6 +1852,8 @@ Scatter chart (bubble) chart: {a} (series name), {b} (data name), {c} (value arr
error_not_number: 'Drag of non-numeric indicators is not supported',
error_q_2_d: 'Drag of indicators to dimensions is not supported',
error_d_2_q: 'Drag of dimensions to indicators is not supported',
error_d_not_coordinates:
'Drag of dimensions that are not of coordinates types is not supported',
error_d_not_time_2_q: 'Drag of non-time dimensions is not supported',
error_bar_range_axis_type_not_equal:
'The start value and end value must be set to the same type',

View File

@ -1815,6 +1815,7 @@ export default {
error_not_number: '不支援拖曳非數值類型指標',
error_q_2_d: '不支持拖曳指標至維度',
error_d_2_q: '不支持拖曳維度至指標',
error_d_not_coordinates: '不支持拖拽非地理位置類型的維度',
error_d_not_time_2_q: '不支援拖曳非時間類型的維度',
error_bar_range_axis_type_not_equal: '開始值與結束值需要設定相同型別',
only_input_number: '請輸入正確數值',

View File

@ -1817,6 +1817,7 @@ export default {
error_not_number: '不支持拖拽非数值类型指标',
error_q_2_d: '不支持拖拽指标至维度',
error_d_2_q: '不支持拖拽维度至指标',
error_d_not_coordinates: '不支持拖拽非地理位置类型的维度',
error_d_not_time_2_q: '不支持拖拽非时间类型的维度',
error_bar_range_axis_type_not_equal: '开始值与结束值需要设置相同类型',
only_input_number: '请输入正确数值',

View File

@ -667,6 +667,25 @@ const disableUpdate = computed(() => {
return flag
})
const dragCheckMapType = list => {
if (list && list.length > 0) {
let valid = true
for (let i = 0; i < list.length; i++) {
if (list[i].deType !== 5) {
list.splice(i, 1)
valid = false
}
}
if (!valid) {
ElMessage({
message: t('chart.error_d_not_coordinates'),
type: 'warning'
})
}
return valid
}
}
const addAxis = (e, axis: AxisType) => {
recordSnapshotInfo('calcData')
const axisSpec = chartViewInstance.value?.axisConfig[axis]
@ -698,6 +717,11 @@ const addAxis = (e, axis: AxisType) => {
}
typeValid = valid
}
} else if (
((view.value.type === 'symbolic-map' || view.value.type === 'heat-map') && axis === 'xAxis') ||
(view.value.type === 'flow-map' && (axis === 'xAxis' || axis === 'xAxisExt'))
) {
typeValid = dragCheckMapType(view.value[axis])
} else if (type) {
typeValid = dragCheckType(view.value[axis], type)
}