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

some kind resize(width, height) API #36

Closed
danyalejandro opened this issue Oct 28, 2019 · 5 comments
Closed

some kind resize(width, height) API #36

danyalejandro opened this issue Oct 28, 2019 · 5 comments
Labels
feature New feature or request
Milestone

Comments

@danyalejandro
Copy link

danyalejandro commented Oct 28, 2019

Use case: Our sensor dashboards are shared by a team of 7 scientists. Some of them have their screens rotated (portrait). They both want to maximize screen usage without changing the code.

Would it be possible to add a "stretch to fit" option?

image

image

@leeoniya
Copy link
Owner

leeoniya commented Oct 28, 2019

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.

@danyalejandro
Copy link
Author

danyalejandro commented Oct 28, 2019 via email

@leeoniya leeoniya changed the title Feature request: Fit width of container some kind resize(widh, height) API Oct 30, 2019
@leeoniya leeoniya added the feature New feature or request label Oct 30, 2019
@leeoniya leeoniya changed the title some kind resize(widh, height) API some kind resize(width, height) API Oct 30, 2019
@leeoniya leeoniya added this to the 1.0.0 milestone Nov 5, 2019
@leeoniya leeoniya modified the milestones: 1.0.0, 1.5.0 Nov 21, 2019
@ldstein ldstein mentioned this issue Jan 23, 2020
@leeoniya leeoniya modified the milestones: 1.5.0, 1.0.0 Jan 28, 2020
@leeoniya
Copy link
Owner

this is now available as .setSize({width, height})

@mfiot-rm
Copy link

mfiot-rm commented Sep 3, 2021

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.
image

Am I using the setSize wrong does it need some sort of redraw or update after?

@leeoniya
Copy link
Owner

leeoniya commented Sep 3, 2021

Am I using the setSize wrong

yes, it takes a single {width: ..., height: ...} object, not two arguments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants