-
Notifications
You must be signed in to change notification settings - Fork 821
CHARTS-15 - Add support to enable default start glyph for the line chart #43819
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
CHARTS-15 - Add support to enable default start glyph for the line chart #43819
Conversation
Thank you for your PR! When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:
This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖 Follow this PR Review Process:
If you have questions about anything, reach out in #jetpack-developers for guidance! |
Code Coverage SummaryCoverage changed in 1 file.
|
data={ seriesData } | ||
color={ stroke } | ||
glyphStyle={ glyphStyle } | ||
renderStartGlyph={ defaultRenderGlyph } |
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.
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
Adds support for rendering a glyph at the start of each series in the line chart when enabled
- Introduces a
withStartGlyphs
prop and default glyph renderer - Implements a
StartGlyph
component and exports its props type - Adds a Storybook story and changelog entry for the new feature
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
File | Description |
---|---|
projects/js-packages/charts/src/index.ts | Export RenderLineStartGlyphProps type |
projects/js-packages/charts/src/components/line-chart/stories/index.stories.tsx | Add WithStartGlyphs story |
projects/js-packages/charts/src/components/line-chart/line-chart.tsx | Add withStartGlyphs prop, StartGlyph component, and default glyph rendering |
projects/js-packages/charts/changelog/charts-15-add-glyphs-at-the-start-of-the-lines | Add changelog for the new glyph feature |
Comments suppressed due to low confidence (2)
projects/js-packages/charts/src/components/line-chart/line-chart.tsx:120
- The new
withStartGlyphs
prop should be documented in the JSDoc comment forLineChartProps
, including its default value and behavior.
withStartGlyphs?: boolean;
projects/js-packages/charts/src/components/line-chart/line-chart.tsx:119
- The logic for rendering start glyphs isn't covered by unit tests. Consider adding tests to verify that when
withStartGlyphs
is true, theStartGlyph
component is rendered correctly.
renderTooltip = renderDefaultTooltip,
projects/js-packages/charts/src/components/line-chart/line-chart.tsx
Outdated
Show resolved
Hide resolved
projects/js-packages/charts/src/components/line-chart/line-chart.tsx
Outdated
Show resolved
Hide resolved
Co-authored-by: Copilot <[email protected]>
…s://github.com/Automattic/jetpack into charts-15-add-glyphs-at-the-start-of-the-lines
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.
Works as described, nice work! 👍🏼 Left my thought, but it won't be a blocker. 🙂
data: SeriesData; | ||
index: number; | ||
color: string; | ||
renderStartGlyph: < Datum extends object >( |
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.
I would put my 2 cents here: I think the renderStartGlyph
function could be more converged inside the component StartGlyph
rather than exposing the whole render function, since the primary purpose is to add the glyph at the start point of the line chart in this scenario. I imagine the StartGlyph
component would receive a simple icon
or element for a customizable glyph.
Is there a more complex use case to adjust more options for the glyph point?
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.
I was imagining that if we were to allow changing the glyph and add a custom shape here, we would want to match the one on the tooltip. That's why I have kept the type/format of this same as the one from the ToolTip Glyph in visx, so that same Glyph could be potentially passed to Tooltip as well - https://github.com/airbnb/visx/blob/86738178e86fdc0feacf83ac96e68724da0627c2/packages/visx-xychart/src/components/Tooltip.tsx#L75-L102C17
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.
so that same Glyph could be potentially passed to Tooltip as well
👍
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 to me! Nice one 👍
Fixes CHARTS-15
Proposed changes:
Other information:
Jetpack product discussion
Does this pull request change what data or activity we track or use?
No
Testing instructions: