-
Notifications
You must be signed in to change notification settings - Fork 9
Option to show scatterplot density layers as grid rather than layers on same plot #459
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
Open
xinaesthete
wants to merge
16
commits into
main
Choose a base branch
from
codex/chart-array
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
0275c14
Add density grid mode for contour scatter charts
xinaesthete 404abe2
dragPan on all grid elements
xinaesthete 4d3cb42
Add support for density grid mode in selection overlay and related co…
xinaesthete 0890a45
Add useFieldContour hook and integrate visible field indices in DeckD…
xinaesthete f8691ec
Add ChartArrayLayout component and related utilities for grid-based c…
xinaesthete 2d13257
Make sure deck canvas grid renders with devicePixel resolution
xinaesthete 3ddcafe
fix bugs with scatter-state when adjusting parameters, particularly i…
xinaesthete 67131e1
Add chart array grid utilities and integrate density grid support in viv
xinaesthete 1ae95d7
Refactor chart array layout and introduce new utilities for responsiv…
xinaesthete 6105011
fix bug with mouse-event rebinding betwen grid/layer mode
xinaesthete 80541fb
Improve density grid functionality and mouse event handling
xinaesthete 54d6d79
update agents instruction to not ignore biome and related comments
xinaesthete 8bb9417
add jscheck script for biome without write
xinaesthete 44967b1
fix bug with rebinding mouse events during edit operation.
xinaesthete c123016
avoid duplicating gate layers
xinaesthete 750eccd
generalise layer scope logic
xinaesthete 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -972,4 +972,4 @@ select, input, textarea { | |
| width: 1em; | ||
| height: 1em; | ||
| } | ||
| } | ||
| } | ||
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,103 @@ | ||
| /** | ||
| * Multi-chart layout shell (density grid and similar). Layout modes, flex/grid CSS, and | ||
| * resize measurement are an initial prototype — not a stable API; expect rework for | ||
| * user-configurable layouts and context-specific arrangements. | ||
| */ | ||
| import { | ||
| useCallback, | ||
| useImperativeHandle, | ||
| useRef, | ||
| type CSSProperties, | ||
| type ReactNode, | ||
| type Ref, | ||
| } from "react"; | ||
| import "./chartArrayLayout.css"; | ||
| import { | ||
| getChartArrayLayoutMode, | ||
| type ChartArrayLayoutMode, | ||
| } from "./chartArrayLayoutUtils"; | ||
| import { useChartArrayLayoutGeometry } from "../hooks/useChartArrayLayoutGeometry"; | ||
|
|
||
| export type ChartArrayLayoutHandle = { | ||
| root: HTMLDivElement | null; | ||
| cells: readonly (HTMLDivElement | null)[]; | ||
| }; | ||
|
|
||
| type ChartArrayLayoutProps = { | ||
| cellCount: number; | ||
| cellKeys?: readonly string[]; | ||
| /** Defaults from {@link getChartArrayLayoutMode}; override for future user layout prefs. */ | ||
| layout?: ChartArrayLayoutMode; | ||
| layoutRef?: Ref<ChartArrayLayoutHandle>; | ||
| className?: string; | ||
| style?: CSSProperties; | ||
| /** Shared-canvas layer (e.g. DeckGL) sized to the grid root via CSS. */ | ||
| canvasOverlay?: ReactNode; | ||
| renderCell: (index: number) => ReactNode; | ||
| }; | ||
|
|
||
| export default function ChartArrayLayout({ | ||
| cellCount, | ||
| cellKeys, | ||
| layout, | ||
| layoutRef, | ||
| className, | ||
| style, | ||
| canvasOverlay, | ||
| renderCell, | ||
| }: ChartArrayLayoutProps) { | ||
| const layoutMode = layout ?? getChartArrayLayoutMode(cellCount); | ||
| const rootRef = useRef<HTMLDivElement>(null); | ||
| const { gridFillsViewport, gridColumns } = useChartArrayLayoutGeometry( | ||
| rootRef, | ||
| cellCount, | ||
| layoutMode, | ||
| ); | ||
| const cellRefs = useRef<(HTMLDivElement | null)[]>([]); | ||
|
|
||
| const setCellRef = useCallback((index: number, element: HTMLDivElement | null) => { | ||
| cellRefs.current[index] = element; | ||
| }, []); | ||
|
|
||
| useImperativeHandle( | ||
| layoutRef, | ||
| () => ({ | ||
| get root() { | ||
| return rootRef.current; | ||
| }, | ||
| get cells() { | ||
| return cellRefs.current; | ||
| }, | ||
| }), | ||
| [], | ||
| ); | ||
|
|
||
| return ( | ||
| <div | ||
| ref={rootRef} | ||
| className={["mdv-chart-array", className].filter(Boolean).join(" ")} | ||
| data-layout={layoutMode} | ||
| data-grid-fill={layoutMode === "grid" && gridFillsViewport ? "true" : undefined} | ||
| style={ | ||
| layoutMode === "grid" | ||
| ? { | ||
| ...style, | ||
| ["--mdv-chart-array-columns" as string]: String(gridColumns), | ||
| } | ||
| : style | ||
| } | ||
| > | ||
| {canvasOverlay ? <div className="mdv-chart-array__canvas">{canvasOverlay}</div> : null} | ||
| {Array.from({ length: cellCount }, (_, index) => ( | ||
| <div | ||
| key={cellKeys?.[index] ?? index} | ||
| ref={(element) => setCellRef(index, element)} | ||
| className="mdv-chart-array__cell" | ||
| data-chart-array-index={String(index)} | ||
| > | ||
| {renderCell(index)} | ||
| </div> | ||
| ))} | ||
| </div> | ||
| ); | ||
| } | ||
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Truncate stale cell refs when
cellCountdecreases.cellRefs.currentcan keep old entries after a shrink, solayoutRef.cellsmay expose stale DOM refs beyond current cells.Suggested change
import { useCallback, + useEffect, useImperativeHandle, useRef, ... const cellRefs = useRef<(HTMLDivElement | null)[]>([]); + useEffect(() => { + cellRefs.current.length = cellCount; + }, [cellCount]);Also applies to: 91-100
🤖 Prompt for AI Agents