-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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] Use <circle />
instead of <path />
for line marks by default
#15220
base: master
Are you sure you want to change the base?
Conversation
CodSpeed Performance ReportMerging #15220 will not alter performanceComparing Summary
|
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
Notice that using another shape than "circle" will render a `<path />` instead of the `<circle />` for mark elements. | ||
This modification implies a small drop of rendering performances (around +50ms to render 1.000 marks). | ||
|
||
{{"demo": "CustomeLineMarks.js"}} |
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.
Custome
should be Custom
|
||
## CustomeLineMarks | ||
|
||
Notice that using another shape than "circle" will render a `<path />` instead of the `<circle />` for mark elements. |
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.
Notice that using another shape than "circle" will render a `<path />` instead of the `<circle />` for mark elements. | |
Notice that using another shape than "circle" renders a `<path />` instead of the `<circle />` for mark elements. |
The `experimentalMarkRendering` prop has been removed from the LineChart component. | ||
The line mark are now `<circle />` element by default. | ||
And you can chose another shape by adding a `shape` property to your line series. | ||
|
||
The codemod only removes the `experimentalMarkRendering` prop. | ||
If you relied on the fact that marks were `path` elements, you need to update your logic. |
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.
Probably should add this to the changelog in PR description
@@ -85,7 +85,7 @@ describe('LineChart - click event', () => { | |||
onMarkClick={() => {}} | |||
/>, | |||
); | |||
const marks = document.querySelectorAll<HTMLElement>('path.MuiMarkElement-root'); | |||
const marks = document.querySelectorAll<HTMLElement>('circle.MuiMarkElement-root'); |
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.
Cant we target only .MuiMarkElement-root
?
/** | ||
* The shape of the mark elements. | ||
* Notice that using something else than 'circle' will render <path /> instead of <circle /> leading to a small performance decrease. | ||
* @default 'circle' | ||
*/ | ||
shape?: 'circle' | 'cross' | 'diamond' | 'square' | 'star' | 'triangle' | 'wye'; |
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.
/** | |
* The shape of the mark elements. | |
* Notice that using something else than 'circle' will render <path /> instead of <circle /> leading to a small performance decrease. | |
* @default 'circle' | |
*/ | |
shape?: 'circle' | 'cross' | 'diamond' | 'square' | 'star' | 'triangle' | 'wye'; | |
/** | |
* The shape of the mark elements. | |
* Using 'circle' renders a `<circle />` element, while all other options render a `<path />` instead. The path causes a small decrease in performance. | |
* @default 'circle' | |
*/ | |
shape?: 'circle' | 'cross' | 'diamond' | 'square' | 'star' | 'triangle' | 'wye'; |
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.
Original felt a bit odd starting with a negative
Previously the notion of shape was not working for line mark. It was always rendering a
path
withd={d3.circle()}
Now the shape is working, and if it's a circle we render a
circle
otherwise apath
with the appropriate d3 shape.This modification is a breaking change because it modifies the SVG component which for example break our tests on mark.click which expect an, event coming from the
path
Changelog
Chart breakingchange
The
experimentalMarkRendering
prop has been removed from the LineChart component.The line mark are now
<circle />
element by default.And you can chose another shape by adding a
shape
property to your line series.The codemod only removes the
experimentalMarkRendering
prop.If you relied on the fact that marks were
path
elements, you need to update your logic.