-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
[charts-pro] Add data-series to elements of funnel chart #18067
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
Merged
Merged
Changes from 13 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
15bb282
[charts-pro] Add correct classes to `FunnelSectionLabel`
JCQuintas 376ff8b
Merge branch 'master' into fix-funnel-label-class
JCQuintas a85bf6f
[charts-pro] Add data attributes to `FunnelChart`
JCQuintas 96856c2
Merge branch 'master' into funnel-data-attributes
JCQuintas 2a1cd6c
Merge branch 'master' into funnel-data-attributes
JCQuintas 0d11bf1
Merge branch 'master' into funnel-data-attributes
JCQuintas 6a5fec4
Merge commit '206128ae28c2c2e4ed0a2f112d21bb843ae848a6' into funnel-d…
JCQuintas 1982400
lockfile
JCQuintas 5ccbca0
data
JCQuintas 2c72146
data-series
JCQuintas 5260893
add docs
JCQuintas 4bd80fd
Merge branch 'master' into funnel-data-attributes
JCQuintas 6f7a8e3
Merge branch 'master' into funnel-data-attributes
JCQuintas c247d6b
fix empty series
JCQuintas File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| import * as React from 'react'; | ||
| import Box from '@mui/material/Box'; | ||
| import { | ||
| Unstable_FunnelChart as FunnelChart, | ||
| funnelSectionClasses, | ||
| } from '@mui/x-charts-pro/FunnelChart'; | ||
|
|
||
| export default function FunnelDataAttributes() { | ||
| return ( | ||
| <Box sx={{ width: '100%', maxWidth: 400 }}> | ||
| <FunnelChart | ||
| {...funnelProps} | ||
| sx={{ | ||
| [`[data-series="main"] .${funnelSectionClasses.root}:nth-of-type(1)`]: { | ||
| fill: 'url(#pattern)', | ||
| }, | ||
| }} | ||
| > | ||
| <defs> | ||
| <pattern id="pattern" width="50" height="50" patternUnits="userSpaceOnUse"> | ||
| <rect width="100%" height="100%" fill="hotpink" /> | ||
| <circle fill="slateblue" cx="15" cy="15" r="10" /> | ||
| <circle fill="slateblue" cx="40" cy="40" r="10" /> | ||
| </pattern> | ||
| </defs> | ||
| </FunnelChart> | ||
| </Box> | ||
| ); | ||
| } | ||
|
|
||
| const funnelProps = { | ||
| height: 300, | ||
| hideLegend: true, | ||
| series: [ | ||
| { | ||
| id: 'main', | ||
| data: [{ value: 200 }, { value: 180 }, { value: 90 }, { value: 50 }], | ||
| }, | ||
| ], | ||
| }; |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| import * as React from 'react'; | ||
| import Box from '@mui/material/Box'; | ||
| import { | ||
| Unstable_FunnelChart as FunnelChart, | ||
| funnelSectionClasses, | ||
| } from '@mui/x-charts-pro/FunnelChart'; | ||
|
|
||
| export default function FunnelDataAttributes() { | ||
| return ( | ||
| <Box sx={{ width: '100%', maxWidth: 400 }}> | ||
| <FunnelChart | ||
| {...funnelProps} | ||
| sx={{ | ||
| [`[data-series="main"] .${funnelSectionClasses.root}:nth-of-type(1)`]: { | ||
| fill: 'url(#pattern)', | ||
| }, | ||
| }} | ||
| > | ||
| <defs> | ||
| <pattern id="pattern" width="50" height="50" patternUnits="userSpaceOnUse"> | ||
| <rect width="100%" height="100%" fill="hotpink" /> | ||
| <circle fill="slateblue" cx="15" cy="15" r="10" /> | ||
| <circle fill="slateblue" cx="40" cy="40" r="10" /> | ||
| </pattern> | ||
| </defs> | ||
| </FunnelChart> | ||
| </Box> | ||
| ); | ||
| } | ||
|
|
||
| const funnelProps = { | ||
| height: 300, | ||
| hideLegend: true, | ||
| series: [ | ||
| { | ||
| id: 'main', | ||
| data: [{ value: 200 }, { value: 180 }, { value: 90 }, { value: 50 }], | ||
| }, | ||
| ], | ||
| } as const; |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| <FunnelChart | ||
| {...funnelProps} | ||
| sx={{ | ||
| [`[data-series="main"] .${funnelSectionClasses.root}:nth-of-type(1)`]: { | ||
| fill: 'url(#pattern)', | ||
| }, | ||
| }} | ||
| > | ||
| <defs> | ||
| <pattern id="pattern" width="50" height="50" patternUnits="userSpaceOnUse"> | ||
| <rect width="100%" height="100%" fill="hotpink" /> | ||
| <circle fill="slateblue" cx="15" cy="15" r="10" /> | ||
| <circle fill="slateblue" cx="40" cy="40" r="10" /> | ||
| </pattern> | ||
| </defs> | ||
| </FunnelChart> |
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
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
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
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.
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.
Won't this break if
seriesis empty?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.
yep 😅