-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[charts] Use real world data for
PieChart
examples (#14297)
Signed-off-by: Jose C Quintas Jr <juniorquintas@gmail.com> Co-authored-by: Alexandre Fauquette <45398769+alexfauquette@users.noreply.github.com>
- Loading branch information
1 parent
662df95
commit f65d9c6
Showing
13 changed files
with
198 additions
and
154 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
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
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
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
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
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 |
---|---|---|
@@ -1,35 +1,34 @@ | ||
import * as React from 'react'; | ||
import { PieChart, pieArcLabelClasses } from '@mui/x-charts/PieChart'; | ||
|
||
const data = [ | ||
{ value: 5, label: 'A' }, | ||
{ value: 10, label: 'B' }, | ||
{ value: 15, label: 'C' }, | ||
{ value: 20, label: 'D' }, | ||
]; | ||
|
||
const size = { | ||
width: 400, | ||
height: 200, | ||
}; | ||
import { desktopOS, valueFormatter } from './webUsageStats'; | ||
|
||
export default function PieArcLabel() { | ||
return ( | ||
<PieChart | ||
series={[ | ||
{ | ||
arcLabel: (item) => `${item.label} (${item.value})`, | ||
arcLabelMinAngle: 45, | ||
data, | ||
arcLabel: (item) => `${item.value}%`, | ||
arcLabelMinAngle: 35, | ||
arcLabelRadius: '60%', | ||
...data, | ||
}, | ||
]} | ||
sx={{ | ||
[`& .${pieArcLabelClasses.root}`]: { | ||
fill: 'white', | ||
fontWeight: 'bold', | ||
}, | ||
}} | ||
{...size} | ||
/> | ||
); | ||
} | ||
|
||
const size = { | ||
width: 400, | ||
height: 200, | ||
}; | ||
|
||
const data = { | ||
data: desktopOS, | ||
valueFormatter, | ||
}; |
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 |
---|---|---|
@@ -1,35 +1,34 @@ | ||
import * as React from 'react'; | ||
import { PieChart, pieArcLabelClasses } from '@mui/x-charts/PieChart'; | ||
|
||
const data = [ | ||
{ value: 5, label: 'A' }, | ||
{ value: 10, label: 'B' }, | ||
{ value: 15, label: 'C' }, | ||
{ value: 20, label: 'D' }, | ||
]; | ||
|
||
const size = { | ||
width: 400, | ||
height: 200, | ||
}; | ||
import { desktopOS, valueFormatter } from './webUsageStats'; | ||
|
||
export default function PieArcLabel() { | ||
return ( | ||
<PieChart | ||
series={[ | ||
{ | ||
arcLabel: (item) => `${item.label} (${item.value})`, | ||
arcLabelMinAngle: 45, | ||
data, | ||
arcLabel: (item) => `${item.value}%`, | ||
arcLabelMinAngle: 35, | ||
arcLabelRadius: '60%', | ||
...data, | ||
}, | ||
]} | ||
sx={{ | ||
[`& .${pieArcLabelClasses.root}`]: { | ||
fill: 'white', | ||
fontWeight: 'bold', | ||
}, | ||
}} | ||
{...size} | ||
/> | ||
); | ||
} | ||
|
||
const size = { | ||
width: 400, | ||
height: 200, | ||
}; | ||
|
||
const data = { | ||
data: desktopOS, | ||
valueFormatter, | ||
}; |
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
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
Oops, something went wrong.