fix: fix linearDiscreteTicks() when labelLastVisible is true

This commit is contained in:
xile611 2023-11-21 16:53:44 +08:00
parent c90ea27034
commit c7007b2c56

View File

@ -127,7 +127,8 @@ export const linearDiscreteTicks = (scale: BandScale, op: ICartesianTickDataOpt)
if (
scaleTicks.length &&
scaleTicks[scaleTicks.length - 1] !== domain[domain.length - 1] &&
scale.scale(scaleTicks[scaleTicks.length - 1]) - scale.scale(domain[domain.length - 1]) < maxBounds[2]
Math.abs(scale.scale(scaleTicks[scaleTicks.length - 1]) - scale.scale(domain[domain.length - 1])) <
maxBounds[2]
) {
scaleTicks = scaleTicks.slice(0, -1);
}