-
Notifications
You must be signed in to change notification settings - Fork 825
CHARTS-33: Allow glyphs to be defined from theme #43875
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
Conversation
- Use @visx/group Group component for legend glyphs - Add defaultRenderGlyph fallback for legend - Fix tooltip type compatibility with DataPointDate - Pass glyphStyle props consistently across components
…phs can be different
This reverts commit f077c84.
This reverts commit 988168f.
This reverts commit 024d16a.
This reverts commit 37425c2.
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.
Pull Request Overview
This PR extends the chart theming API to let consumers declare a list of glyph-rendering functions in their theme and applies those glyphs per series (including tooltips), plus updates stories and changelog to demonstrate the feature.
- Added an optional
glyphs
array toChartTheme
- Extracted
DefaultGlyph
into its own component and wired theme glyphs intoLineChart
- Updated Storybook stories to showcase theme-based glyph overrides
- Recorded a changelog entry for the new feature
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
projects/js-packages/charts/src/types.ts | Added glyphs property to ChartTheme |
projects/js-packages/charts/src/components/shared/default-glyph.tsx | Extracted the default glyph renderer into its own file |
projects/js-packages/charts/src/components/line-chart/stories/index.stories.tsx | Demonstrated custom theme glyphs and added themeName control |
projects/js-packages/charts/src/components/line-chart/line-chart.tsx | Integrated theme glyphs for start markers, series, and tooltips |
projects/js-packages/charts/changelog/charts-package-glyphs-theme | Added changelog entry |
Comments suppressed due to low confidence (2)
projects/js-packages/charts/src/types.ts:103
- [nitpick] Consider expanding the doc comment to explain how
glyphs
indices map to data series and what happens when fewer glyph functions than series are provided.
glyphs?: Array< < Datum extends object >( props: GlyphProps< Datum > ) => ReactNode >;
projects/js-packages/charts/src/components/line-chart/line-chart.tsx:239
- No tests currently verify that the
tooltipRenderGlyph
override correctly picks theme glyphs per series. Add unit or integration tests to cover custom tooltip glyph behavior.
const tooltipRenderGlyph = useMemo( () => {
projects/js-packages/charts/src/components/line-chart/stories/index.stories.tsx
Outdated
Show resolved
Hide resolved
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.
Looks good and works as described 👍
Fixes CHARTS-33
Proposed changes:
Other information:
Jetpack product discussion
Does this pull request change what data or activity we track or use?
No
Testing instructions: