How to make an embedded dashboard chart 100% height responsive (react-grid-layout limitation) #40666
Replies: 1 comment
-
|
Hi @Cunec! I'm Dosu and I'm helping the Apache Superset team. Great write-up of the problem. Here's what I found regarding your three questions: 1. No official workaround for true 100vh responsive height Superset's dashboard grid uses a custom system where chart heights are pre-calculated from metadata using a fixed formula [1]: chartHeight = Math.floor(component.meta.height * GRID_BASE_UNIT - CHART_MARGIN)These pixel heights are then propagated down through The one scenario where viewport-based sizing kicks in is full-size chart mode (the "maximize" feature), which uses A potential workaround: The embedded SDK exposes a 2. Single chart embedding is actively in development PR #36933 proposes adding embeddable charts with guest token authentication. It includes:
This would solve your problem cleanly since the Explore view uses flexbox-based responsive layout. However, it hasn't been merged yet. 3. Best practice for now Given the current limitations, your best options are:
Recent merged work like PR #38351 (box-sizing reset for embedded layouts) shows the team is actively improving the embedded experience, but true responsive height for grid-based dashboards would require a significant architectural change to the height calculation system. To reply, just mention @dosu. Docs are dead. Just use Dosu. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello Superset community,
We are currently building a web application using Vue 3 and embedding Superset (v6.1.0) using the official @superset-ui/embedded-sdk. We are trying to embed a single Deck.gl chart (Scatter/Heatmap) that fills the entire viewport (100vw and 100vh) responsively.
The Problem: Because @superset-ui/embedded-sdk only supports embedding Dashboards (embedDashboard()) and not individual charts, we are forced to place our single chart inside a dashboard grid. While the width of the chart is perfectly responsive (as react-grid-layout recalculates column widths on window resize), the height is fixed based on the configured grid rows.
When a user resizes the browser vertically or zooms out (e.g., to 75%), the chart's height remains fixed at its computed pixel value (e.g., 1600px). This causes either:
What we've tried: We attempted to force responsiveness via custom CSS injection:
.react-grid-layout, .react-grid-item, .slice_container, .deckgl-overlay { height: 100vh !important; }However, this workaround is incomplete. Because Superset passes explicit pixel height props down to the chart component based on the grid layout, the Deck.gl component eventually renders explicit attributes. Forcing CSS height on the canvas causes WebGL distortion, and AutoSizer doesn't seem to recalculate the height automatically when overriding .react-grid-item.
My Questions:
Any guidance or hints would be greatly appreciated!
Beta Was this translation helpful? Give feedback.
All reactions