Skip to content

Commit

Permalink
fix(geometry): 修复 record 存在 NaN 时,sort 顺序不对
Browse files Browse the repository at this point in the history
  • Loading branch information
zengyue committed Oct 31, 2023
1 parent 7394a0f commit 2c3a40c
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions packages/f2/src/components/geometry/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -403,10 +403,15 @@ class Geometry<
toTimeStamp(record1[FIELD_ORIGIN][field]) - toTimeStamp(record2[FIELD_ORIGIN][field])
);
}
return (
xScale.translate(record1[FIELD_ORIGIN][field]) -
xScale.translate(record2[FIELD_ORIGIN][field])
);
const normalized1 = xScale.translate(record1[FIELD_ORIGIN][field]);
const normalized2 = xScale.translate(record2[FIELD_ORIGIN][field]);
if (isNaN(normalized1)) {
return 1;
}
if (isNaN(normalized2)) {
return -1;
}
return normalized1 - normalized2;
});
});
}
Expand Down

0 comments on commit 2c3a40c

Please sign in to comment.