fix: scale exploration plot height dynamically with facet count#1284
Draft
Gero1999 wants to merge 2 commits into
Draft
fix: scale exploration plot height dynamically with facet count#1284Gero1999 wants to merge 2 commits into
Gero1999 wants to merge 2 commits into
Conversation
Plots with many facet panels (e.g. facet by USUBJID) had middle rows shrunk because the container used a fixed viewport height. Now the plotly height scales with the number of facet rows (300px per row, min 500px). Containers switched to fillable=FALSE so large plots scroll instead of compressing. Co-authored-by: Ona <no-reply@ona.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue
Closes #1283
Description
When faceting exploration plots by a variable with many levels (e.g. USUBJID), the subplots in the middle rows shrink and become unreadable. This happened because the plot container used a fixed viewport height (
height = \"90vh\",fillable = TRUE) andplotlyOutput(height = \"100%\")— plotly tried to fit all panels within that fixed space.Changes:
.facet_plot_height()helper that computes a dynamic pixel height based on the number of facet panels (300px per row, minimum 500px). ReturnsNULLfor plots with ≤4 panels so small plots are unaffected.renderPlotlycalls.layout_sidebarcontainers fromfillable = TRUEtofillable = FALSEand removedheight = \"100%\"fromplotlyOutput, so large faceted plots extend beyond the viewport and scroll naturally.Definition of Done
How to test
Contributor checklist
.scsschange was done, rundata-raw/compile_css.RNotes to reviewer
.facet_plot_height()helper usesp$facetandp$datato count panels without re-querying the data. It only activates forFacetWrapwith >4 panels.qc_plot.R) already uses a similar dynamic height pattern but computes it differently (based on subjects × groups). This helper is simpler since it only needs the facet panel count.fillable = FALSEchanges the layout behavior — the plot area now scrolls independently. Worth testing that sidebar interactions (zoom, hover) still work correctly with the scrollable container.