-
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
Responsive in combination with bootstrap collapse #762
Comments
👍 |
@reinvanleirsberghe Can you please create a JSbin showing this issue? |
someone reach the solution for this problem? |
Hello, |
Is there any solution for this problem please ? |
No real solution as yet. It's not really a bug though, as it is calculated using its container div, which has height of 0. I managed to get around it by having an invisible container (the same width as the container), that is always displayed. I can then edit the resize function to calculate based on this div. clunky but it works. |
Could you maybe give a example of your code ? it will be nice of you :) |
snippet here... |
thx a lot for the snippet :) cya. |
Thanks for the hack. [edit] So this didn't quite work as intended, it fully overrode the size of the chart which changes depending on labels, etc. that are added, so my chart was cut off. The only thing that worked was using setTimeout to delay the chart creation after the canvas tag is rendered, since it seems like there is some time required for the tag to have a "true" size. Of course, this is not ideal at all, and the chart will fail to load on slow computers since this is a race between the canvas being ready and the timer starting. Not to mention the additional lag apparent to the user incurred by the timeout. |
I think I found something. In Chart.JS (I'm with Version 1.0.2), modify (old are in comments): |
The good news is that this has been fixed in version 2. We can back-port the fix to v1 if necessary since it should only involve the resize handler. |
Here's a Plnkr showing some of these issues working with bootstrap and angular. There's some disparity between the way this renders in Plunker vs. my ASP.NET MVC solution that integrates the same angular code. I'll outline some of the issues and details below:
|
V2 has been released and this is fixed there. See https://jsfiddle.net/1cm1wo8t/ |
I just pulled in the latest version of Chart js (v2) by cloning the Repo, and this does not look to be fixed. Chart within Bootstrap carousel is not getting correct height and width. Ended up rolling back to old version and using @gabrousseau26's hack/fix. |
@aholtventuretech: can you provide a fiddle showing the broken setup? |
@derekperkins @aholtventuretech: it works fine for me in bootstrap carousel. |
Fiddle showing it working in bootstrap is: https://jsfiddle.net/cbybvww8/1/ |
Hitting this problem with v2.1.3, Bootstrap v3.3.6. I have 4 Polar Charts side-by-side in responsive containers. Not using a carousel, so will try to get a fiddle up and running |
I'm still getting this problem. |
This still occurs if |
@mbogochow If you know how tall you want it to be you can just set the height of the canvas manually after rendering the chart. Worked in my case.
|
Another hacky fix that worked for me for the display none to block issue.. |
This does still appear to be a bug in the latest version still but setting |
Using vue-chartjs wrapper and having this exact same issue. Still not fixed. Temporary fixed it by adding |
It works. confirm. |
When a chart is placed inside the collapse option of bootstrap with the responsive to true, it is not showing.
Only when you resize the screen, the chart pops up
The text was updated successfully, but these errors were encountered: