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
68.63k stars 6.05k forks source link

[XYChart] fixed incorrect spacing between data points #5556

Closed OG-NI closed 1 week ago

OG-NI commented 4 weeks ago

:bookmark_tabs: Summary

This fixes the issue of XYCharts, where the spacing between the data points is sometimes incorrect and some data points not being displayed.

Resolves #5555

:straight_ruler: Design Decisions

The formula calculating the distance between two data points when using a numeric range on the x-axis has been changed from const step = (max - min + 1) / data.length; to const step = (max - min) / (data.length - 1);. This maps the first value to the minimum on the x-axis, the last value to the maximum and evenly distributes all other values between the two ends.

The changes made do not affect the way any existing demo chart is being rendered.

Feel free to ask if any additional documentation is needed.

:clipboard: Tasks

Make sure you

netlify[bot] commented 4 weeks ago

Deploy Preview for mermaid-js ready!

Name Link
Latest commit 0c49d2b84e945a14b66c58a335387c4e79540ba4
Latest deploy log https://app.netlify.com/sites/mermaid-js/deploys/6674799fbafeaf0008ac3db4
Deploy Preview https://deploy-preview-5556--mermaid-js.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

codecov[bot] commented 4 weeks ago

Codecov Report

Attention: Patch coverage is 0% with 1 line in your changes missing coverage. Please review.

Project coverage is 5.73%. Comparing base (1e43ad1) to head (0c49d2b).

Additional details and impacted files [![Impacted file tree graph](https://app.codecov.io/gh/mermaid-js/mermaid/pull/5556/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/5556?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 #5556 +/- ## ======================================= Coverage 5.73% 5.73% ======================================= Files 278 278 Lines 42019 42019 Branches 516 516 ======================================= Hits 2409 2409 Misses 39610 39610 ``` | [Flag](https://app.codecov.io/gh/mermaid-js/mermaid/pull/5556/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/5556/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=mermaid-js) | `5.73% <0.00%> (ø)` | | 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. | [Files](https://app.codecov.io/gh/mermaid-js/mermaid/pull/5556?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=mermaid-js) | Coverage Δ | | |---|---|---| | [packages/mermaid/src/diagrams/xychart/xychartDb.ts](https://app.codecov.io/gh/mermaid-js/mermaid/pull/5556?src=pr&el=tree&filepath=packages%2Fmermaid%2Fsrc%2Fdiagrams%2Fxychart%2FxychartDb.ts&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=mermaid-js#diff-cGFja2FnZXMvbWVybWFpZC9zcmMvZGlhZ3JhbXMveHljaGFydC94eWNoYXJ0RGIudHM=) | `0.00% <0.00%> (ø)` | |
argos-ci[bot] commented 1 week ago

The latest updates on your projects. Learn more about Argos notifications ↗︎

Build Status Details Updated (UTC)
default (Inspect) 👍 Changes approved 1 added Jun 20, 2024, 7:00 PM
mermaid-bot[bot] commented 1 week ago

@OG-NI, Thank you for the contribution! You are now eligible for a year of Premium account on MermaidChart. Sign up with your GitHub account to activate.