Skip to content

Commit 0db7b0d

Browse files
Merge pull request #47 from keitaroinc/fix/charts-plotly-height-collapse
Fix ckanext-charts Plotly/Observable charts collapsing to a thin strip
2 parents 87fcb2f + b0ed5cb commit 0db7b0d

1 file changed

Lines changed: 32 additions & 0 deletions

File tree

ckanext/iaea/assets/css/custom.css

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,4 +213,36 @@
213213
page. */
214214
.module-content:has(> .accordion) {
215215
display: none;
216+
}
217+
218+
/* ckanext-charts renders its chart-config form with Bootstrap 5 tab markup:
219+
the active pane is <div class="tab-pane fade show active">. This theme ships
220+
Bootstrap 3 CSS, which reveals faded elements with .in (not .show) and treats
221+
.show as a plain display utility. So on the charts form .fade pins the active
222+
pane to opacity:0 while .active still displays it (via ".tab-content > .active"),
223+
leaving the whole form invisible — the fields occupy layout space but are fully
224+
transparent, and the chart preview below them ends up dangling at the bottom of
225+
the page. Bootstrap 5 JS (loaded by CKAN core) toggles .show/.active correctly
226+
on tab switch, so restoring opacity on the shown pane is all that's needed. */
227+
.charts-view--form .tab-pane.active,
228+
.charts-view--form .tab-pane.show {
229+
opacity: 1;
230+
}
231+
232+
/* ckanext-charts Plotly/Observable charts collapse to a thin strip (only the
233+
axis renders). ckanext-charts names its graph div ".chart-container" and gives
234+
it only "max-height: 600px" (no height), relying on Plotly's autosize: an empty
235+
div reports getComputedStyle().height == "0px", so Plotly falls back to the
236+
max-height (600px). But this theme bundles ckanext-visualize's visualize_main.css,
237+
whose GLOBAL ".chart-container { padding: 1rem }" gives the empty div a nonzero
238+
computed height (~32px). Plotly's autosize reads that height first
239+
(getComputedSize(height) || getComputedSize(maxHeight) || layout.height), so the
240+
whole chart is drawn 32px tall. ECharts is immune (inline height:600px, no
241+
.chart-container class); chartjs uses a <canvas>. Pin the div-based engines
242+
(Plotly, Observable) to an explicit height so autosize gets a real value
243+
regardless of the inherited padding (box-sizing:border-box makes padding harmless). */
244+
.resource-view-charts_view div.chart-container,
245+
.resource-view-charts_builder_view div.chart-container,
246+
#content div.charts-view div.chart-container {
247+
height: 600px;
216248
}

0 commit comments

Comments
 (0)