소스 검색

fix:优化漏斗图的转化率

liu.shiyi 1 년 전
부모
커밋
94e0b99de2

+ 4 - 2
data-room-ui/packages/G2Plots/漏斗图/分面漏斗图.js

@@ -229,7 +229,8 @@ const data = [
 const optionHandler = `option.legend = option.legendEnable ? {position: option.legendPosition}: false;
 window.conversionTagName = option.conversionTagName
 option.conversionTag.formatter = (datum) => {
-  return window.conversionTagName + datum.$$percentage$$.toFixed(2) * 100 + '%'
+  const percentage = parseFloat(datum.$$percentage$$)
+  return window.conversionTagName +  (percentage * 100).toFixed(2) + '%'
 }
 if (option.legendEnable) {
    option.legend.itemName = option.legendItemName
@@ -277,7 +278,8 @@ const option = {
       fontSize: 12
     },
     formatter: (datum) => {
-      return option.conversionTagName + datum.$$percentage$$.toFixed(2) * 100 + '%'
+      const percentage = parseFloat(datum.$$percentage$$)
+      return '转化率' + (percentage * 100).toFixed(2) + '%'
     }
   }
 }

+ 7 - 4
data-room-ui/packages/G2Plots/漏斗图/基础漏斗图.js

@@ -1,6 +1,7 @@
+import { Funnel } from '@antv/g2plot'
 
 // 配置版本号
-const version = '2023071001'
+const version = '2023071002'
 // 分类
 const category = 'Funnel'
 // 标题
@@ -211,7 +212,7 @@ const setting = [
     value: '#595959',
     tabName: 'custom',
     groupName: 'legend'
-  },
+  }
   // 边距 padding
 ]
 
@@ -228,7 +229,8 @@ const data = [
 const optionHandler = `option.legend = option.legendEnable ? {position: option.legendPosition}: false;
 window.conversionTagName = option.conversionTagName
 option.conversionTag.formatter = (datum) => {
-  return window.conversionTagName + datum.$$percentage$$.toFixed(2) * 100 + '%'
+  const percentage = parseFloat(datum.$$percentage$$)
+  return window.conversionTagName +  (percentage * 100).toFixed(2) + '%'
 }
 if (option.legendEnable) {
    option.legend.itemName = option.legendItemName
@@ -275,7 +277,8 @@ const option = {
       fontSize: 12
     },
     formatter: (datum) => {
-      return '转化率' + datum.$$percentage$$.toFixed(2) * 100 + '%'
+      const percentage = parseFloat(datum.$$percentage$$)
+      return '转化率' + (percentage * 100).toFixed(2) + '%'
     }
   }
 }

+ 4 - 2
data-room-ui/packages/G2Plots/漏斗图/对比漏斗图.js

@@ -229,7 +229,8 @@ const data = [
 const optionHandler = `option.legend = option.legendEnable ? {position: option.legendPosition}: false;
 window.conversionTagName = option.conversionTagName
 option.conversionTag.formatter = (datum) => {
-  return window.conversionTagName + datum.$$percentage$$.toFixed(2) * 100 + '%'
+  const percentage = parseFloat(datum.$$percentage$$)
+  return window.conversionTagName +  (percentage * 100).toFixed(2) + '%'
 }
 if (option.legendEnable) {
    option.legend.itemName = option.legendItemName
@@ -277,7 +278,8 @@ const option = {
       fontSize: 12
     },
     formatter: (datum) => {
-      return option.conversionTagName + datum.$$percentage$$.toFixed(2) * 100 + '%'
+      const percentage = parseFloat(datum.$$percentage$$)
+      return '转化率' + (percentage * 100).toFixed(2) + '%'
     }
   }
 }