AreaChart
면적으로 수량 변화를 직관적으로 표현하는 에리어 차트 컴포넌트입니다. 시계열 데이터의 추이나 누적 비율 표시에 적합하며, solid와 gradient 두 가지 스타일로 시각적 인상을 조정할 수 있습니다.
Playground
<Chart config={chartConfig} className="min-h-[200px]">
<AreaChart accessibilityLayer data={chartData}>
<CartesianGrid vertical={false} />
<Chart.XAxis dataKey="month" tickLine={false} tickMargin={10} axisLine={false} />
<Chart.Tooltip content={<Chart.TooltipContent />} />
<Chart.Legend content={<Chart.LegendContent />} />
<Chart.Area dataKey="desktop" fill="var(--color-desktop)" stroke="var(--color-desktop)" />
<Chart.Area dataKey="mobile" fill="var(--color-mobile)" stroke="var(--color-mobile)" />
</AreaChart>
</Chart>JSX Composition
Chart.*는 이 라이브러리에서, 그 외는 Recharts에서 import하세요.
<CartesianGrid /><Chart.YAxis /><Chart.Legend /><LabelList />Patterns
AreaChart의 주요 표시 패턴입니다. 용도에 맞게 선택하세요.
Default
단일 시리즈 기본 에리어 차트
Multiple Areas
여러 시리즈를 겹쳐 비교
Stacked
여러 시리즈를 쌓아 합계 시각화
Gradient
그라디언트 채우기로 깊이감 있는 표현
Tooltip Styles
Chart.TooltipContent의 indicator prop으로 툴팁 인디케이터 모양을 변경할 수 있습니다.
Dot (default)
기본 도트 인디케이터
indicator="dot"Line
수직선 인디케이터
indicator="line"Dashed
점선 인디케이터
indicator="dashed"API
Component Structure
Chart— Recharts.AreaProps에리어(type, variant, dot, fillOpacity).XAxisX축.YAxisY축.Tooltip툴팁 래퍼.TooltipContentProps툴팁 내용.Legend레전드 래퍼.LegendContent레전드 내용Props
Chart
config—ChartConfig차트 설정 객체(레이블 및 컬러 정의)
children—ReactElementRecharts 차트 컴포넌트
idundefinedstring차트의 고유 ID(CSS 변수 스코핑용)
hoverFadefalseboolean호버한 시리즈를 풀 컬러로 표시하고 나머지는 페이드 아웃하는 하이라이트 효과를 활성화합니다
| Name | Type | Default | Description |
|---|---|---|---|
config | ChartConfig | — | 차트 설정 객체(레이블 및 컬러 정의) |
children | ReactElement | — | Recharts 차트 컴포넌트 |
id | string | undefined | 차트의 고유 ID(CSS 변수 스코핑용) |
hoverFade | boolean | false | 호버한 시리즈를 풀 컬러로 표시하고 나머지는 페이드 아웃하는 하이라이트 효과를 활성화합니다 |
Chart.Area
type"monotone""linear" | "monotone" | "step" | "natural"곡선 보간 방식
variant"solid""solid" | "gradient"채우기 스타일. "gradient"는 SVG linearGradient 자동 생성
dottrueboolean데이터 포인트 도트 표시
activeDottrueboolean호버 시 강조 도트 표시
fillOpacity0.4number영역 불투명도(0~1). gradient variant에서는 무시됨
| Name | Type | Default | Description |
|---|---|---|---|
type | "linear" | "monotone" | "step" | "natural" | "monotone" | 곡선 보간 방식 |
variant | "solid" | "gradient" | "solid" | 채우기 스타일. "gradient"는 SVG linearGradient 자동 생성 |
dot | boolean | true | 데이터 포인트 도트 표시 |
activeDot | boolean | true | 호버 시 강조 도트 표시 |
fillOpacity | number | 0.4 | 영역 불투명도(0~1). gradient variant에서는 무시됨 |
Chart.TooltipContent
indicator"dot""dot" | "line" | "dashed"인디케이터 모양
hideLabelfalseboolean레이블 숨김
hideIndicatorfalseboolean인디케이터 숨김
colorundefinedstring인디케이터 컬러 직접 지정. 미지정 시 페이로드 컬러 사용
labelClassNameundefinedstring레이블 요소에 추가할 CSS 클래스
nameKeyundefinedstring데이터 키 이름 매핑
labelKeyundefinedstring레이블 키 매핑
labelFormatterundefined(value, payload) => ReactNode레이블 커스텀 포매터
formatterundefined(value, name, item, index, payload) => ReactNode값 커스텀 포매터
| Name | Type | Default | Description |
|---|---|---|---|
indicator | "dot" | "line" | "dashed" | "dot" | 인디케이터 모양 |
hideLabel | boolean | false | 레이블 숨김 |
hideIndicator | boolean | false | 인디케이터 숨김 |
color | string | undefined | 인디케이터 컬러 직접 지정. 미지정 시 페이로드 컬러 사용 |
labelClassName | string | undefined | 레이블 요소에 추가할 CSS 클래스 |
nameKey | string | undefined | 데이터 키 이름 매핑 |
labelKey | string | undefined | 레이블 키 매핑 |
labelFormatter | (value, payload) => ReactNode | undefined | 레이블 커스텀 포매터 |
formatter | (value, name, item, index, payload) => ReactNode | undefined | 값 커스텀 포매터 |
Chart.LegendContent
hideIconfalseboolean아이콘 숨김
nameKeyundefinedstring데이터 키 이름 매핑
verticalAlign"bottom""top" | "middle" | "bottom"수직 위치(Recharts Legend에서 자동 주입)
align"center""left" | "center" | "right"수평 위치(Recharts Legend에서 자동 주입)
layout"horizontal""horizontal" | "vertical"레이아웃 방향(Recharts Legend에서 자동 주입)
| Name | Type | Default | Description |
|---|---|---|---|
hideIcon | boolean | false | 아이콘 숨김 |
nameKey | string | undefined | 데이터 키 이름 매핑 |
verticalAlign | "top" | "middle" | "bottom" | "bottom" | 수직 위치(Recharts Legend에서 자동 주입) |
align | "left" | "center" | "right" | "center" | 수평 위치(Recharts Legend에서 자동 주입) |
layout | "horizontal" | "vertical" | "horizontal" | 레이아웃 방향(Recharts Legend에서 자동 주입) |
Chart.XAxis / Chart.YAxis
tick{ style: { fontSize, fill } }object축 레이블 스타일. 기본적으로 디자인 토큰(--font-size-2xs, --color-text-subtle) 적용. 커스텀 객체로 덮어쓰기 가능
width (YAxis)"auto"number | "auto"Y축 너비. "auto"로 데이터에 맞게 자동 조정. 숫자로 고정 너비 지정 가능
...props—XAxisProps | YAxisPropsRecharts XAxis / YAxis의 모든 속성을 그대로 사용 가능
| Name | Type | Default | Description |
|---|---|---|---|
tick | object | { style: { fontSize, fill } } | 축 레이블 스타일. 기본적으로 디자인 토큰(--font-size-2xs, --color-text-subtle) 적용. 커스텀 객체로 덮어쓰기 가능 |
width (YAxis) | number | "auto" | "auto" | Y축 너비. "auto"로 데이터에 맞게 자동 조정. 숫자로 고정 너비 지정 가능 |
...props | XAxisProps | YAxisProps | — | Recharts XAxis / YAxis의 모든 속성을 그대로 사용 가능 |
Anatomy
Best Practices
권장
- ✓ChartConfig으로 레이블과 컬러를 일원 관리하세요
- ✓accessibilityLayer를 반드시 활성화하세요
- ✓누적 에리어에는 stackId를 통일하세요
- ✓gradient로 시각적 깊이를 더하세요
지양
- ✗하드코딩된 컬러 값을 직접 사용하지 마세요
- ✗컨테이너 크기 없이 차트를 배치하지 마세요
- ✗하나의 차트에 시리즈를 5개 이상 넣지 마세요
- ✗stacked에서 불투명도를 너무 높게 설정하면 겹침이 보이지 않습니다
Accessibility
키보드 조작
ARIA / WCAG
accessibilityLayer키보드 및 스크린 리더 지원- Tooltip으로 데이터 값을 텍스트로 제공
- Legend로 시리즈 식별 가능
- 컬러 토큰으로 다크 모드 자동 대응