feat: Connect points with lines - #296
Conversation
|
| /** Key of the CSS class, as named in the local `styles.css`, to use. */ | ||
| classKey?: typeof X_AXIS_ID | typeof Y_AXIS_ID; |
There was a problem hiding this comment.
I added some additional documentation to this dropdown because I felt that the existing API was a little unclear. I'm styling the new dropdown for controlling line connections in the file above this one (ConnectByControl/style.css) and passing in the style classname instead of defining another class key.
| @@ -0,0 +1,109 @@ | |||
| import { Checkbox } from "antd"; | |||
3ca3269 to
18b051b
Compare
There was a problem hiding this comment.
Pull request overview
Adds a first-pass “connect points with lines” capability to the main scatter plot, enabling line traces grouped by a categorical feature and ordered by a numeric feature, with corresponding UI controls and URL/state integration.
Changes:
- Introduces new selection state for line-connection settings (category, ordering feature, visibility) and attempts to serialize/deserialize these via URL params.
- Extends plot selectors to compute per-group line traces and renders them as Plotly line traces.
- Adds UI controls (checkbox + feature dropdowns) to configure line connections, plus dataset defaults for the ordering feature.
Reviewed changes
Copilot reviewed 18 out of 18 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| src/util/UrlState.ts | Adds URL params and mappings for line-connection settings. |
| src/state/types.ts | Introduces LinePlotData type for line trace construction. |
| src/state/selection/types.ts | Adds new selection-state fields and action interfaces for line connections. |
| src/state/selection/selectors.ts | Adds selectors for connect-by fields and visibility flag. |
| src/state/selection/reducer.ts | Adds reducer handlers and initial state for connect-by settings. |
| src/state/selection/logics.ts | Initializes connect-by defaults when datasets change. |
| src/state/selection/constants.ts | Adds action constants for connect-by settings and visibility toggle. |
| src/state/selection/actions.ts | Adds action creators for connect-by settings and visibility toggle. |
| src/state/image-dataset/types.ts | Extends dataset default selections with defaultConnectBy. |
| src/state/image-dataset/json-dataset/index.ts | Reads connectBy.default into dataset selections. |
| src/state/image-dataset/firebase/index.ts | Reads optional Firebase connectBy.default into dataset selections. |
| src/state/image-dataset/csv-dataset/index.ts | Heuristically selects a default “time/frame” feature for ordering lines. |
| src/containers/MainPlotContainer/selectors.ts | Computes and injects Plotly line traces into the main plot data array. |
| src/containers/ColorByMenu/index.tsx | Adds the new connect-by control to the existing menu UI. |
| src/constants/index.ts | Adds a general plot setting for connection line width. |
| src/components/FeatureSelectDropdown/index.tsx | Adds className override and optional id forwarding to the underlying Select. |
| src/components/ConnectByControl/style.css | Styles the new connect-by UI row and dropdown sizing. |
| src/components/ConnectByControl/index.tsx | Implements the connect-by UI control and wires it to selection state/actions. |
Suppressed comments (1)
src/util/UrlState.ts:282
toUrlSearchParameterMapserializes aconnectByselection key, but the selection state usesshowConnectedPoints. As a result, toggling line connections won’t round-trip into the URL.
connectBy: (value) => ({ [URLSearchParam.connectBy]: String(value) }),
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Problem
Part 1 of 2 for #248, "line plots for time series."
This PR adds a UI for drawing lines between points in the scatterplot, based on a category and a numeric feature. Points belonging to the same category have a line drawn between in sorted order based on the feature.
The next change in this series will add UI for controlling additional line settings (e.g. line width, color, and smoothing).
Estimated review size: medium-large, 30-40 minutes
Solution
Type of change
Steps to Verify:
Screenshots (optional):
Keyfiles (delete if not relevant):
ConnectByControl/index.tsxMainPlotContainer/selectors.tsThanks for contributing!