Skip to content

Resize FigureWidget charts with their containers - #5926

Open
Boulea7 wants to merge 1 commit into
plotly:mainfrom
Boulea7:resize-attached-figurewidget
Open

Boulea7 wants to merge 1 commit into
plotly:mainfrom
Boulea7:resize-attached-figurewidget

Conversation

@Boulea7

@Boulea7 Boulea7 commented Dec 3, 2026

Copy link
Copy Markdown

Link to issue

Closes #5208.

Description of change

Observe the displayed FigureWidget element and resize the plot when its container changes. Fixed layout dimensions take precedence. Clearing a fixed dimension makes each view follow its own container again.

Demo

In the notebook from #5208, changing the VBox width and height produced these SVG sizes in JupyterLab 4.6.6.

VBox content area Plotly 5.24.1 Plotly 7.2.0 This change
496 × 596 496 × 596 700 × 360 496 × 596
316 × 406 316 × 406 700 × 360 316 × 406
716 × 516 716 × 516 700 × 360 716 × 516

At 316 × 406 the released widget clips two of the three points.

Plotly 7.2.0 This change
Only the first data point is visible inside the narrow VBox All three points fit inside the same VBox

Sankee pinned Plotly below 6 so its figure could continue to fit alongside the controls in its notebook widget. Downstream PR

Testing strategy

The browser regression renders the packaged widget in Chrome. It checks the SVG after a container resize and after clearing a fixed height, and checks that resizing alone leaves the widget model and undo history untouched. The core suite and this regression passed locally (471 passed, 1 skipped), and npm run build regenerated the widget bundle.

I also tested real JupyterLab kernels with one FigureWidget displayed at two different sizes. Both views retained their own dimensions after clearing a Python layout override.

Additional information

OpenAI Codex prepared and tested this PR. A second agent independently checked the behavior. The local notebook tests used macOS arm64 and Chromium 159. The separate npm run typecheck command stops on the existing moduleResolution: "node" setting with the locked TypeScript 7 compiler on both main and this branch.

Guidelines

This branch has not been deployed

No deployments
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

Successfully merging this pull request may close these issues.

Figure resizing with AnyWidget doesn't work as expected

1 participant