diff --git a/frontend/src/domain/valueObjects/ChartType.ts b/frontend/src/domain/valueObjects/ChartType.ts index 045a63e..e90c803 100644 --- a/frontend/src/domain/valueObjects/ChartType.ts +++ b/frontend/src/domain/valueObjects/ChartType.ts @@ -29,136 +29,136 @@ export interface ChartTypeMeta { export const CHART_TYPE_META: Record = { kpi: { type: 'kpi', - label: 'KPI Card', - icon: 'kpi', + label: '指标卡', + icon: 'dashboard', category: 'basic', requiredBindings: ['value'], optionalBindings: ['label'], }, bar: { type: 'bar', - label: 'Bar Chart', - icon: 'bar', + label: '柱状图', + icon: 'bar-chart', category: 'basic', requiredBindings: ['x', 'y'], optionalBindings: ['color', 'label'], }, 'grouped-bar': { type: 'grouped-bar', - label: 'Grouped Bar Chart', - icon: 'grouped-bar', + label: '分组柱状图', + icon: 'bar-chart', category: 'basic', requiredBindings: ['x', 'y', 'series'], optionalBindings: ['color', 'label'], }, 'stacked-bar': { type: 'stacked-bar', - label: 'Stacked Bar Chart', - icon: 'stacked-bar', + label: '堆叠柱状图', + icon: 'bar-chart', category: 'composition', requiredBindings: ['x', 'y', 'series'], optionalBindings: ['color', 'label'], }, 'horizontal-bar': { type: 'horizontal-bar', - label: 'Horizontal Bar Chart', - icon: 'horizontal-bar', + label: '条形图', + icon: 'bar-chart', category: 'basic', requiredBindings: ['x', 'y'], optionalBindings: ['color', 'label'], }, line: { type: 'line', - label: 'Line Chart', - icon: 'line', + label: '折线图', + icon: 'line-chart', category: 'basic', requiredBindings: ['x', 'y'], optionalBindings: ['series', 'color', 'label'], }, area: { type: 'area', - label: 'Area Chart', - icon: 'area', + label: '面积图', + icon: 'area-chart', category: 'basic', requiredBindings: ['x', 'y'], optionalBindings: ['series', 'color', 'label'], }, pie: { type: 'pie', - label: 'Pie Chart', - icon: 'pie', + label: '饼图', + icon: 'pie-chart', category: 'composition', requiredBindings: ['label', 'value'], optionalBindings: ['color'], }, donut: { type: 'donut', - label: 'Donut Chart', - icon: 'donut', + label: '环形图', + icon: 'pie-chart', category: 'composition', requiredBindings: ['label', 'value'], optionalBindings: ['color'], }, scatter: { type: 'scatter', - label: 'Scatter Plot', - icon: 'scatter', + label: '散点图', + icon: 'dot-chart', category: 'relationship', requiredBindings: ['x', 'y'], optionalBindings: ['size', 'color', 'label'], }, radar: { type: 'radar', - label: 'Radar Chart', - icon: 'radar', + label: '雷达图', + icon: 'radar-chart', category: 'statistical', requiredBindings: ['label', 'value'], optionalBindings: ['series', 'color'], }, wordcloud: { type: 'wordcloud', - label: 'Word Cloud', - icon: 'wordcloud', + label: '词云图', + icon: 'cloud', category: 'other', requiredBindings: ['label', 'value'], optionalBindings: ['color'], }, 'boston-matrix': { type: 'boston-matrix', - label: 'Boston Matrix', - icon: 'boston-matrix', + label: '波士顿矩阵', + icon: 'block', category: 'relationship', requiredBindings: ['x', 'y'], optionalBindings: ['size', 'label', 'color'], }, heatmap: { type: 'heatmap', - label: 'Heatmap', - icon: 'heatmap', + label: '热力图', + icon: 'heat-map', category: 'statistical', requiredBindings: ['x', 'y', 'value'], optionalBindings: ['color'], }, map: { type: 'map', - label: 'Map', - icon: 'map', + label: '地图', + icon: 'global', category: 'geo', requiredBindings: ['geo', 'value'], optionalBindings: ['color', 'label'], }, combo: { type: 'combo', - label: 'Combo Chart', - icon: 'combo', + label: '组合图', + icon: 'stock', category: 'statistical', requiredBindings: ['x', 'y'], optionalBindings: ['series', 'color', 'label'], }, 'data-table': { type: 'data-table', - label: 'Data Table', - icon: 'data-table', + label: '数据表格', + icon: 'table', category: 'other', requiredBindings: [], optionalBindings: ['x', 'y', 'label', 'value'], diff --git a/frontend/src/frameworks/components/layout/LeftPanel.tsx b/frontend/src/frameworks/components/layout/LeftPanel.tsx index 25bca02..a971007 100644 --- a/frontend/src/frameworks/components/layout/LeftPanel.tsx +++ b/frontend/src/frameworks/components/layout/LeftPanel.tsx @@ -11,6 +11,17 @@ import { GlobalOutlined, QuestionOutlined, BarChartOutlined, + LineChartOutlined, + PieChartOutlined, + DotChartOutlined, + RadarChartOutlined, + AreaChartOutlined, + HeatMapOutlined, + StockOutlined, + TableOutlined, + DashboardOutlined, + CloudOutlined, + BlockOutlined, } from '@ant-design/icons'; import { useUIStore } from '@/adapters/state/zustand/uiStore'; import { useAppSelector, useAppDispatch } from '@/adapters/state/redux/store'; @@ -164,6 +175,26 @@ function FieldsTab() { ); } +const ICON_MAP: Record = { + 'dashboard': , + 'bar-chart': , + 'line-chart': , + 'area-chart': , + 'pie-chart': , + 'dot-chart': , + 'radar-chart': , + 'heat-map': , + 'stock': , + 'table': , + 'cloud': , + 'block': , + 'global': , +}; + +function ChartIcon({ icon }: { icon: string }) { + return <>{ICON_MAP[icon] ?? }; +} + /** ChartsTab: chart type gallery grouped by category */ function ChartsTab() { const { handleCreate, loading } = useCreateChart(); @@ -207,7 +238,7 @@ function ChartsTab() { bodyStyle={{ padding: '8px 4px' }} onClick={() => !loading && handleCreate(meta.type)} > - +
{meta.label}
))}