Skip to content
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

[XYChart] incorrect spacing between data points #5555

Closed
OG-NI opened this issue Jun 1, 2024 · 0 comments · Fixed by #5556
Closed

[XYChart] incorrect spacing between data points #5555

OG-NI opened this issue Jun 1, 2024 · 0 comments · Fixed by #5556
Labels
Status: Triage Needs to be verified, categorized, etc Type: Bug / Error Something isn't working or is incorrect

Comments

@OG-NI
Copy link
Contributor

OG-NI commented Jun 1, 2024

Description

When using the XYChart in combination with a numeric range for the x-axis, the distance between the individual data points is not always correct. This leads to the data being distorted in an unpredictable way and data points on the right hand side of the diagram to be cut off.

Steps to reproduce

Copy the code sample below or create a XYChart with a numeric range where $\text{max} - \text{min} + 1 \ne \text{number of data points}$.

Screenshots

screenshot

Code Sample

xychart-beta
    x-axis 0 --> 2
    line [0, 1, 0, 1]
    bar [1, 0, 1, 0]

Setup

  • Mermaid version: 10.9.1

Suggested Solutions

Change const step = (max - min + 1) / data.length; in xychartDb.ts to const step = (max - min) / (data.length - 1);.

Additional Context

No response

@OG-NI OG-NI added Status: Triage Needs to be verified, categorized, etc Type: Bug / Error Something isn't working or is incorrect labels Jun 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Triage Needs to be verified, categorized, etc Type: Bug / Error Something isn't working or is incorrect
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant