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

[BUG]Infinite loop when canvas width = 0 and padding > 0 #5047

Closed
fanthos opened this issue Dec 15, 2017 · 4 comments
Closed

[BUG]Infinite loop when canvas width = 0 and padding > 0 #5047

fanthos opened this issue Dec 15, 2017 · 4 comments

Comments

@fanthos
Copy link
Contributor

fanthos commented Dec 15, 2017

When the canvas width is smaller than padding left and right, results chartWidth and chartAreaWidth at Chart.js#6221 negative number, causes infinite loop when calculating axis.

// Step 1
var chartWidth = width - leftPadding - rightPadding;
var chartHeight = height - topPadding - bottomPadding;
var chartAreaWidth = chartWidth / 2; // min 50%
var chartAreaHeight = chartHeight / 2; // min 50%

Solution:
Check width and height are positive or 0 before update the chart.

fanthos added a commit to fanthos/Chart.js that referenced this issue Dec 15, 2017
fanthos added a commit to fanthos/Chart.js that referenced this issue Dec 15, 2017
@jcopperfield
Copy link
Contributor

@fanthos for which type of axis is the infinite loop caused?

@fanthos
Copy link
Contributor Author

fanthos commented Dec 15, 2017

I am using TimeScale on both x and y on CodePen.
https://codepen.io/fanthos/pen/rpVXpo
https://codepen.io/fanthos/pen/rpVXpo?turn_off_js=true

@jcopperfield
Copy link
Contributor

This has already been addressed with the following merge f9beedb

@etimberg
Copy link
Member

Closing as resolved per the discussion above. Will release in 2.7.2

@etimberg etimberg added this to the Version 2.7.2 milestone Jan 18, 2018
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.

3 participants