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

Resizing to screen size #550

Closed
ihabadly opened this issue Jan 14, 2017 · 15 comments · Fixed by #565
Closed

Resizing to screen size #550

ihabadly opened this issue Jan 14, 2017 · 15 comments · Fixed by #565

Comments

@ihabadly
Copy link

After updating to latest version the resizing to screen size is not working with normal bootstrap.css

Expected Behaviour

The chart in previous versions resizes according to screen size using typical bootstrap.css
After latest update, it only resizes if using bootstrap-combined.css

Current Behaviour

Resizing is not working

Possible Solution

Steps to Reproduce & Link to Example

  1. http://jsfiddle.net/pablojim/LnkgL135/

Context

Your Environment

  • Version used:
  • Browser Name and version:
  • Operating System and version (desktop or mobile):
  • Link to your project:
@parigi-n
Copy link

I had a lot of troubles with this too, and had to go back from 1.0 to 0.0.13 to fix it.
(Angular 1.5, latest angular-bootstrap and highcharts 5.0.6)

@bsalves
Copy link

bsalves commented Jan 18, 2017

I found a solution to resolve it. I added a simple timeout to process the constructor method as late possible at line 33 of highcharts-ng.js file. This worked for me.

@jaxoserina
Copy link

Hi brunowebdev,

would you be able to share your fix, please? I've encountered exactly the same issue and wondering if there's an easy fix.

Thanks

@matewilk
Copy link

+1

@i535489
Copy link

i535489 commented Jan 27, 2017

Hi,

The problem is coming when the code change from a directive to a component.

The reflow() function of Highcharts do not work because the code is not able to get the correct width and height of HTML element <highcharts> </highcharts>.
Previously the highcharts-ng directive replace the highcharts element by a div.

When Highcharts fail to detect the size, the chart is set to 600,400 even during a reflow().

@brunowebdev : I try your fix (c5295f5) but it fail under $doCheck method because under line 51 ctrl.chart is not defined due to the timeout.

@pablojim
Copy link
Owner

Hi, I'm looking into this. There is a css fix here: http://jsfiddle.net/pablojim/LnkgL135/48/

@i535489
Copy link

i535489 commented Jan 30, 2017

@pablojim : it works for me

@ihabadly
Copy link
Author

@pablojim : it works with me but I am stuck trying to enable animation with no luck.

@bsalves
Copy link

bsalves commented Jan 31, 2017 via email

@someone1
Copy link

someone1 commented Feb 3, 2017

None of the solutions here were working for me. I'm using highcharts-ng in a nested view with ui-router and angular material. I was able to get this working in my controller as follows:

function WidgetCtrl ($scope) {
        var vm = this;
        vm.highChartConfig = { ... };
        $scope.$on('$viewContentLoaded', 
            function () {
                vm.highChartConfig.getChartObj().reflow();
            }
        );
}

Kind of hacky but its working!

houssemba added a commit to houssemba/highcharts-ng that referenced this issue Mar 3, 2017
houssemba added a commit to houssemba/highcharts-ng that referenced this issue Mar 4, 2017
pablojim pushed a commit that referenced this issue Mar 5, 2017
)

fix resizing bug with bootstrap and angular material

- fixes #550
- fix(resize) : update readme and add a jsfiddle
- update repo url
@pablojim
Copy link
Owner

pablojim commented Mar 5, 2017

Hi all, @houssemba has committed a fix for this that has now been merged to master. Can you have a look to see if that solves your issue?

@dmak
Copy link

dmak commented Mar 7, 2017

I am not sure if I experience the same issue. I would like the chart to adapt to changing window width. In this example I have built two charts: the top one (vanilla Highcharts API) reacts correctly, but the bottom one has the fixed width all the time (expected that it extends/shrinks).

@houssemba
Copy link
Contributor

@dmak add display:block to your highchart style or include highcharts-ng.css file

@pablojim
Copy link
Owner

pablojim commented Mar 7, 2017

@dmak
Copy link

dmak commented Mar 7, 2017

@houssemba: Many thanks, it helped.

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

Successfully merging a pull request may close this issue.

10 participants