-
Notifications
You must be signed in to change notification settings - Fork 11.9k
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
Chart inside bootstrap 'collapse' element #4968
Conversation
When chart is inside a bootstrap 'collapse' element the width and height are zero and the chart 'draw' function throws an IndexSizeError because the outer/inner radius are computed using a zero width/height and when subtracting padding it results in a negative value. When element is collapsed it does not show anyway so adding Math.abs() to the radius will have no effect on the drawing itself but will eliminate the error.
@zoharshavit is there an open issue or reproduce for this issue? Also, can you combine #4969 and #4970 into a single PR? |
@etimberg i was fixing an issue that i encountered, not an open issue, How do i combine 3 commits into one pull request? I'm really new to this, sorry... |
I agree with @etimberg, you can push all your changes to your
A better fix would be:
We should also sanitize those sizes:
|
Added the other commits to this pull request and canceled them. |
As for @simonbrunel's other comments: |
I agree with @simonbrunel that the layout code should sanitize size. if (newWidth === 0 || newHeight === 0) {
return;
} Otherwise I think it would be better to sanitize the |
@zoharshavit will you be able to respond to the latest comments on this PR? |
@benmccann I have responded to the best of my knowlage, and offered a fix as I understand it. |
Thanks for replying. I think we're unlikely to proceed with this PR given it's current state. We'd be happy to accept a fix with the given suggestions, so feel free to reopen if you update with the changes. I'm not sure that anyone will fix the issue otherwise since there are currently hundreds of open issues in the issue tracker to address |
When chart is inside a bootstrap 'collapse' element the width and height are zero and the chart 'draw' function throws an IndexSizeError because the outer/inner radius are computed using a zero width/height and when subtracting padding it results in a negative value.
When element is collapsed it does not show anyway so adding Math.abs() to the radius will have no effect on the drawing itself but will eliminate the error.
here is a jsFiddle to demonstrate the issue https://jsfiddle.net/4s09skz9