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

Additional line segments drawn when gaps and min/max #8902

Closed
jledentu opened this issue Apr 15, 2021 · 2 comments · Fixed by #8911
Closed

Additional line segments drawn when gaps and min/max #8902

jledentu opened this issue Apr 15, 2021 · 2 comments · Fixed by #8911

Comments

@jledentu
Copy link

Hi, I've some issues when I apply min/max on X scale: on some datasets, additional line segments are drawn. I think this bug appears when there are "gaps" in the line, making the line split into several segments.

Expected Behavior

Given this chart if no min/max:

image

If I set min: 1, max: 3, I'd expect this:

image

Current Behavior

What I get:

image

Steps to Reproduce

https://codepen.io/jledentu/pen/GRrGWPg

Environment

  • Chart.js version: v3.1.0
  • Browser name and version: Firefox, Chrome...
@kurkle
Copy link
Member

kurkle commented Apr 15, 2021

This probably comes form #8844

No, same behavior with 3.0.2, so its older.

@jledentu
Copy link
Author

jledentu commented Apr 16, 2021

@kurkle I reproduced the bug with #7808 but not #7793, so I presume that #7808 introduced the bug.

Note that the issue then happens on animated charts. On un-animated charts (options.animation: false), the bug appeared later, on #8703.

So it seems to be related to this check in controller.line.js:

if (scaleRangesChanged(meta)) {
      start = 0;
      count = points.length;
}

where start and count (computed above with getStartAndCountOfVisiblePoints) are overridden. If I comment the 2 reassignments, it fixes the issue in my test. I don't know how to fix the bug by myself but I hope that these infos will help you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants