-
Notifications
You must be signed in to change notification settings - Fork 462
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
Sometimes the chart doesn't fit the parent element's size #300
Comments
I managed to fix this by broadcasting the reflow event. But despite this fact, I think this could be handled automatically by the library. Triggering an event this way seemed a little hacky to me. What do you think? |
Same as #211? |
I tried this #211 but it didnt work. |
I've got the same problem with charts within a bootstrap container initially sized to full window width. Broadcasting the reflow event as suggested in #211 didn't work, either. When the chart is rendered initially, the .highcharts-container element shows the full width. After resizing it properly adjusts to the container div's width. I guess it would solve the problem if I explicitly set the width of the parent div (I've read recently about a general issue with propagating computed widths to injected child elements, but can't remember where), but I'm placing charts dynamically in variable width container widgets. So it seems that the container's computed width is not yet set when the chart is rendered or it's not transferred correctly. @pablojim Barry, any idea how to solve this in a sustainable way? |
Could you make a fiddle? |
Sure, i'll notify you when ready
|
@pablojim Plunkr demonstrating the issue is ready under http://plnkr.co/edit/OJWhXyUIeyNnYD0qdq0A |
Not a complete fix but... http://plnkr.co/edit/PwkHRJtsMXlxG9UMXJol?p=preview See: http://stackoverflow.com/questions/17301572/angularjs-evalasync-vs-timeout and http://stackoverflow.com/questions/17225106/anyway-to-trigger-a-method-when-angular-is-done-adding-scope-updates-to-the-dom/17239084#17239084 So maybe we need a callback from the directive to execute after the DOM changes are made? Pull requests accepted! |
Great, that worked. Actually, I tried that before, but didn't realize that I would have to inject the dependency for $timeout (didn't look twice and thought it's a plain Javascript timeout). Thx a lot for your prompt reply and the fix. |
No problem. Could you add an entry to the faq in the main readme? |
Done |
I'm using $ionicSideMenuDelegate (Ionic framework) and by resizing the window, the chart width is not correct. I made a codepen: http://codepen.io/anon/pen/OVPRrx How to fix that? |
HI, |
Hello everybody, |
Should we open a new issue for the above question about how to get the initial animation back? I'd like to know the answer too. |
i'm using ng-if, and when the ng-if goes true to show the chart, it gets displayed with a wrong size, i need to resize window to make it behave as intended. It would be nice to have that handled somehow... |
I have fixed this by making the chart data available a bit after the page is loaded. This way the containers get setup first. Then the chart is loaded, this way the proper size is already available to highCharts and everything works as expected (including animations)
In my template i simple use |
This did the trick for me instead of using $timeout. I guess it all depends on when you display and render your data
|
@mendaomn : Even I am facing the same issue. Initially when I use reflow the chart does not animate. For all the subsequent times I can see the animation. Did you get any solution for this ? |
As florisb mentioned the solution worked me... thanks guys.. |
Is there any option I can use to stop the chart from redrawing when I update the chart? In my case, I want to dynamically update the title of chart when exporting. The whole chart gets redrawn every time i change the chart title. |
see #550 |
I'm having a problem adding a chart into a fluid div. It doesn't fit the size of the chart's parent div, and it overflows it instead, like this:
If I keep refreshing the page, eventually it will work, showing the chart correctly:
I later discovered that if I resized the browser, the chart will then be displayed correctly, regardless of the resolution I choose, so the problem only occurs on the first load. Another test I did was to remove the chartConfig object, passing an empty object instead, but it didn't help as well.
I'm using bootrstrap, with a markup similar to this:
Also, I'm using latest Angular, Highstock (with standalone adapter) and Highcharts-ng. I tried switching to Highcharts, but no help.
Could this be a bug?
The text was updated successfully, but these errors were encountered: