fix(图表): 修复同环比计算公式错误 #18377

This commit is contained in:
junjun
2026-05-11 16:33:12 +08:00
committed by Junjun
parent f8a90b0dec
commit 11ef3e8aa3

View File

@@ -540,10 +540,10 @@ public class DefaultChartHandler extends AbstractChartPlugin {
if (new BigDecimal(lastValue).compareTo(BigDecimal.ZERO) == 0) {
item[dataIndex] = null;
} else {
item[dataIndex] = new BigDecimal(cValue)
.divide(new BigDecimal(lastValue).abs(), 8, RoundingMode.HALF_UP)
.subtract(new BigDecimal(1))
.setScale(8, RoundingMode.HALF_UP)
BigDecimal numerator = new BigDecimal(cValue).subtract(new BigDecimal(lastValue));
BigDecimal denominator = new BigDecimal(lastValue).abs();
item[dataIndex] = numerator
.divide(denominator, 8, RoundingMode.HALF_UP)
.toString();
}
} else if (StringUtils.equalsIgnoreCase(resultData, "pre")) {