forked from mui/mui-x
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[charts] Add documentation on border radius alternative for `BarChart…
…s` (mui#12859) Signed-off-by: Jose C Quintas Jr <[email protected]> Co-authored-by: Alexandre Fauquette <[email protected]>
- Loading branch information
1 parent
8e9fdaa
commit 2694e87
Showing
4 changed files
with
134 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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,52 @@ | ||
import * as React from 'react'; | ||
import { BarChart } from '@mui/x-charts/BarChart'; | ||
import { axisClasses } from '@mui/x-charts/ChartsAxis'; | ||
|
||
export default function BorderRadius() { | ||
return ( | ||
<div style={{ width: '100%' }}> | ||
<BarChart | ||
dataset={dataset} | ||
{...chartSetting} | ||
slotProps={{ | ||
bar: { | ||
clipPath: `inset(0px round 10px 10px 0px 0px)`, | ||
}, | ||
}} | ||
/> | ||
</div> | ||
); | ||
} | ||
|
||
const dataset = [ | ||
[59, 57, 86, 21, 'Jan'], | ||
[50, 52, 78, 28, 'Fev'], | ||
[47, 53, 106, 41, 'Mar'], | ||
[54, 56, 92, 73, 'Apr'], | ||
[57, 69, 92, 99, 'May'], | ||
[60, 63, 103, 144, 'June'], | ||
[59, 60, 105, 319, 'July'], | ||
[65, 60, 106, 249, 'Aug'], | ||
[51, 51, 95, 131, 'Sept'], | ||
[60, 65, 97, 55, 'Oct'], | ||
[67, 64, 76, 48, 'Nov'], | ||
[61, 70, 103, 25, 'Dec'], | ||
].map(([london, paris, newYork, seoul, month]) => ({ | ||
london, | ||
paris, | ||
newYork, | ||
seoul, | ||
month, | ||
})); | ||
|
||
const valueFormatter = (value) => `${value}mm`; | ||
|
||
const chartSetting = { | ||
series: [{ dataKey: 'seoul', label: 'Seoul rainfall', valueFormatter }], | ||
height: 300, | ||
sx: { | ||
[`& .${axisClasses.directionY} .${axisClasses.label}`]: { | ||
transform: 'translateX(-10px)', | ||
}, | ||
}, | ||
}; |
This file contains 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,52 @@ | ||
import * as React from 'react'; | ||
import { BarChart } from '@mui/x-charts/BarChart'; | ||
import { axisClasses } from '@mui/x-charts/ChartsAxis'; | ||
|
||
export default function BorderRadius() { | ||
return ( | ||
<div style={{ width: '100%' }}> | ||
<BarChart | ||
dataset={dataset} | ||
{...chartSetting} | ||
slotProps={{ | ||
bar: { | ||
clipPath: `inset(0px round 10px 10px 0px 0px)`, | ||
}, | ||
}} | ||
/> | ||
</div> | ||
); | ||
} | ||
|
||
const dataset = [ | ||
[59, 57, 86, 21, 'Jan'], | ||
[50, 52, 78, 28, 'Fev'], | ||
[47, 53, 106, 41, 'Mar'], | ||
[54, 56, 92, 73, 'Apr'], | ||
[57, 69, 92, 99, 'May'], | ||
[60, 63, 103, 144, 'June'], | ||
[59, 60, 105, 319, 'July'], | ||
[65, 60, 106, 249, 'Aug'], | ||
[51, 51, 95, 131, 'Sept'], | ||
[60, 65, 97, 55, 'Oct'], | ||
[67, 64, 76, 48, 'Nov'], | ||
[61, 70, 103, 25, 'Dec'], | ||
].map(([london, paris, newYork, seoul, month]) => ({ | ||
london, | ||
paris, | ||
newYork, | ||
seoul, | ||
month, | ||
})); | ||
|
||
const valueFormatter = (value: number | null) => `${value}mm`; | ||
|
||
const chartSetting = { | ||
series: [{ dataKey: 'seoul', label: 'Seoul rainfall', valueFormatter }], | ||
height: 300, | ||
sx: { | ||
[`& .${axisClasses.directionY} .${axisClasses.label}`]: { | ||
transform: 'translateX(-10px)', | ||
}, | ||
}, | ||
}; |
This file contains 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 @@ | ||
<BarChart | ||
dataset={dataset} | ||
{...chartSetting} | ||
slotProps={{ | ||
bar: { | ||
clipPath: `inset(0px round 10px 10px 0px 0px)`, | ||
}, | ||
}} | ||
/> |
This file contains 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