fix:优化漏斗图的转化率

main
liu.shiyi 2 years ago
parent 4faa66c210
commit 94e0b99de2

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

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

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

Loading…
Cancel
Save