chart fixes and facet clicks - #906
Merged
Merged
Conversation
…inter leave `ChartState` gated implicit-series generation on `explicit && explicit.length > 0`, so an explicitly-provided but empty `series` array fell through to deriving series from registered marks — while the charts render their marks from the series. That cycle has no fixed point and spins the main thread, so a chart whose series emptied out while mounted (during a refetch, say) would lock the page rather than render as empty. A non-empty array cut the cycle via the early return; `[]` didn't. The test asserts at the `ChartState` level rather than by rendering, deliberately — a rendering test would hang CI instead of failing. `Tooltip` never re-armed the hide when `pointerEvents` is enabled: `TooltipContext` is the only thing that schedules one, and its timer had already fired and been blocked while the pointer was over the tooltip. Leaving it anywhere other than back over the hit area stranded it on screen. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The readiness probe hit `/`, which a dev server answers before it can render an example, and `capture` recorded "nothing drawn" for every page without saying why. A broken server therefore produced a snapshot of ~1000 errored entries — worse than producing nothing, since `compare` has no baseline to diff an errored entry against and every one of them turns into a silent pass from then on. - probe a real example route, then smoke-test one capture before spending the ~40 minutes a full run takes - record the console error, page error, or HTTP status behind a failure, so a failure on a runner is diagnosable from the job log alone - treat "rendered on a later pass" as a flake rather than a failure - refuse to write a snapshot where more than 5% of examples failed, and report a baseline that far gone as unusable rather than as a check that passed Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…arks` snippet
The facets guide covered reading the panel while rendering but not while handling a
click, which is the question that actually comes up. Adds a `Clicks` section with
the three routes and two examples:
- from a row — `context.facet.x?.(data)`, which survives `fx` being a function
- from the panel — `facet` off the snippet, for a click on a panel's background,
an annotation, or a panel with nothing in it
- from a pixel — `context.facet.panelAt`, also added to the `context.facet` table
`onTooltipClick` is what the first example uses, because the tooltip modes that
draw hit targets (`bounds`, `band`, `facet`, `voronoi`) put them above the marks —
a mark's own `onclick` and `Bars`' `onBarClick` never see the click there.
`marks` is typed as receiving `{ context, facet }`, but `BarChart`, `LineChart`,
`AreaChart` and `ScatterChart` each destructured only `context` and forwarded only
`context`, leaving `facet` undefined on exactly the charts most people reach for
while `aboveMarks` / `belowMarks` worked. No changeset — faceting is unreleased.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
🦋 Changeset detectedLatest commit: 20213d6 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
commit: |
Contributor
built with Refined Cloudflare Pages Action⚡ Cloudflare Pages Deployment
|
…sion runs `docs/static/stackblitz-files.json` is generated and gitignored, so a fresh checkout has none. Every example route imports it transitively — `Example` pulls in `stackblitz.remote`, which imports the JSON — so the docs server 500s on all of them. `prebuild` generates it for a real build, but these workflows run a bare `vite dev`. Previously invisible: the readiness probe hit `/`, which doesn't reach that import, so the server looked healthy and every capture recorded "nothing drawn". The probe now hits an example route and fails here instead. Takes ~0.6s. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Contributor
Bundle Size AnalysisUse-Case ScenariosCore (7 changed)
Base (agnostic) (4 changed)
Base (layer-specific) (3 changed)
Cartesian charts (27 changed)
Geo (3 changed)
Hierarchy (4 changed)
Graph / network (4 changed)
Components (69 changed)
Worst case (1 changed)
Understanding this report
|
`dataCoords` centered on a band scale but not on the band-like width `xInterval` /
`yInterval` give a time scale, so `x="data"` / `y="data"` landed on the leading edge
of the bar rather than on the bar — off by half an interval. `Rect` already draws
the bar across `[scale(floor(v)), scale(offset(floor(v)))]` and `Axis` already
centers its ticks the same way; this brings the tooltip in line with both.
Centers on the interval the value falls in rather than on the value, so data that
isn't already on an interval boundary lands where its bar is. Band scales,
multi-value accessors (`x={['start', 'end']}`) and plain scales are untouched — the
new branch is reached only when an interval is set.
Measured against `Tooltip/multiple-tooltips-with-fixed-single-axis-scaleband`, the
one docs example that combines an interval with a data-anchored tooltip: both
tooltips now center at 516.0 against a bar center of 515.9, previously 500.0.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Hovering a chart whose `data` is nested — a `stack()`, one array per key, with the rows it was built from passed as `flatData` — threw `TypeError: Cannot read properties of undefined`, taking the whole chart down. `Tooltip/stacked-area` is the docs example; the `<svelte:boundary>` around examples is the only reason it read as an error card rather than a blank page. Two problems in the `c`-grouped point path, both from 0a87ff0: - it iterated `ctx.data`, so a nested chart handed the position accessors a series where they expect a row. `flatData` is what the tooltip resolves against and what the accessors are written for, so the two now agree by construction. - it scaled a category's value as a scalar, so `y={[0, 1]}` — a stack's bands — became `NaN` and the browser dropped the point with a console error. A span has no single position, so those fall through to the series path, which already points each of the values. Regression tests render the shape and hover it, with no boundary to swallow the throw; both fail on the code before this change, and the second still fails with only the `flatData` half applied. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Merged
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.
facetto themarkssnippet