Kaynağa Gözat

✨ feat(statistics): 为饼图组件添加图例配置

- 在饼图配置中新增 legend 属性,支持显示图例
- 设置图例位置为右侧,并调整行高为 25 像素以优化显示效果

📝 docs(types): 为图表类型定义添加缺失的 dataLabel 属性

- 在 `u-charts-original.d.ts` 的类型定义中补充 `dataLabel` 属性

♻️ refactor(ring-chart): 移除 RingChart 组件中的默认图例配置

- 将默认的图例配置从 RingChart 组件中移除,改为由使用方传入
yourname 2 hafta önce
ebeveyn
işleme
53abe1e02a

+ 1 - 5
mini-ui-packages/mini-charts/src/components/RingChart.tsx

@@ -47,11 +47,7 @@ export const RingChart: React.FC<RingChartProps> = (props) => {
     padding: [5, 5, 5, 5],
     enableScroll: false,
     dataLabel: true,
-    legend: {
-      show: true,
-      position: "right",
-      lineHeight: 25
-    },
+    legend: {},
     extra: {
       ring: {
         ringWidth: ringWidth,

+ 2 - 0
mini-ui-packages/mini-charts/src/types/u-charts-original.d.ts

@@ -33,6 +33,8 @@ export interface ChartsConfig {
   padding?: number[];
   /** 是否启用滚动 */
   enableScroll?: boolean;
+  /** 是否显示数据标签 */
+  dataLabel?: boolean;
   /** 图例配置 */
   legend?: any;
   /** X 轴配置 */

+ 5 - 0
mini-ui-packages/yongren-statistics-ui/src/pages/Statistics/Statistics.tsx

@@ -380,6 +380,11 @@ const Statistics: React.FC<StatisticsProps> = () => {
                       series={convertToPieData(stats)}
                       config={{
                         color: ['#3b82f6', '#f59e0b', '#ef4444', '#10b981'],
+                        legend: {
+                          show: true,
+                          position: "right",
+                          lineHeight: 25
+                        },
                       }}
                     />
                   </View>