Skip to content

Commit 3b4b324

Browse files
committed
explicitly set figure height, for jupyterlab v4
1 parent 411d66a commit 3b4b324

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

Diff for: packages/javascript/jupyterlab-plotly/src/Figure.ts

+3
Original file line numberDiff line numberDiff line change
@@ -849,6 +849,9 @@ export class FigureView extends DOMWidgetView {
849849
// the model is not directly mutated by the Plotly.js library.
850850
var initialTraces = _.cloneDeep(this.model.get("_data"));
851851
var initialLayout = _.cloneDeep(this.model.get("_layout"));
852+
if (!initialLayout.height) {
853+
initialLayout.height = 360;
854+
}
852855
var config = this.model.get("_config");
853856
config.editSelection = false;
854857

Diff for: packages/javascript/jupyterlab-plotly/src/plotly-renderer.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -126,12 +126,16 @@ export class RenderedPlotly extends Widget implements IRenderMime.IRenderer {
126126
| any
127127
| IPlotlySpec;
128128

129+
if (!layout.height) {
130+
layout.height = 360;
131+
}
132+
129133
// Load plotly asynchronously
130134
const loadPlotly = async (): Promise<void> => {
131135
if (RenderedPlotly.Plotly === null) {
132136
RenderedPlotly.Plotly = await import("plotly.js/dist/plotly");
133137
RenderedPlotly._resolveLoadingPlotly();
134-
}
138+
}
135139
return RenderedPlotly.loadingPlotly;
136140
};
137141

Diff for: packages/javascript/jupyterlab-plotly/style/index.css

+1-6
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,7 @@
2121
overflow: hidden;
2222
}
2323

24-
/* Output styles */
25-
.jp-OutputArea .jp-RenderedPlotly {
26-
min-height: 360px;
27-
}
28-
2924
/* Document icon */
3025
.jp-PlotlyIcon {
3126
background-image: var(--jp-icon-plotly);
32-
}
27+
}

0 commit comments

Comments
 (0)