-
Notifications
You must be signed in to change notification settings - Fork 0
Instructions for fullsize plots #4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
06271d9
include scaffolding for toggling full size plots
8d3eaeb
include revision log and text on landing page
40e1408
include Introduction page
b0225fc
pr comments small fixes
3d1d323
Potential fix for pull request finding
anna-follestad-4ss a874ad9
Potential fix for pull request finding
anna-follestad-4ss bba0d46
black
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| // Fullscreen toggle for chart visuals. See the "Fullscreen Toggle Pattern" | ||
| // section in CLAUDE.md for the required markup and the reasoning behind | ||
| // this approach. | ||
| // | ||
| // Event delegation (rather than per-chart wiring) so this survives | ||
| // dcc.Loading re-rendering the DOM, and applies automatically to any | ||
| // current or future chart that follows the markup pattern. | ||
|
|
||
| function resizeGraphsIn(container) { | ||
| if (!window.Plotly) return; | ||
| container.querySelectorAll(".graph-wrap").forEach(function (wrap) { | ||
| const gd = wrap.querySelector(".js-plotly-plot"); | ||
| if (!gd) return; | ||
| const rect = wrap.getBoundingClientRect(); | ||
| const width = Math.round(rect.width); | ||
| const height = Math.round(rect.height); | ||
| if (width > 0 && height > 0) { | ||
| window.Plotly.relayout(gd, { width: width, height: height, autosize: false }); | ||
| } | ||
| }); | ||
| } | ||
|
|
||
| function settleResize(visual) { | ||
| requestAnimationFrame(function () { | ||
| resizeGraphsIn(visual); | ||
| setTimeout(function () { resizeGraphsIn(visual); }, 100); | ||
| }); | ||
| } | ||
|
|
||
| function exitFullscreen(visual) { | ||
| visual.classList.remove("visual--fullscreen"); | ||
| document.body.classList.remove("fullscreen-active"); | ||
| settleResize(visual); | ||
| } | ||
|
|
||
| function enterFullscreen(visual) { | ||
| document.querySelectorAll(".visual--fullscreen").forEach(function (el) { | ||
| el.classList.remove("visual--fullscreen"); | ||
| }); | ||
| visual.classList.add("visual--fullscreen"); | ||
| document.body.classList.add("fullscreen-active"); | ||
| settleResize(visual); | ||
| } | ||
|
anna-follestad-4ss marked this conversation as resolved.
|
||
|
|
||
| document.addEventListener("click", function (event) { | ||
| const btn = event.target.closest(".fullscreen-toggle-btn"); | ||
| if (!btn) return; | ||
| const visual = btn.closest(".visual"); | ||
| if (!visual) return; | ||
| if (visual.classList.contains("visual--fullscreen")) { | ||
| exitFullscreen(visual); | ||
| } else { | ||
| enterFullscreen(visual); | ||
| } | ||
| }); | ||
|
|
||
| document.addEventListener("keydown", function (event) { | ||
| if (event.key !== "Escape") return; | ||
| const visual = document.querySelector(".visual--fullscreen"); | ||
| if (visual) exitFullscreen(visual); | ||
| }); | ||
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.