fix(图表): 修复热力图拖动legend之后最值色块概率消失

This commit is contained in:
wisonic-s
2026-05-09 17:12:46 +08:00
committed by wisonic-s
parent d753fe9a39
commit 2f1e757df3

View File

@@ -242,8 +242,13 @@ export class TableG2Chart extends G2ChartView {
scale: {
color: {
type: 'linear',
nice: true,
interpolate() {
return c => colors[Math.floor(c * (colors.length - 1))]
return c => {
if (isNaN(c)) return colors[0]
const t = Math.max(0, Math.min(1, c))
return colors[Math.floor(t * (colors.length - 1))]
}
}
}
}
@@ -272,8 +277,7 @@ export class TableG2Chart extends G2ChartView {
legend: {
color: {
color: colors,
label: false,
step: 0.00000001
label: false
}
}
}