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

'Please set height and width for the chart element' on window resize #223

Open
daniel-halldorsson opened this issue May 30, 2016 · 2 comments

Comments

@daniel-halldorsson
Copy link

daniel-halldorsson commented May 30, 2016

charts is throwing this error whenever i resize my window.

angular.js:12477 Gracefully handling JS exception: "Error: Please set height and width for the chart element at validateHeightAndWidth (http://localhost:7002/bower_components/angular-charts.js:138:15) at init (http://localhost:7002/bower_components/angular-charts.js:117:14) at http://localhost:7002/bower_components/angular-charts.js:873:11 at http://localhost:7002/bower_components/angular.js:17855:31 at completeOutstandingRequest (http://localhost:7002/bower_components/angular.js:5507:10) at http://localhost:7002/bower_components/angular.js:5784:7", caused by: undefined

  • I have the height and width set for all charts via CSS
  • ive tried using waitForHeightAndWidth: false it still happens
  • it only happens when i resize brower window
  • angular v1.4.7 / angular charts v0.2.7 (installed via bower, my project bower says ^0.2.7 but the bower.json in the bower_components/angular-charts dir says v0.2.6, not sure what is correct)

cheers

@MaximilianLloyd
Copy link

I am getting the exact same issue, have you found a solution?

@fireworkstudio
Copy link

fireworkstudio commented Oct 8, 2016

@daniel-halldorsson @MaximilianLloyd
I add two scope variables in directive, and now it works. But this is not a final solution, I am still wait for official resolution.

  1. Add two scope variables in directive
    image
  2. Replace the places using element[0]'s width and height to new variables
    image
  3. In your view template, add new attributes
    image
  4. In your controller, define the values
    image

You may refer to codes of my project:
angular-charts.min.js
dashboard.html
dashboard-controller.js

Here is the screenshot, hope this method will help you solve the problem
image

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

No branches or pull requests

3 participants