Skip to content

Commit

Permalink
fix NaN不应返回有值
Browse files Browse the repository at this point in the history
  • Loading branch information
linlang171 committed Dec 8, 2024
1 parent 2576fc2 commit 083eb3b
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/scale/helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,9 @@ export function contain(val: number, extent: [number, number]): boolean {
}

export function normalize(val: number, extent: [number, number]): number {
if (isNaN(val)) {
return NaN;
}
if (extent[1] === extent[0]) {
return 0.5;
}
Expand Down

0 comments on commit 083eb3b

Please sign in to comment.