mermaid-js / mermaid

Generation of diagrams like flowcharts or sequence diagrams from text in a similar manner as markdown
https://mermaid.js.org
MIT License
69.19k stars 6.12k forks source link

bug/5293_Allow_NaN_For_XYchart #5369

Open JingyuMarcelLee opened 4 months ago

JingyuMarcelLee commented 4 months ago

:bookmark_tabs: Summary

Allows NaN values for line and bar charts for XY chart.

    xychart-beta
      title "Sales Revenue"
      x-axis Months [jan, feb, mar, apr, may, jun, jul, aug, sep, oct, nov, dec]
      y-axis "Revenue (in $)" -2000 --> 11000
      bar [5000, NaN, 7500, 8200, 9500, 10500, NaN, 10200, 9200, 8500, 7000, 6000]
      line [5000, NaN, 7500, 8200, 9500, 10500, NaN, 10200, 9200, 8500, 7000, 6000]

Resolves #5293

:straight_ruler: 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.

:clipboard: Tasks

Make sure you

netlify[bot] commented 4 months ago

Deploy Preview for mermaid-js failed.

Name Link
Latest commit c4f61ed7c6ce2b3ce4551d79f366f019e3cca393
Latest deploy log https://app.netlify.com/sites/mermaid-js/deploys/65fa75c21f4c2e00080a6ef4
codecov[bot] commented 4 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 44.67%. Comparing base (10fb856) to head (c4f61ed).

Additional details and impacted files [![Impacted file tree graph](https://app.codecov.io/gh/mermaid-js/mermaid/pull/5369/graphs/tree.svg?width=650&height=150&src=pr&token=BaET4V1BdM&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=mermaid-js)](https://app.codecov.io/gh/mermaid-js/mermaid/pull/5369?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=mermaid-js) ```diff @@ 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 ``` | [Flag](https://app.codecov.io/gh/mermaid-js/mermaid/pull/5369/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=mermaid-js) | Coverage Δ | | |---|---|---| | [unit](https://app.codecov.io/gh/mermaid-js/mermaid/pull/5369/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=mermaid-js) | `44.67% <ø> (ø)` | | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=mermaid-js#carryforward-flags-in-the-pull-request-comment) to find out more.