some kind resize(width, height) API
danyalejandro opened this issue · comments
i would recommend that you first measure the size of the container you intend to put the charts into using something like element.getBoundingClientRect() and use those metrics to create the uPlot instances.
i have no plans to implement auto or fluid sizing in the core, since most of this can be handled outside the lib. and most of the time is not necessary after initial render anyhow.
if you need to resize the plots after initial render. i can maybe add a .resize(width, height)
method so you can use that after init.
this is now available as .setSize({width, height})
So I have an event listener and at certain break points I run:
size = document.getElementById("chart-wrap").getBoundingClientRect()
uplotD.setSize(size.width,size.height)
But the plot sorta disappears whenever the size is update.
Am I using the setSize wrong does it need some sort of redraw or update after?
Am I using the setSize wrong
yes, it takes a single {width: ..., height: ...}
object, not two arguments.