refactor: 优化富文本数值格式适配 (#17608)

This commit is contained in:
王嘉豪
2025-12-15 16:26:31 +08:00
committed by GitHub
parent 48e103075b
commit 6015f84f87
3 changed files with 25 additions and 7 deletions

View File

@@ -74,6 +74,9 @@ const themeAttrChange = (custom, property, value) => {
})
}
useEmitt().emitter.emit('renderChart-' + viewId, viewInfo)
if (viewInfo.type === 'rich-text') {
useEmitt().emitter.emit('calcData-' + viewId, viewInfo)
}
} catch (e) {
console.warn('themeAttrChange-error')
}

View File

@@ -83,6 +83,9 @@ const themeAttrChange = (custom, property, value) => {
})
}
useEmitt().emitter.emit('renderChart-' + viewId, viewInfo)
if (viewInfo.type === 'rich-text') {
useEmitt().emitter.emit('calcData-' + viewId, viewInfo)
}
} catch (e) {
console.warn('themeAttrChange-error')
}

View File

@@ -299,13 +299,25 @@ export const formatterViewInfo = (viewInfo, value) => {
viewInfo['customAttr']['label']['totalFormatter'],
value
)
viewInfo['customAttr']['tooltip']['tooltipFormatter'] = merge(
viewInfo['customAttr']['tooltip']['tooltipFormatter'],
value
)
viewInfo['customAttr']['tooltip']['seriesTooltipFormatter'].forEach(function (item) {
item['formatterCfg'] = merge(item['formatterCfg'], value)
})
if (
![
'table-info',
'table-normal',
'table-pivot',
'stock-line',
'bullet-graph',
'percentage-bar-stack-horizontal'
].includes(viewInfo.type)
) {
viewInfo['customAttr']['tooltip']['tooltipFormatter'] = merge(
viewInfo['customAttr']['tooltip']['tooltipFormatter'],
value
)
viewInfo['customAttr']['tooltip']['seriesTooltipFormatter'].forEach(function (item) {
item['formatterCfg'] = merge(item['formatterCfg'], value)
})
}
//customStyle
viewInfo['customStyle']['xAxis']['axisLabelFormatter'] = merge(
viewInfo['customStyle']['xAxis']['axisLabelFormatter'],