Code Monkey home page Code Monkey logo

Comments (6)

jhonnymertz avatar jhonnymertz commented on May 18, 2024 1

You're right. Both ng-show and ng-hide change the visibility via display css property (display: none). But with this approach, Highcharts is unable to get the true width and height of the element.

So, now I think it's not a highcharts-ng problem, since it's a default behavior of Highcharts.

A good option to avoid this issue, can be using ngIf directive instead of ngShow or ngHide. This directive was released in AngularJS 1.1.5 and differs from the others since completely removes and recreates the element in the DOM rather than changing its visibility via css.

Same previous example with version 1.2.1 of AngularJS and using the ng-if directive: http://jsfiddle.net/Hjdnw/102/

Thanks

from highcharts-ng.

jhonnymertz avatar jhonnymertz commented on May 18, 2024

Similar issue for me. When the chart starts hidden and then is showed by an event, it assumes a default size. Only after resizing the page, the chart is updated according to window.

Simple example: http://jsfiddle.net/Hjdnw/101/
Observe the chart size when show button is clicked and after adjust the page size.

Thanks

from highcharts-ng.

pablojim avatar pablojim commented on May 18, 2024

I think the problem is that the chart is created and as the div is invisible highcharts can't determine the size of the div so it defaults to 600x400

Then when the div is shown the chart. The chart does not reflow. Maybe we could add a event listener into the chart which would trigger a chart.reflow(). The events could then be triggered manually.

from highcharts-ng.

nissoh avatar nissoh commented on May 18, 2024

@jhonnymertz have you solved this issue yet?

i'm having the same issue with DOM recreation. i don't see any graph being drawn. i'm completely stuck ):

from highcharts-ng.

pablojim avatar pablojim commented on May 18, 2024

There is now an event listener for triggering a reflow of the chart. I think manually triggering this should be a workaround to this issue.

from highcharts-ng.

nissoh avatar nissoh commented on May 18, 2024

hey @pablojim there is still an issue with chart recreation as seen in @jhonnymertz fiddle.

from highcharts-ng.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.