Bladeren bron

[Feat 0000] 可配置首页添加legend可调节功能

houzekong 1 maand geleden
bovenliggende
commit
814da35741

+ 2 - 0
src/views/vent/deviceManager/configurationTable/types.ts

@@ -257,6 +257,8 @@ export interface ModuleDataChart extends ReadFrom {
   /** 图表legend配置 */
   legend: {
     show: boolean;
+    /** 参考echarts格式化文本 */
+    formatter?: string;
   };
 }
 

+ 1 - 3
src/views/vent/home/configurable/components/detail/CustomChart.vue

@@ -251,9 +251,7 @@
               show: true,
               position: 'outside',
               color: '#ddd',
-              formatter: function ({ name, value }) {
-                return `${name}\n${value}pa`;
-              },
+              formatter: get(legend, 'formatter', '{b}\n{c}pa'),
             },
             labelLine: {
               length: 30,

+ 2 - 2
src/views/vent/home/configurable/configurable.data.ts

@@ -325,9 +325,9 @@ export const testConfigVent: Config[] = [
       table: [],
       chart: [
         {
-          type: 'pie_drag',
+          type: 'pie_halo',
           readFrom: '',
-          legend: { show: false },
+          legend: { show: false, formatter: '{b}:{c}\n{d}%' },
           xAxis: [{ show: false }],
           yAxis: [{ show: false, name: '风量', position: 'left' }],
           series: [{ readFrom: 'piechart', xprop: 'label', yprop: 'valMock', label: '' }],