Charts - 레이더(Radar)
레이더 차트로 원형으로 배치된 축에서 여러 변수를 비교해요.
본문
개요(Overview)
레이더 차트는 중심에서 뻗어 나가는 여러 축에 데이터를 표시하므로, 지표 간 값을 비교할 수 있어요. 여러 차원(예: 제품 속성이나 기술)에 걸쳐 프로필이나 점수를 비교할 때 사용하세요.
아래 데모는 하나의 시리즈가 있는 기본 레이더 차트를 보여줘요.
import { RadarChart } from '@mui/x-charts/RadarChart';
export default function BasicRadar() {
return (
<RadarChart
height={300}
series={[{ label: 'Lisa', data: [120, 98, 86, 99, 85, 65] }]}
radar={{
max: 120,
metrics: ['Math', 'Chinese', 'English', 'Geography', 'Physics', 'History'],
}}
/>
);
}
기본(Basics)
레이더 차트 시리즈는 값 배열이 있는 data 속성을 포함해야 해요.
시리즈는 metrics 배열이 있는 radar 객체도 포함해야 해요.
metrics의 각 항목은 차트의 축 하나를 정의하는 문자열 또는 객체예요.
다중 시리즈(Multi-series)
같은 레이더에 여러 시리즈를 그릴 수 있어요.
import { RadarChart } from '@mui/x-charts/RadarChart';
// Data from https://ourworldindata.org/emissions-by-fuel
function valueFormatter(v: number | null) {
if (v === null) {
return 'NaN';
}
return `${v.toLocaleString()}t CO2eq/pers`;
}
export default function MultiSeriesRadar() {
return (
<RadarChart
height={300}
series={[
{ label: 'USA', data: [6.65, 2.76, 5.15, 0.19, 0.07, 0.12], valueFormatter },
{
label: 'Australia',
data: [5.52, 5.5, 3.19, 0.51, 0.15, 0.11],
valueFormatter,
},
{
label: 'United Kingdom',
data: [2.26, 0.29, 2.03, 0.05, 0.04, 0.06],
valueFormatter,
},
]}
radar={{
metrics: ['Oil', 'Coal', 'Gas', 'Flaring', 'Other\nindustry', 'Cement'],
}}
/>
);
}
시리즈 옵션
레이더 시리즈에 hideMark와 fillArea를 설정해 렌더링 방식을 변경할 수 있어요.
import * as React from 'react';
import Box from '@mui/material/Box';
import Stack from '@mui/material/Stack';
import { RadarChart, RadarSeries } from '@mui/x-charts/RadarChart';
import FormControlLabel from '@mui/material/FormControlLabel';
import Checkbox from '@mui/material/Checkbox';
export default function DemoRadarVisualisation() {
const [hideMark, setHideMark] = React.useState(false);
const [fillArea, setFillArea] = React.useState(false);
const withOptions = (series: RadarSeries[]) =>
series.map((item) => ({ ...item, hideMark, fillArea }));
return (
<Box sx={{ width: '100%' }}>
<Stack direction="row" sx={{ flexWrap: 'wrap', gap: 2, width: '100%', mb: 2 }}>
<FormControlLabel
checked={!hideMark}
control={
<Checkbox onChange={(event) => setHideMark(!event.target.checked)} />
}
label="with mark"
labelPlacement="end"
/>
<FormControlLabel
checked={fillArea}
control={
<Checkbox onChange={(event) => setFillArea(event.target.checked)} />
}
label="fill area"
labelPlacement="end"
/>
</Stack>
<Stack
direction="row"
sx={{ flexWrap: 'wrap', justifyContent: 'space-around', width: '100%' }}
>
<Box sx={{ width: '100%', maxWidth: 400 }}>
<RadarChart
{...commonSettings}
series={withOptions([lisaGrades, bartGrades])}
/>
</Box>
</Stack>
</Box>
);
}
const commonSettings = {
height: 300,
radar: {
max: 120,
metrics: ['Math', 'Chinese', 'English', 'Geography', 'Physics', 'History'],
},
};
const lisaGrades = {
label: 'Lisa',
data: [120, 98, 86, 99, 85, 65],
hideMark: false,
} satisfies RadarSeries;
const bartGrades = {
label: 'Bart',
data: [25, 34, 51, 16, 90, 20],
hideMark: false,
} satisfies RadarSeries;
지표(Metrics)
radar의 metrics 속성은 차트의 축(모서리)당 하나의 항목이 있는 배열을 받아요.
각 항목은 다음과 같을 수 있어요:
- 문자열(축 라벨로 사용). 다른 속성은 데이터에서 와요.
- 객체:
name: 축 라벨min: 이 축의 최소값(기본값 0)max: 이 축의 최대값(기본값은 데이터의 최댓값)
import { RadarChart } from '@mui/x-charts/RadarChart';
export default function RadarAxis() {
return (
<RadarChart
height={300}
series={[{ label: 'Lisa', data: [120, 98, 86, 99, 85, 65] }]}
radar={{
metrics: [
{ name: 'Math', max: 120 },
{ name: 'Chinese', max: 120 },
{ name: 'English', max: 120 },
{ name: 'Geography', max: 120 },
{ name: 'Physics', max: 120 },
{ name: 'History', max: 120 },
],
}}
/>
);
}
그리드(Grid)
레이더 차트는 시리즈 뒤에 그리드를 그려요. 다음으로 구성해요:
startAngle: 전체 차트의 회전 각도(도 단위)divisions: 그리드 분할 수shape:circular또는sharpstripeColor: 스트라이프 색상을 반환하는 콜백. 스트라이프를 제거하려면null로 설정하세요.
import Box from '@mui/material/Box';
import { useTheme } from '@mui/material/styles';
import ChartsUsageDemo from 'docs/src/modules/components/ChartsUsageDemo';
import { RadarChart } from '@mui/x-charts/RadarChart';
export default function DemoRadar() {
const theme = useTheme();
const stripeColorFunction = {
default: undefined,
'two-tones':
theme.palette.mode === 'dark'
? (index: number) =>
index % 2 === 0
? (theme.vars || theme).palette.primary.dark
: (theme.vars || theme).palette.grey[300]
: (index: number) =>
index % 2 === 0
? (theme.vars || theme).palette.primary.light
: (theme.vars || theme).palette.grey[800],
null: null,
};
const stripeColorLines = {
default: [],
'two-tones':
theme.palette.mode === 'dark'
? [
` stripeColor={(index:number) => index % 2 === 0 ? theme.palette.primary.dark : theme.palette.grey[300]}`,
]
: [
` stripeColor={(index:number) => index % 2 === 0 ? theme.palette.primary.light : theme.palette.grey[800]}`,
],
null: [` stripeColor={null}`],
};
return (
<ChartsUsageDemo
componentName="RadarChart"
data={{
startAngle: {
knob: 'number',
defaultValue: 30,
min: -180,
max: 180,
},
divisions: {
knob: 'number',
defaultValue: 10,
min: 0,
max: 20,
},
shape: {
knob: 'radio',
options: ['sharp', 'circular'] as const,
defaultValue: 'circular',
},
stripe: {
knob: 'select',
options: ['default', 'two-tones', 'null'] as const,
defaultValue: 'default',
},
}}
renderDemo={(props) => (
<Box sx={{ width: '100%', maxWidth: 400 }}>
<RadarChart
height={250}
margin={{ top: 20 }}
series={[{ data: [120, 98, 86, 99, 85, 65] }]}
divisions={props.divisions}
stripeColor={stripeColorFunction[props.stripe]}
shape={props.shape}
radar={{
max: 120,
startAngle: props.startAngle,
metrics: [
'Math',
'Chinese',
'English',
'Geography',
'Physics',
'History',
],
}}
/>
</Box>
)}
getCode={({ props }) =>
[
`import { RadarChart } from '@mui/x-charts/RadarChart';`,
'',
`<RadarChart`,
' {/** ... */}',
` shape="${props.shape}"`,
` divisions={${props.divisions}}`,
...stripeColorLines[props.stripe],
` radar={{`,
` startAngle: ${props.startAngle},`,
` metrics: [...],`,
' }}',
'/>',
].join('\n')
}
/>
);
}
축 값(Axis values)
RadarAxis로 지표에 라벨을 추가해요.
metric prop이 필요하며 다음으로 구성할 수 있어요:
angle: 라벨의 각도(기본값은 지표의 각도)labelOrientation: 이동하는 앵커가 있는 가로, 또는 축과 함께 회전divisions: 라벨 수textAnchor/dominantBaseline: 라벨 배치(문자열 또는 각도(도)를 받는 함수)
import Box from '@mui/material/Box';
import ChartsUsageDemo from 'docs/src/modules/components/ChartsUsageDemo';
import { RadarChart, RadarAxis } from '@mui/x-charts/RadarChart';
function getTextAnchor(textAnchor: 'default' | 'start' | 'end' | 'function') {
switch (textAnchor) {
case 'default':
return undefined;
case 'function':
return (angle: number) => (angle < 180 ? 'start' : 'end');
default:
return textAnchor;
}
}
function getTextAnchorCode(textAnchor: 'default' | 'start' | 'end' | 'function') {
switch (textAnchor) {
case 'default':
return '';
case 'function':
return `textAnchor={(angle) => angle < 180 ? 'start' : 'end'}`;
default:
return `textAnchor="${textAnchor}"`;
}
}
export default function DemoRadarAxis() {
return (
<ChartsUsageDemo
componentName="RadarChart"
data={{
angle: {
knob: 'number',
defaultValue: 30,
min: -360,
max: 360,
step: 10,
},
divisions: {
knob: 'number',
defaultValue: 4,
min: 1,
max: 5,
},
labelOrientation: {
knob: 'radio',
options: ['horizontal', 'rotated'] as const,
defaultValue: 'horizontal',
},
textAnchor: {
knob: 'select',
options: ['default', 'start', 'end', 'function'] as const,
defaultValue: 'default',
},
}}
renderDemo={(props) => (
<Box sx={{ width: '100%', maxWidth: 400 }}>
<RadarChart
height={250}
margin={{ top: 20 }}
series={[{ data: [100, 98, 86, 99, 85, 55] }]}
divisions={4}
radar={{
max: 100,
metrics: [
'Math',
'Chinese',
'English',
'Geography',
'Physics',
'History',
],
}}
>
<RadarAxis
metric="Math"
labelOrientation={props.labelOrientation}
angle={props.angle}
textAnchor={getTextAnchor(props.textAnchor)}
divisions={props.divisions}
/>
</RadarChart>
</Box>
)}
getCode={({ props }) => {
const textAnchorCode = getTextAnchorCode(props.textAnchor);
return [
`import { RadarChart, RadarAxis } from '@mui/x-charts/RadarChart';`,
'',
'<RadarChart>',
` <RadarAxis`,
` metric="Math"`,
` divisions={${props.divisions}}`,
` labelOrientation="${props.labelOrientation}"`,
` angle="${props.angle}"`,
...(textAnchorCode ? [` ${textAnchorCode}`] : []),
' />',
'</RadarChart>',
].join('\n');
}}
/>
);
}
하이라이트(Highlight)
축 하이라이트
기본적으로 레이더 차트는 같은 축의 모든 값을 하이라이트해요.
커스텀 컴포넌트를 구성하고 있다면 이 동작을 위해 RadarAxisHighlight를 추가하세요.
import * as React from 'react';
import Box from '@mui/material/Box';
import Stack from '@mui/material/Stack';
import { RadarChart, RadarSeries } from '@mui/x-charts/RadarChart';
import FormControlLabel from '@mui/material/FormControlLabel';
import Checkbox from '@mui/material/Checkbox';
export default function DemoRadarAxisHighlight() {
const [hideMark, setHideMark] = React.useState(true);
const withHideMark = (series: RadarSeries[]) =>
series.map((item) => ({ ...item, hideMark }));
return (
<Box sx={{ width: '100%' }}>
<Stack direction="row" sx={{ flexWrap: 'wrap', gap: 2, width: '100%', mb: 2 }}>
<FormControlLabel
checked={!hideMark}
control={
<Checkbox onChange={(event) => setHideMark(!event.target.checked)} />
}
label="with mark"
labelPlacement="end"
/>
</Stack>
<Stack
direction="row"
sx={{ flexWrap: 'wrap', justifyContent: 'space-around', width: '100%' }}
>
<Box sx={{ width: '100%', maxWidth: 400 }}>
<RadarChart
{...commonSettings}
series={withHideMark([lisaGrades, bartGrades])}
/>
</Box>
</Stack>
</Box>
);
}
const commonSettings = {
height: 300,
radar: {
max: 120,
metrics: ['Math', 'Chinese', 'English', 'Geography', 'Physics', 'History'],
},
};
const lisaGrades = {
label: 'Lisa',
data: [120, 98, 86, 99, 85, 65],
hideMark: false,
} satisfies RadarSeries;
const bartGrades = {
label: 'Bart',
data: [25, 34, 51, 16, 90, 20],
hideMark: false,
} satisfies RadarSeries;
시리즈 하이라이트
highlight prop을 'series'로 설정해 시리즈별로 하이라이트하세요.
highlightedItem과 onHighlightChange로 제어해요.
커스텀 컴포넌트를 구성하고 있다면 이 props를 RadarDataProvider에 전달하세요.
아래 데모는 여러 겹치는 국가 시리즈가 있는 제어된 하이라이트를 보여줘요.
가장 상호작용적으로 만들고 싶은 시리즈는 series 배열의 마지막에 배치하세요. 나중에 정의된 시리즈는 위에 렌더링되고 겹치는 영역에서 먼저 포인터 이벤트를 받기 때문이에요.
import * as React from 'react';
import Stack from '@mui/material/Stack';
import ToggleButton from '@mui/material/ToggleButton';
import ToggleButtonGroup from '@mui/material/ToggleButtonGroup';
import { RadarChart, RadarSeries } from '@mui/x-charts/RadarChart';
import { HighlightItemIdentifier } from '@mui/x-charts/models';
import Box from '@mui/material/Box';
import FormControlLabel from '@mui/material/FormControlLabel';
import Checkbox from '@mui/material/Checkbox';
function valueFormatter(v: number | null) {
if (v === null) {
return 'NaN';
}
return `${v.toLocaleString()}t CO2eq/pers`;
}
export default function DemoRadarSeriesHighlight() {
const [highlightedItem, setHighlightedItem] =
React.useState<HighlightItemIdentifier<'radar'> | null>(null);
const [fillArea, setFillArea] = React.useState(false);
const withOptions = (series: RadarSeries[]) =>
series.map((item) => ({
...item,
fillArea,
}));
const handleHighLightedSeries = (event: any, newHighLightedSeries: string) => {
if (newHighLightedSeries !== null) {
setHighlightedItem({
seriesId: newHighLightedSeries,
});
}
};
return (
<Stack spacing={2} sx={{ alignItems: 'center', width: '100%' }}>
<ToggleButtonGroup
value={highlightedItem?.seriesId ?? null}
exclusive
onChange={handleHighLightedSeries}
aria-label="highlighted series"
fullWidth
size="small"
>
{series.map((item) => (
<ToggleButton
key={item.id}
value={item.id}
aria-label={`series ${item.label}`}
>
{item.label}
</ToggleButton>
))}
</ToggleButtonGroup>
<Box sx={{ width: '100%' }}>
<RadarChart
height={300}
highlight="series"
highlightedItem={highlightedItem}
onHighlightChange={setHighlightedItem}
slotProps={{ tooltip: { trigger: 'none' } }}
series={withOptions(series)}
radar={radar}
/>
</Box>
<FormControlLabel
checked={fillArea}
control={
<Checkbox onChange={(event) => setFillArea(event.target.checked)} />
}
label="fill area"
labelPlacement="end"
/>
</Stack>
);
}
// Data from https://ourworldindata.org/emissions-by-fuel
const series = [
{
id: 'usa',
label: 'USA',
data: [6.65, 2.76, 5.15, 0.19, 0.07, 0.12],
valueFormatter,
},
{
id: 'australia',
label: 'Australia',
data: [5.52, 5.5, 3.19, 0.51, 0.15, 0.11],
valueFormatter,
},
{
id: 'united-kingdom',
label: 'United Kingdom',
data: [2.26, 0.29, 2.03, 0.05, 0.04, 0.06],
valueFormatter,
},
];
const radar = {
metrics: ['Oil', 'Coal', 'Gas', 'Flaring', 'Other\nindustry', 'Cement'],
};
하이라이트 비활성화
highlight prop을 'none'으로 설정해 하이라이트를 끄세요.
툴팁(Tooltip)
슬롯으로 레이더 툴팁을 커스터마이징할 수 있어요. 자세한 내용은 Tooltip을 참고하세요.
툴팁 슬롯의 trigger prop은 다음을 받아요:
'axis': 마우스 위치가 지표에 매핑돼요. 툴팁은 해당 지표의 모든 시리즈 데이터를 보여줘요.'item': 포인터가 레이더 영역 위에 있을 때 툴팁은 해당 시리즈의 데이터를 보여줘요.'none': 툴팁이 꺼져요.
import Box from '@mui/material/Box';
import Stack from '@mui/material/Stack';
import { RadarChart } from '@mui/x-charts/RadarChart';
import Typography from '@mui/material/Typography';
export default function RadarTooltip() {
return (
<Stack
direction="row"
sx={{ flexWrap: 'wrap', justifyContent: 'space-around', width: '100%' }}
>
<Box sx={{ maxWidth: 300, flexGrow: 1 }}>
<Typography sx={{ textAlign: 'center' }}>Axis</Typography>
<RadarChart
{...radarChartsParams}
slotProps={{ tooltip: { trigger: 'axis' } }}
/>
</Box>
<Box sx={{ maxWidth: 300, flexGrow: 1 }}>
<Typography sx={{ textAlign: 'center' }}>Item</Typography>
<RadarChart
{...radarChartsParams}
highlight="series"
slotProps={{ tooltip: { trigger: 'item' } }}
/>
</Box>
</Stack>
);
}
// Data from https://ourworldindata.org/emissions-by-fuel
const series = [
{
id: 'usa',
label: 'USA',
data: [6.65, 2.76, 5.15, 0.19, 0.07, 0.12],
},
{
id: 'australia',
label: 'Australia',
data: [5.52, 5.5, 3.19, 0.51, 0.15, 0.11],
},
{
id: 'united-kingdom',
label: 'United Kingdom',
data: [2.26, 0.29, 2.03, 0.05, 0.04, 0.06],
},
];
const radar = {
metrics: ['Oil', 'Coal', 'Gas', 'Flaring', 'Other\nindustry', 'Cement'],
};
const radarChartsParams = {
hideLegend: true,
height: 300,
series,
radar,
};
클릭 이벤트(Click events)
레이더 차트는 몇 가지 클릭 핸들러를 제공해요:
- 특정 영역 클릭용
onAreaClick - 특정 마크 클릭용
onMarkClick - 차트의 아무 곳 클릭용
onAxisClick
각 핸들러는 이 시그니처를 사용해요:
const clickHandler = (
event, // The mouse event.
params, // An object that identifies the clicked elements.
) => {};
import * as React from 'react';
import Stack from '@mui/material/Stack';
import Box from '@mui/material/Box';
import Typography from '@mui/material/Typography';
import IconButton from '@mui/material/IconButton';
import ToggleButtonGroup from '@mui/material/ToggleButtonGroup';
import ToggleButton from '@mui/material/ToggleButton';
import UndoOutlinedIcon from '@mui/icons-material/UndoOutlined';
import {
ChartsAxisData,
RadarItemIdentifier,
RadarSeriesType,
} from '@mui/x-charts/models';
import { RadarChart } from '@mui/x-charts/RadarChart';
import { HighlightedCode } from '@mui/internal-core-docs/HighlightedCode';
export default function RadarClick() {
const [itemData, setItemData] = React.useState<RadarItemIdentifier>();
const [axisData, setAxisData] = React.useState<ChartsAxisData | null>();
const [itemClick, setItemClick] = React.useState<'mark' | 'area' | null>('mark');
const handleItemClick = (
event: React.MouseEvent<HTMLElement>,
newItem: 'mark' | 'area' | null,
) => {
setItemClick(newItem);
};
return (
<Stack
direction={{ xs: 'column', md: 'row' }}
spacing={{ xs: 0, md: 4 }}
sx={{ width: '100%' }}
>
<Box sx={{ flexGrow: 1 }}>
<RadarChart
{...commonSettings}
series={[lisaGrades, bartGrades]}
onAreaClick={
itemClick === 'area' ? (event, d) => setItemData(d) : undefined
}
onMarkClick={
itemClick === 'mark' ? (event, d) => setItemData(d) : undefined
}
onAxisClick={(event, d) => setAxisData(d)}
/>
</Box>
<Stack
direction="column"
sx={{ width: { xs: '100%', md: '40%' } }}
spacing={2}
>
<Stack
spacing={1}
direction={{ xs: 'row', md: 'column' }}
sx={{ alignItems: { xs: 'center', md: 'start' } }}
>
<Typography>Item click listener</Typography>
<ToggleButtonGroup
value={itemClick}
exclusive
onChange={handleItemClick}
aria-label="text alignment"
size="small"
>
<ToggleButton value="mark">Mark</ToggleButton>
<ToggleButton value="area">Area</ToggleButton>
</ToggleButtonGroup>
</Stack>
<div>
<Box
sx={{
display: 'flex',
justifyContent: 'space-between',
alignItems: 'center',
}}
>
<Typography>Click on the chart</Typography>
<IconButton
aria-label="reset"
size="small"
onClick={() => {
setItemData(undefined);
setAxisData(null);
}}
>
<UndoOutlinedIcon fontSize="small" />
</IconButton>
</Box>
<HighlightedCode
code={`// Data from item click
${itemData ? JSON.stringify(itemData, null, 2) : '// The data will appear here'}
// Data from axis click
${axisData ? JSON.stringify(axisData, null, 2) : '// The data will appear here'}
`}
language="json"
copyButtonHidden
/>
</div>
</Stack>
</Stack>
);
}
const commonSettings = {
height: 300,
radar: {
max: 120,
metrics: ['Math', 'Chinese', 'English', 'Geography', 'Physics', 'History'],
},
};
const lisaGrades: RadarSeriesType = {
type: 'radar',
label: 'Lisa',
id: 'lisa-grade-series',
data: [120, 98, 86, 99, 85, 65],
hideMark: false,
};
const bartGrades: RadarSeriesType = {
type: 'radar',
label: 'Bart',
id: 'bar-grade-series',
data: [25, 34, 51, 16, 90, 20],
hideMark: false,
};
:::info
onAxisClick에 전달되는 event는 다른 것들과 달라요.
onAxisClick은 SVG 요소의 네이티브 마우스 이벤트를 받아요.
다른 핸들러는 영역, 마크, 또는 선 컴포넌트의 React 합성 마우스 이벤트를 받아요.
:::
구성(Composition)
구성 시 series와 radar props를 제공하려면 RadarDataProvider를 사용하세요.
구성에 사용 가능한 공유 차트 컴포넌트에 더해 다음을 사용할 수 있어요:
- 축:
RadarGrid: 그리드와 스트라이프RadarMetricLabels: 그리드 주변의 지표 라벨
- 데이터:
RadarSeriesPlot: 쌓인 영역과 마크RadarSeriesArea: 영역만RadarSeriesMarks: 마크만
- 상호작용:
RadarAxisHighlight: 하이라이트된 축을 따라 선과 마크FocusedRadarMark: 키보드 탐색용 포커스 표시기
:::info
RadarSeriesPlot은 모든 시리즈를 함께 그리므로, 두 번째 시리즈 영역이 첫 번째 시리즈 마크 위에 놓여요.
RadarSeriesArea와 RadarSeriesMarks는 모든 마크를 모든 영역 위에 그리거나, 영역과 마크 사이에 컴포넌트를 삽입할 수 있게 해줘요.
:::
import Stack from '@mui/material/Stack';
import {
RadarDataProvider,
RadarGrid,
RadarSeriesMarks,
RadarSeriesArea,
RadarMetricLabels,
RadarAxisHighlight,
} from '@mui/x-charts/RadarChart';
import { ChartsSurface } from '@mui/x-charts/ChartsSurface';
import { ChartsLegend } from '@mui/x-charts/ChartsLegend';
export default function CompositionExample() {
return (
<RadarDataProvider height={300} series={series} radar={radar} margin={margin}>
<Stack direction="column" sx={{ alignItems: 'center', gap: 1, width: '100%' }}>
<ChartsLegend />
<ChartsSurface>
<RadarGrid divisions={5} />
<RadarMetricLabels />
<RadarSeriesArea
fillOpacity={0.4}
strokeWidth={1}
seriesId="australia-id"
/>
<RadarSeriesArea
fill="transparent"
strokeWidth={1}
seriesId="usa-id"
strokeDasharray="4, 4"
strokeLinecap="round"
/>
<RadarAxisHighlight />
<RadarSeriesMarks />
</ChartsSurface>
</Stack>
</RadarDataProvider>
);
}
// Data from https://ourworldindata.org/emissions-by-fuel
const series = [
{
id: 'usa-id',
label: 'USA',
data: [6.65, 2.76, 5.15, 0.19, 0.07, 0.12],
fillArea: true,
},
{
id: 'australia-id',
label: 'Australia',
data: [5.52, 5.5, 3.19, 0.51, 0.15, 0.11],
fillArea: true,
},
];
const radar = {
metrics: ['Oil', 'Coal', 'Gas', 'Flaring', 'Other\nindustry', 'Cement'],
};
const margin = { left: 50, right: 50 };
레이더 차트가 어떻게 구성되는지는 다음과 같아요:
<RadarDataProvider>
<ChartsWrapper>
<ChartsLegend />
<ChartsSurface>
{/* The background of the chart */}
<RadarGrid />
<RadarMetricLabels />
{/* The data with axis highlight on top of area and below marks */}
<RadarSeriesArea />
<RadarAxisHighlight />
<RadarSeriesMarks />
<FocusedRadarMark />
{/* Other components */}
<ChartsOverlay />
</ChartsSurface>
<ChartsTooltip />
</ChartsWrapper>
</RadarDataProvider>