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

Add auto-detect horizontal scrollbar to AppLayout #3184

Open
info-rchitect opened this issue Apr 19, 2021 · 2 comments
Open

Add auto-detect horizontal scrollbar to AppLayout #3184

info-rchitect opened this issue Apr 19, 2021 · 2 comments

Comments

@info-rchitect
Copy link

Problem

I use Plotly to create FigureWidgets that I interactively change using ipywidgets like IntSlider for changing the size of the FigureWidget. When the FigureWidget size gets to large horizontally, there is no way to scroll to the right to see what is not being displayed. I am displaying the FigureWidget within the context of an Output widget so I can control where it goes versus being displayed in the current Notebook cell.

Proposed Solution

Auto-detect if content in an Output widget requires a horizontal scrollbar.

Additional context

Here is a visual showing what is happening:

image

The Output widget is set to AppLayout.center and the Plotly figure widget is being displayed with that Output widgets as so:

        f_widget = go.FigureWidget(fig)
        self.visual_box = ipyw.Box([f_widget])
        with self.output_widget:
            display(self.visual_box)

I really can't tell if this is a limitation of the Output widget, the Box widget. or the AppLayout widget.

thx

@jtpio
Copy link
Member

jtpio commented Apr 22, 2021

Thanks @info-rchitect.

Out of curiosity, have you tried using some of the styling properties like overflow to see if it is being applied in that case? (mentioned in https://ipywidgets.readthedocs.io/en/stable/examples/Widget%20Styling.html)

@info-rchitect
Copy link
Author

@jtpio Thanks for the suggestion. I changed the Output and the Box widgets layout as so:

ipyw.Output(layout={'border': '1px solid black', 'width': '1600px', 'height': '100%', 'overflow': 'scroll', 'display': 'flex', 'flex_flow': 'row'})
ipyw.Box([f_widget], layout=ipyw.Layout(width='1600px', overflow='scroll', display= 'flex', flex_flow='row'))

This resulted in a scrollbar being present but it will only scroll to the size of the AppLayout center grid.

image

If I make the Output and Box widget sizes smaller (pixel-wise) I get more scroll bar but it always ends at the same place wrt to the size of the plotly chart inside of it. Do I need to enable the scrollbar on the AppLayout center grid? If so, how is that done?

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

No branches or pull requests

2 participants