fix: color stability, null facet support, and tooltip event leak#508
Merged
Conversation
Pin color.domain and fx.domain in faceted bars example so unchecking a party checkbox no longer reshuffles remaining bars' colors. Allow null values in fx/fy scale domains (#99) — null is a valid grouping category for facet scales. Also exempt fx/fy from the data validity check in Mark.svelte so null-faceted records render. Fix HTMLTooltip event listener mismatch: removeEventListener was using 'mouseleave' instead of 'pointerleave', causing a leak. Co-Authored-By: Claude Opus 4.6 <[email protected]>
✅ Deploy Preview for svelteplot ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
gka
requested changes
Mar 2, 2026
gka
left a comment
Contributor
There was a problem hiding this comment.
Makes sense to change the faceted-bars example to pin the colors, but I don't think the "empty" facets should show up on the x axis. That's something users would likely never want in a real-world scenario
A more practical way to pin the colors is to pass a dictionary as color scheme
Use a scheme dictionary mapping party names to recognizable colors instead of relying on domain + default categorical colors. Co-Authored-By: Claude Opus 4.6 <[email protected]>
…chemes The runtime already supports dictionary objects as color schemes (autoScales.ts:246) but the type definition didn't include them. Co-Authored-By: Claude Opus 4.6 <[email protected]>
Collaborator
Author
|
Done. Please check @gka |
Contributor
|
perfect |
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.

Summary
color.domainandfx.domainin the faceted bars example so unchecking a party checkbox no longer reshuffles remaining bars' colorssex = null). Also exempt fx/fy from the data validity check so null-faceted records render.removeEventListener('mouseleave', ...)→removeEventListener('pointerleave', ...)in HTMLTooltip to match the correspondingaddEventListenerChanges
src/routes/examples/bar/faceted-bars.sveltecolor.domainandfx.domainto[...parties]src/lib/helpers/scales.tssrc/lib/Mark.svelteisValidcheck (null facet values are valid)src/lib/marks/HTMLTooltip.sveltemouseleave→pointerleavesrc/tests/colorStability.test.svelte.tssrc/tests/nullFacet.test.svelte.tssrc/lib/helpers/facets.test.tsgetEmptyFacetsTest plan
pnpm test— 683 tests pass (85 files)pnpm check— 0 errorspnpm lint— clean🤖 Generated with Claude Code