-
Notifications
You must be signed in to change notification settings - Fork 118
Plot not filling the height of the container/screen. #240
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
Comments
Hi @jdbosser! One way to solve it is by setting the
|
This is definitely a solution! I will use it for development. Thank you! More broadly though: In this case, the plots would not scale with the size of the screen. Since plotly is scaling with the width of the screen, and not the height, I interpret that this is intentional. Is this a correct interpretation? If that is the case, you may close this issue. Otherwise, given that you already have scaling with the width, I would suggest that plots are adaptive to the height as well. At least, I kind of expected them to be adaptive, hence I interpreted it as an error. Are there any drawbacks associated with the fix I suggested to the template? |
@jdbosser Actually, sorry, there is a correct way, it escaped me when I wrote the first response. It was basically discussed here in #228 The correct way is to do
The above one liner should address your concerns.
Only one I can think of is if you have multiple plots in the same HTML file. Filling in the entire page with a single plot might not be the thing you want/expect, as you want to show multiple plots. If the above is still not solving your issue, let's discuss further. If it is the solution you were looking for, feel free to close the issue. |
@jdbosser, feel free to reopen the issue if the the oneliner is not satisfactory for you. |
Hi! I am just getting started with plotly. I am using the example from the book. . I have modified the example to output an HTML file in
out.html
.Here is the code
Here is the
Cargo.toml
This produces this result in chromium (Version 130.0.6723.69 (Official Build) snap (64-bit)), as seen in the screenshot.

It is rendered similarly in Firefox.
My problem is that I want it to extend to the whole height of the screen. I have tried to modify the plotly code to include
as per suggestions in forums [1][2]
Yet, it did not scale as it should.
I found a comment suggesting to make sure that the parent is 100% . Indeed, modifying the inline CSS in the browser produces a correct plot. See the attached screenshot.

I have noticed that
html
,body
, and the firstdiv
in the body all need this property set for it to work. Note that, I seem to need to resize the window or interact with the plot for the changes to take effect.I am a bit skeptical though. I found no comments in this repository about people having this issue. I cannot imagine I am the first one, since I stumbled upon it as I was testing my first example. I rather assume I am doing something wrong. If so, can someone give me some guidance and/or update (or help me update) the docs? Alternatively, the behavior is intentional. In that case, would it be possible to include an option to opt out of the limited height?
If this truly is an error, then I have noticed that the fix should be to implement the styling in
plot.html
-template. . I can contribute with a PR if this is the right way to solve this issue.Thank you for a nice crate! It seems well put together and I look very much forward to using it!
The text was updated successfully, but these errors were encountered: