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

[BUG] Figures break inside Scrollbox if using frame_height or followed by div using stretch_width #13759

Open
solstag opened this issue Mar 12, 2024 · 1 comment
Labels

Comments

@solstag
Copy link
Contributor

solstag commented Mar 12, 2024

Software versions

Python version : 3.10.7 (main, Jan 1 1970, 00:00:01) [GCC 11.3.0]
IPython version : 8.5.0
Tornado version : 6.4
Bokeh version : 3.3.4
BokehJS static path : /home/user/.local/lib/python3.10/site-packages/bokeh/server/static
node.js version : (not installed)
npm version : (not installed)
jupyter_bokeh version : (not installed)
Operating system : Linux-6.6.18-x86_64-with-glibc2.35

Browser name and version

Firefox 123.0 (64-bit)

Jupyter notebook / Jupyter Lab version

No response

Expected behavior

Figure rendered with given frame_height.

Observed behavior

Figure appears squeezed vertically for tests 5 and 7

Example code

from bokeh import models as bkm
from bokeh import plotting as bkp
from bokeh import layouts as bkl

num = 0

# Fine
fig = bkp.figure(frame_height=150)
fig.line(list(range(10)), list(range(10)))
scr = bkm.ScrollBox(child=fig)
bkp.output_file(f"{num}_test_fig.html", mode="inline")
num += 1
bkp.save(scr)

# Put it in a column, fine
fig = bkp.figure(frame_height=150)
fig.line(list(range(10)), list(range(10)))
col = bkl.column(fig)
scr = bkm.ScrollBox(child=col)
bkp.output_file(f"{num}_test_col.html", mode="inline")
num += 1
bkp.save(scr)

# Add a short div, fine
fig = bkp.figure(frame_height=150)
fig.line(list(range(10)), list(range(10)))
div = bkm.Div(text="foo bar baz")
col = bkl.column(fig, div)
scr = bkm.ScrollBox(child=col)
bkp.output_file(f"{num}_test_col_with_short_div.html", mode="inline")
num += 1
bkp.save(scr)


# Add a height to Scrollbox (not scrolling), still fine
fig = bkp.figure(frame_height=150)
fig.line(list(range(10)), list(range(10)))
div = bkm.Div(text="foo bar baz")
col = bkl.column(fig, div)
scr = bkm.ScrollBox(child=col, height=500)
bkp.output_file(f"{num}_test_col_with_short_div_scr_height.html", mode="inline")
num += 1
bkp.save(scr)

# Add a long div, fine
fig = bkp.figure(frame_height=150)
fig.line(list(range(10)), list(range(10)))
div = bkm.Div(text="<br/>".join(100 * ["foo bar baz"]))
col = bkl.column(fig, div)
scr = bkm.ScrollBox(child=col)
bkp.output_file(f"{num}_test_col_with_long_div.html", mode="inline")
num += 1
bkp.save(scr)

# Add a height to Scrollbox (scrolling), and it breaks
fig = bkp.figure(frame_height=150)
fig.line(list(range(10)), list(range(10)))
div = bkm.Div(text="<br/>".join(100 * ["foo bar baz"]))
col = bkl.column(fig, div)
scr = bkm.ScrollBox(child=col, height=500)
bkp.output_file(f"{num}_test_col_with_long_div_scr_height.html", mode="inline")
num += 1
bkp.save(scr)

# Replace frame_height by sizing_mode 'stretch_both', fine
fig = bkp.figure(sizing_mode="stretch_both")
fig.line(list(range(10)), list(range(10)))
div = bkm.Div(text="<br/>".join(100 * ["foo bar baz"]), sizing_mode="stretch_both")
col = bkl.column(fig, div, sizing_mode="stretch_both")
scr = bkm.ScrollBox(child=col, height=500, sizing_mode="stretch_both")
bkp.output_file(f"{num}_test_sm_col_with_long_div_scr_height.html", mode="inline")
num += 1
bkp.save(scr)

# Replace frame_height by sizing_mode but give the div a 'stretch_width', and it breaks
fig = bkp.figure(sizing_mode="stretch_both")
fig.line(list(range(10)), list(range(10)))
div = bkm.Div(text="<br/>".join(100 * ["foo bar baz"]), sizing_mode="stretch_width")
col = bkl.column(fig, div, sizing_mode="stretch_both")
scr = bkm.ScrollBox(child=col, height=500, sizing_mode="stretch_both")
bkp.output_file(f"{num}_test_sm_divsw_col_with_long_div_scr_height.html", mode="inline")
num += 1
bkp.save(scr)

Stack traceback or browser console output

No response

Screenshots

No response

@solstag solstag added the TRIAGE label Mar 12, 2024
@solstag
Copy link
Contributor Author

solstag commented Mar 13, 2024

EDIT: I started fresh and could only reproduce problem in test 5, the others work fine now.
EDIT2: Found another case where output is squeezed without setting frame_height.

@solstag solstag changed the title [BUG] Figures break inside Scrollbox if frame_height is set [BUG] Figures break inside Scrollbox if using frame_height or followed by div using stretch_width Mar 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant