-
-
Notifications
You must be signed in to change notification settings - Fork 6.7k
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
bug/5293_Allow_NaN_For_XYchart #5369
base: develop
Are you sure you want to change the base?
bug/5293_Allow_NaN_For_XYchart #5369
Conversation
Added NaN token to xychart.jison. Added logic in xychartRenderer.ts and linePlot.ts to parse NaN value and correctly display them on bar and line charts. Added test cases for xychart.jison
❌ Deploy Preview for mermaid-js failed.
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop #5369 +/- ##
========================================
Coverage 44.67% 44.67%
========================================
Files 25 25
Lines 5341 5341
Branches 27 27
========================================
Hits 2386 2386
Misses 2954 2954
Partials 1 1
Flags with carried forward coverage won't be shown. Click here to find out more. |
| NAN COMMA commaSeparatedNumbers { $$ = [Number($NAN), ...$commaSeparatedNumbers] } | ||
| NAN { $$ = [Number($NAN)] } |
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 feel like this is a wrong place to represent NaN, because commaSeparatedNumbers
represents the list, and does not necessarily have to deal with all the possible values. Adding more things apart from numbers will inflate the grammar. My suggestion is to combine NUMBER_WITH_DECIMAL
and NAN
into a separate rule called optionalValue
, but my suggestion is optional, I guess 😃
@@ -57,6 +57,7 @@ | |||
|
|||
"[" return 'SQUARE_BRACES_START' | |||
"]" return 'SQUARE_BRACES_END' | |||
"NaN" return 'NAN'; |
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.
NaN is rather JS-originated, while many programming languages use their own keywords. Why not simply omitting the value?
📑 Summary
Allows NaN values for line and bar charts for XY chart.
Resolves #5293
📏 Design Decisions
For the bar chart, the bars are rendered with a height of 0 so the bar is not displayed when NaN values are passed in. For the line chart, the lines are broken where NaN values are passed in and are continued at the non-missing value. The
mermaid
code above will generate the diagram below.📋 Tasks
Make sure you
MERMAID_RELEASE_VERSION
is used for all new features.develop
branch