Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angular nvd3 Line Chart automatic resizing

I'm using angular nvd3 directives.

according to the exemple :https://github.com/angularjs-nvd3-directives/angularjs-nvd3-directives/blob/master/examples/lineChart.with.automatic.resize.html

<!--
width and height are removed from the directive for automatic resizing.
-->

Well, if I change The Div size of the graph. it resize but only when I move/open/close the 'console view' (ctrl + shift + i on FF).

I check on angular-nvd3-directive, There is no event call for the resize, so I suppose it's a d3/nvd3 comportement?

My question so far: How to simulate this kind of event for the graph to resize?

like image 462
ssbb Avatar asked Jun 30 '15 13:06

ssbb


1 Answers

You could try firing another resize event which could repaint the graph. window.dispatchEvent(new Event('resize'));

A similar approach worked for me with Chart.js. It's odd when the console being visible changes the page - still don't fully understand how that works but it shows up regularly with dynamic layouts.

like image 183
Dylan Valade Avatar answered Oct 02 '22 18:10

Dylan Valade