Merge pull request #7705 from dataease/pr@dev-v2@fix_liquid_big_number

fix(视图-水波图): 数值过大显示异常
This commit is contained in:
wisonic-s 2024-01-18 18:54:46 +08:00 committed by GitHub
commit 5e73fb07b3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -112,6 +112,14 @@ export class Liquid extends G2PlotChartView<LiquidOptions, G2Liquid> {
protected configLabel(chart: Chart, options: LiquidOptions): LiquidOptions {
const customAttr = parseJson(chart.customAttr)
const originVal = options.percent
// 数值过大视图会异常大于 1 无意义
if (originVal > 1) {
options = {
...options,
percent: 1
}
}
if (!customAttr.label?.show) {
return {
...options,
@ -130,9 +138,8 @@ export class Liquid extends G2PlotChartView<LiquidOptions, G2Liquid> {
fontSize: label.fontSize.toString() + 'px',
color: label.color
},
formatter: function (v) {
const value = v.percent
return valueFormatter(value, labelFormatter)
formatter: () => {
return valueFormatter(originVal, labelFormatter)
}
}
}