-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
[charts-premium] Add highlight to the RadialLineChart #22156
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
Open
alexfauquette
wants to merge
90
commits into
mui:master
Choose a base branch
from
alexfauquette:radia-interaction
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 85 commits
Commits
Show all changes
90 commits
Select commit
Hold shift + click to select a range
48c4fa0
update types
alexfauquette 4849a27
share config that can be shared
alexfauquette c789b0b
copy some config helpers
alexfauquette b3686b1
Merge remote-tracking branch 'upstream/master' into radial-line
alexfauquette 6ff162f
prettier
alexfauquette f10f53c
docs:api
alexfauquette 60a25a8
Merge remote-tracking branch 'upstream/master' into radial-line
alexfauquette 96f9b06
Merge remote-tracking branch 'upstream/master' into radial-line
alexfauquette 3e1e34b
move-to-premium
alexfauquette 7f5abbb
Merge remote-tracking branch 'upstream/master' into radial-line
alexfauquette 968411b
pnpm prettier
alexfauquette ee08733
pnpm proptypes
alexfauquette 8fa6236
pnpm docs:api
alexfauquette 3eaffab
fix relative imports
alexfauquette b455c73
pnpm prettier
alexfauquette 188d071
gix
alexfauquette f446724
pnpm prettier
alexfauquette 7f5e7ee
prefer duplicating code
alexfauquette a2bcd67
copilot feedback
alexfauquette c8debbb
api update
alexfauquette 7a81b83
fix types (harder than expected)
alexfauquette a22fd92
AI review
alexfauquette 2cac9a1
Merge remote-tracking branch 'upstream/master' into radial-line
alexfauquette 8cf32e4
pnpm extract-error-codes
alexfauquette 7c6f1ad
simplify axes types
alexfauquette 8ab0e75
fix missed AI mistakes
alexfauquette fab6bb9
Merge remote-tracking branch 'upstream/master' into radial-line
alexfauquette 7fed8a3
pnpm prettier
alexfauquette c0d67c8
fix-eslint
alexfauquette 15d329a
fix TS build
alexfauquette c083bc7
Merge remote-tracking branch 'upstream/master' into radial-line
alexfauquette bb1fa26
forgoten experiment
alexfauquette 8f9de9d
move types to premium
alexfauquette 34a6a48
Merge remote-tracking branch 'upstream/master' into radial-line
alexfauquette bde815e
pnpm docs:api
alexfauquette d192b38
rename
alexfauquette 135e618
Merge remote-tracking branch 'upstream/master' into radial-line
alexfauquette b497131
test
alexfauquette e85e8f7
fix point grid
alexfauquette 6f47bc9
fix radius computation
alexfauquette 6c8d987
update demo
alexfauquette e8b2ae8
Merge remote-tracking branch 'upstream/master' into radial
alexfauquette 558ad94
pnpm prettier
alexfauquette 6e38102
export
alexfauquette e888cef
proptypes
alexfauquette bb09a01
fix
alexfauquette 4d17654
pnpm docs:api
alexfauquette 54e8526
pnpm docs:typescript:formatted
alexfauquette 8e64cda
Merge remote-tracking branch 'upstream/master' into radial
alexfauquette 0f0deb1
cleaning
alexfauquette 799e4d1
Add Line and Area plots
alexfauquette e0fa3be
Merge remote-tracking branch 'upstream/master' into radial
alexfauquette c9118ee
fix docs:api
alexfauquette c3cc963
Merge remote-tracking branch 'upstream/master' into radial
alexfauquette a2e9716
fix JSDocs
alexfauquette a12d7ad
create renderer
alexfauquette 14fe909
use the D3 radial line/area
alexfauquette 0dd27ba
remove wrong export
alexfauquette 8e9e4b8
fix docs api
alexfauquette e7e4223
pnpm docs:typescript:formatted
alexfauquette 6e65985
[charts] Get closest item
alexfauquette 47acbba
addapt radial line for highlight
alexfauquette d8d6380
extends to other elements
alexfauquette b3644b1
add highlight Plot
alexfauquette c65c5fe
fix tooltip/highlight when the chart is not a full circle
alexfauquette 0d0a273
Merge remote-tracking branch 'upstream/master' into radia-interaction
alexfauquette 181fb18
pnpm prettier
alexfauquette 08e9da3
docs:api
alexfauquette ed416ab
pnpm extract-error-codes
alexfauquette 75d1c5e
Merge remote-tracking branch 'upstream/master' into radia-interaction
alexfauquette 2e6cdbd
demo
alexfauquette 411bbb8
WIP: fixing the area detection
alexfauquette 7bf28a4
export the getIteamAtPosition
alexfauquette 620940e
fix out of range on the right
alexfauquette a7c24d8
fix approximations
alexfauquette b78a50e
fix ordinal bands
alexfauquette d76d447
export radial line position
alexfauquette 0c2b3fc
fix edge cases
alexfauquette 373449c
fix import
alexfauquette dfed3fe
ignore points outside the available range
alexfauquette 0e1a6ed
Set radial line default to natural
alexfauquette 58765b1
Merge remote-tracking branch 'upstream/master' into radia-interaction
alexfauquette b746ea4
pnpm prettier
alexfauquette d8d597b
pnpm docs:api
alexfauquette b649555
pnpm extract-error-codes
alexfauquette 7e12559
bots feedback
alexfauquette 547966c
pnpm prettier
alexfauquette a802a4e
fix band plots
alexfauquette 0d2fbbf
fic the band scale case
alexfauquette 00d4a58
Merge remote-tracking branch 'upstream/master' into radia-interaction
alexfauquette 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,96 @@ | ||
| import * as React from 'react'; | ||
| import Stack from '@mui/material/Stack'; | ||
| import Box from '@mui/material/Box'; | ||
| import FormControlLabel from '@mui/material/FormControlLabel'; | ||
| import Switch from '@mui/material/Switch'; | ||
| import TextField from '@mui/material/TextField'; | ||
| import MenuItem from '@mui/material/MenuItem'; | ||
| import { Unstable_RadialLineChart as RadialLineChart } from '@mui/x-charts-premium/RadialLineChart'; | ||
|
|
||
| const params = { | ||
| series: [ | ||
| { | ||
| data: [3, 4, 1, 6, 5], | ||
| label: 'A', | ||
| area: false, | ||
| stack: 'total', | ||
| }, | ||
| { data: [4, 3, 1, 5, 8], label: 'B', area: false, stack: 'total' }, | ||
| { | ||
| data: [4, 2, 5, 4, 1], | ||
| label: 'C', | ||
| area: false, | ||
| stack: 'total', | ||
| }, | ||
| ], | ||
| rotationAxis: [{ scaleType: 'point', data: [1, 2, 3, 4, 5] }], | ||
| height: 400, | ||
| grid: { rotation: true, radius: true }, | ||
| }; | ||
|
|
||
| export default function ElementHighlights() { | ||
| const [withArea, setWithArea] = React.useState(false); | ||
| const [highlight, setHighlight] = React.useState('item'); | ||
| const [fade, setFade] = React.useState('global'); | ||
|
|
||
| return ( | ||
| <Stack | ||
| direction={{ xs: 'column', xl: 'row' }} | ||
| spacing={1} | ||
| sx={{ width: '100%' }} | ||
| > | ||
| <Box sx={{ flexGrow: 1 }}> | ||
| <RadialLineChart | ||
| {...params} | ||
| series={params.series.map((series) => ({ | ||
| ...series, | ||
| area: withArea, | ||
| highlightScope: { | ||
| highlight, | ||
| fade, | ||
| }, | ||
| }))} | ||
| /> | ||
| </Box> | ||
| <Stack | ||
| direction={{ xs: 'row', xl: 'column' }} | ||
| spacing={3} | ||
| useFlexGap | ||
| sx={{ justifyContent: 'center', flexWrap: 'wrap' }} | ||
| > | ||
| <TextField | ||
| select | ||
| label="highlight" | ||
| value={highlight} | ||
| onChange={(event) => setHighlight(event.target.value)} | ||
| sx={{ minWidth: 150 }} | ||
| > | ||
| <MenuItem value={'none'}>none</MenuItem> | ||
| <MenuItem value={'item'}>item</MenuItem> | ||
| <MenuItem value={'series'}>series</MenuItem> | ||
| </TextField> | ||
| <TextField | ||
| select | ||
| label="fade" | ||
| value={fade} | ||
| onChange={(event) => setFade(event.target.value)} | ||
| sx={{ minWidth: 150 }} | ||
| > | ||
| <MenuItem value={'none'}>none</MenuItem> | ||
| <MenuItem value={'series'}>series</MenuItem> | ||
| <MenuItem value={'global'}>global</MenuItem> | ||
| </TextField> | ||
|
|
||
| <FormControlLabel | ||
| control={ | ||
| <Switch | ||
| checked={withArea} | ||
| onChange={(event) => setWithArea(event.target.checked)} | ||
| /> | ||
| } | ||
| label="Fill line area" | ||
| /> | ||
| </Stack> | ||
| </Stack> | ||
| ); | ||
| } |
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,99 @@ | ||
| import * as React from 'react'; | ||
| import Stack from '@mui/material/Stack'; | ||
| import Box from '@mui/material/Box'; | ||
| import FormControlLabel from '@mui/material/FormControlLabel'; | ||
| import Switch from '@mui/material/Switch'; | ||
| import TextField from '@mui/material/TextField'; | ||
| import MenuItem from '@mui/material/MenuItem'; | ||
| import { Unstable_RadialLineChart as RadialLineChart } from '@mui/x-charts-premium/RadialLineChart'; | ||
|
|
||
| type HighlightOptions = 'none' | 'item' | 'series'; | ||
| type FadeOptions = 'none' | 'series' | 'global'; | ||
|
|
||
| const params = { | ||
| series: [ | ||
| { | ||
| data: [3, 4, 1, 6, 5], | ||
| label: 'A', | ||
| area: false, | ||
| stack: 'total', | ||
| }, | ||
| { data: [4, 3, 1, 5, 8], label: 'B', area: false, stack: 'total' }, | ||
| { | ||
| data: [4, 2, 5, 4, 1], | ||
| label: 'C', | ||
| area: false, | ||
| stack: 'total', | ||
| }, | ||
| ], | ||
| rotationAxis: [{ scaleType: 'point' as const, data: [1, 2, 3, 4, 5] }], | ||
| height: 400, | ||
| grid: { rotation: true, radius: true }, | ||
| }; | ||
|
|
||
| export default function ElementHighlights() { | ||
| const [withArea, setWithArea] = React.useState(false); | ||
| const [highlight, setHighlight] = React.useState<HighlightOptions>('item'); | ||
| const [fade, setFade] = React.useState<FadeOptions>('global'); | ||
|
|
||
| return ( | ||
| <Stack | ||
| direction={{ xs: 'column', xl: 'row' }} | ||
| spacing={1} | ||
| sx={{ width: '100%' }} | ||
| > | ||
| <Box sx={{ flexGrow: 1 }}> | ||
| <RadialLineChart | ||
| {...params} | ||
| series={params.series.map((series) => ({ | ||
| ...series, | ||
| area: withArea, | ||
| highlightScope: { | ||
| highlight, | ||
| fade, | ||
| }, | ||
| }))} | ||
| /> | ||
| </Box> | ||
| <Stack | ||
| direction={{ xs: 'row', xl: 'column' }} | ||
| spacing={3} | ||
| useFlexGap | ||
| sx={{ justifyContent: 'center', flexWrap: 'wrap' }} | ||
| > | ||
| <TextField | ||
| select | ||
| label="highlight" | ||
| value={highlight} | ||
| onChange={(event) => setHighlight(event.target.value as HighlightOptions)} | ||
| sx={{ minWidth: 150 }} | ||
| > | ||
| <MenuItem value={'none'}>none</MenuItem> | ||
| <MenuItem value={'item'}>item</MenuItem> | ||
| <MenuItem value={'series'}>series</MenuItem> | ||
| </TextField> | ||
| <TextField | ||
| select | ||
| label="fade" | ||
| value={fade} | ||
| onChange={(event) => setFade(event.target.value as FadeOptions)} | ||
| sx={{ minWidth: 150 }} | ||
| > | ||
| <MenuItem value={'none'}>none</MenuItem> | ||
| <MenuItem value={'series'}>series</MenuItem> | ||
| <MenuItem value={'global'}>global</MenuItem> | ||
| </TextField> | ||
|
|
||
| <FormControlLabel | ||
| control={ | ||
| <Switch | ||
| checked={withArea} | ||
| onChange={(event) => setWithArea(event.target.checked)} | ||
| /> | ||
| } | ||
| label="Fill line area" | ||
| /> | ||
| </Stack> | ||
| </Stack> | ||
| ); | ||
| } |
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
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,20 @@ | ||
| import * as React from 'react'; | ||
| import { ApiPage } from '@mui/internal-core-docs/ApiPage'; | ||
| import { mapApiPageTranslations } from '@mui/internal-core-docs/mapApiPageTranslations'; | ||
| import jsonPageContent from './radial-line-highlight-plot.json'; | ||
|
|
||
| export default function Page(props) { | ||
| const { descriptions } = props; | ||
| return <ApiPage descriptions={descriptions} pageContent={jsonPageContent} />; | ||
| } | ||
|
|
||
| export async function getStaticProps() { | ||
| const req = require.context( | ||
| 'docs/translations/api-docs/charts/radial-line-highlight-plot', | ||
| false, | ||
| /\.\/radial-line-highlight-plot.*\.json$/, | ||
| ); | ||
| const descriptions = mapApiPageTranslations(req); | ||
|
|
||
| return { props: { descriptions } }; | ||
| } |
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,15 @@ | ||
| { | ||
| "props": {}, | ||
| "name": "RadialLineHighlightPlot", | ||
| "imports": [ | ||
| "import { RadialLineHighlightPlot } from '@mui/x-charts-premium/RadialLineChart';", | ||
| "import { RadialLineHighlightPlot } from '@mui/x-charts-premium';" | ||
| ], | ||
| "slots": [{ "name": "radialLineHighlight", "description": "", "class": null }], | ||
| "classes": [], | ||
| "muiName": "MuiRadialLineHighlightPlot", | ||
| "filename": "/packages/x-charts-premium/src/RadialLineChart/RadialLineHighlightPlot.tsx", | ||
| "inheritance": null, | ||
| "demos": "<ul><li><a href=\"/x/react-charts/radial-lines/\">Charts - Radial Lines</a></li></ul>", | ||
| "cssComponent": false | ||
| } |
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
9 changes: 9 additions & 0 deletions
9
docs/translations/api-docs/charts/radial-line-highlight-plot/radial-line-highlight-plot.json
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,9 @@ | ||
| { | ||
| "componentDescription": "", | ||
| "propDescriptions": { | ||
| "slotProps": { "description": "The props used for each component slot." }, | ||
| "slots": { "description": "Overridable component slots." } | ||
| }, | ||
| "classDescriptions": {}, | ||
| "slotDescriptions": { "radialLineHighlight": "" } | ||
| } |
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.