diff --git a/dashboard/src/components/plugins/common-echarts-fields/visual-map/utils.ts b/dashboard/src/components/plugins/common-echarts-fields/visual-map/utils.ts index 04f8cfa62..206737977 100644 --- a/dashboard/src/components/plugins/common-echarts-fields/visual-map/utils.ts +++ b/dashboard/src/components/plugins/common-echarts-fields/visual-map/utils.ts @@ -93,9 +93,10 @@ export function getVisualMap(visualMap: VisualMap, variableValueMap: Record { const item: AnyObject = {}; @@ -106,11 +107,16 @@ export function getVisualMap(visualMap: VisualMap, variableValueMap: Record { - if (v === '' || Number.isNaN(Number(v))) { - return sign + '∞'; +const toIntervalValue = (v: string, extremum: '') => { + if (v === '') { + return extremum; } - return sign + v; + if (Number.isNaN(Number(v))) { + return 'INVALID VALUE'; + } + return v; }; type Props = { @@ -32,15 +36,17 @@ type Props = { index: number; }; export const IntervalEditor = ({ form, index }: Props) => { + const { t } = useTranslation(); + const { control, watch } = form; const piece = watch(`visualMap.pieces.${index}`); const { lower, upper } = piece; const intervalPreview = [ symbolToBracket[lower.symbol], - toIntervalValue(lower.value, '-'), + toIntervalValue(lower.value, t('chart.visual_map.min_value')), ',', - toIntervalValue(upper.value, ''), + toIntervalValue(upper.value, t('chart.visual_map.max_value')), symbolToBracket[upper.symbol], ].join(''); @@ -77,11 +83,10 @@ export const IntervalEditor = ({ form, index }: Props) => { render={({ field }) => ( field.onChange(e.currentTarget.value)} error={field.value !== '' && Number.isNaN(Number(field.value))} - styles={{ input: { '&::placeholder': { fontSize: '16px' } } }} /> )} /> @@ -93,7 +98,7 @@ export const IntervalEditor = ({ form, index }: Props) => { )} /> - value + {t('common.value').toLowerCase()} { field.onChange(e.currentTarget.value)} error={field.value !== '' && Number.isNaN(Number(field.value))} - styles={{ input: { '&::placeholder': { fontSize: '16px' } } }} /> )} /> diff --git a/dashboard/src/components/plugins/common-echarts-fields/visual-map/visual-map-editor/piecewise/piece-editor.tsx b/dashboard/src/components/plugins/common-echarts-fields/visual-map/visual-map-editor/piecewise/piece-editor.tsx index 0d8cc1aa5..e4770b43a 100644 --- a/dashboard/src/components/plugins/common-echarts-fields/visual-map/visual-map-editor/piecewise/piece-editor.tsx +++ b/dashboard/src/components/plugins/common-echarts-fields/visual-map/visual-map-editor/piecewise/piece-editor.tsx @@ -14,7 +14,7 @@ export const PieceEditor = ({ form, index, remove }: Props) => { const { t } = useTranslation(); return ( - {index.toString()} + {(index + 1).toString()} diff --git a/dashboard/src/components/plugins/common-echarts-fields/visual-map/visual-map-editor/piecewise/pieces-editor.tsx b/dashboard/src/components/plugins/common-echarts-fields/visual-map/visual-map-editor/piecewise/pieces-editor.tsx index ea777fd4d..179941199 100644 --- a/dashboard/src/components/plugins/common-echarts-fields/visual-map/visual-map-editor/piecewise/pieces-editor.tsx +++ b/dashboard/src/components/plugins/common-echarts-fields/visual-map/visual-map-editor/piecewise/pieces-editor.tsx @@ -34,9 +34,9 @@ export const PiecesEditor = ({ form }: Props) => { - Interval - Label - Color + {t('chart.visual_map.piecewise.interval')} + {t('chart.visual_map.piecewise.piece_label')} + {t('chart.color.label')} diff --git a/dashboard/src/i18n/en.ts b/dashboard/src/i18n/en.ts index 3a1838458..5de4b702c 100644 --- a/dashboard/src/i18n/en.ts +++ b/dashboard/src/i18n/en.ts @@ -609,6 +609,8 @@ export const en = { categories: 'Categories', }, add_a_piece: 'Add a piece', + interval: 'Interval', + piece_label: 'Label', }, bar_width: 'Bar Width', bar_height: 'Bar Height', diff --git a/dashboard/src/i18n/zh.ts b/dashboard/src/i18n/zh.ts index b0a919d80..cce095263 100644 --- a/dashboard/src/i18n/zh.ts +++ b/dashboard/src/i18n/zh.ts @@ -609,6 +609,8 @@ export const zh = { categories: '离散数据', }, add_a_piece: '加一个分段', + interval: '值区间', + piece_label: '文案', }, bar_width: '长条的宽度', bar_height: '长条的高度',