-
Notifications
You must be signed in to change notification settings - Fork 19.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(OrdinalScale): fix line graph renders null value incorrectly. clo… #16672
Conversation
Thanks for your contribution! |
src/scale/Ordinal.ts
Outdated
@@ -130,6 +130,10 @@ class OrdinalScale extends Scale<OrdinalScaleSetting> { | |||
} | |||
|
|||
parse(val: OrdinalRawValue | OrdinalNumber): OrdinalNumber { | |||
// Caution: Math.round(null) will return `0` rather than `NaN` | |||
if (val == null) { | |||
val = undefined; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can return NaN
directly here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I didn't realize this.
|
Congratulations! Your PR has been merged. Thanks for your contribution! 👍 |
…se #16664
Brief Information
This pull request is in the type of: bug fixing
What does this PR do?
Fix function OrdinalScale.parse returns an unexpected value
0
withnull
.Fixed issues
Details
Before: What was the problem?
When options like this:
We expect the value of
null
will not be rendered,but ECharts renders it like the following:
When
OrdinalScale.parse
function handle the input value ofnull
,it returns
0
rather thanNaN
,because
Math.round(null)
will produce0
.We expect
null
will behave the same asundefined
.So I add a judgement in
OrdinalScale.parse
.After: How is it fixed in this PR?