diff --git a/src/scale/helper.ts b/src/scale/helper.ts index 3302b165ee..ef35160dd5 100644 --- a/src/scale/helper.ts +++ b/src/scale/helper.ts @@ -128,7 +128,7 @@ export function contain(val: number, extent: [number, number]): boolean { export function normalize(val: number, extent: [number, number]): number { if (extent[1] === extent[0]) { - return 0.5; + return isNaN(val) ? NaN : 0.5; } return (val - extent[0]) / (extent[1] - extent[0]); }