ksNovember 2, 2016 at 7:37 am #6566
How do i make the graphs fit the size of the div they are placed in/ adapt to screen size, rather than statically setting the height and width?vizulyNovember 2, 2016 at 9:43 am #6568
SVG (which Vizuly and D3.js are based on) does not support dynamic sizing with percentages natively.
But, you could add an event listener to the browser window that responds to a resize event and use the current DIV height/width to reset the graph size appropriately. I have done this on many projects and I may consider adding a utility for this in the Vizuly library.
One thing to be mindful of, is that each time you resize a graph and call update() that it performs a full re-render, which can slow down the screen refresh. I usually will use a 50-150ms delay when capturing screen resize events to make sure I don’t constantly try to refresh the graph as the user is using their mouse to resize the screen.
I hope that helps.
– TomKSNovember 9, 2016 at 3:18 am #6620
Thanks a lot! that helps!
how to set dynamic size of a graph?
© 2017 — vizuly.io