Component Library
Browse and explore components
Area chart
An Area Chart is a data visualization component used to display quantitative data trends over time, emphasizing the magnitude of change with filled areas beneath the lines.
Default
Component Code
Copy Code
'use client'
import { Area, AreaChart, CartesianGrid, XAxis } from 'recharts'
import {
ChartConfig,
ChartContainer,
ChartTooltip,
ChartTooltipContent,
} from '@/components/ui/chart'
export const description = 'A simple area chart'
const chartData = [
{ month: 'January', desktop: 186 },
{ month: 'February', desktop: 305 },
{ month: 'March', desktop: 237 },
{ month: 'April', desktop: 73 },
{ month: 'May', desktop: 209 },
{ month: 'June', desktop: 214 },
]
const chartConfig = {
desktop: {
label: 'Desktop',
color: 'var(--chart-1)',
},
} satisfies ChartConfig
export default function ChartAreaDefaultCode() {
return (
<>
<div>
<ChartContainer config={chartConfig}>
<AreaChart
accessibilityLayer
data={chartData}
margin={{
left: 12,
right: 12,
}}>
<CartesianGrid vertical={false} />
<XAxis
dataKey='month'
tickLine={false}
axisLine={false}
tickMargin={8}
tickFormatter={(value) => value.slice(0, 3)}
/>
<ChartTooltip
cursor={false}
content={<ChartTooltipContent indicator='line' />}
/>
<Area
dataKey='desktop'
type='natural'
fill='var(--color-primary)'
fillOpacity={0.4}
stroke='var(--color-primary)'
/>
</AreaChart>
</ChartContainer>
</div>
</>
)
}
Linear
Component Code
Copy Code
'use client'
import { Area, AreaChart, CartesianGrid, XAxis } from 'recharts'
import {
ChartConfig,
ChartContainer,
ChartTooltip,
ChartTooltipContent,
} from '@/components/ui/chart'
export const description = 'A linear area chart'
const chartData = [
{ month: 'January', desktop: 186 },
{ month: 'February', desktop: 305 },
{ month: 'March', desktop: 237 },
{ month: 'April', desktop: 73 },
{ month: 'May', desktop: 209 },
{ month: 'June', desktop: 214 },
]
const chartConfig = {
desktop: {
label: 'Desktop',
color: 'var(--chart-1)',
},
} satisfies ChartConfig
export default function LinearCode() {
return (
<>
<div>
<ChartContainer config={chartConfig}>
<AreaChart
accessibilityLayer
data={chartData}
margin={{
left: 12,
right: 12,
}}>
<CartesianGrid vertical={false} />
<XAxis
dataKey='month'
tickLine={false}
axisLine={false}
tickMargin={8}
tickFormatter={(value) => value.slice(0, 3)}
/>
<ChartTooltip
cursor={false}
content={<ChartTooltipContent indicator='dot' hideLabel />}
/>
<Area
dataKey='desktop'
type='linear'
fill='var(--color-secondary)'
fillOpacity={0.4}
stroke='var(--color-secondary)'
/>
</AreaChart>
</ChartContainer>
</div>
</>
)
}
Step
Component Code
Copy Code
'use client'
import { Activity } from 'lucide-react'
import { Area, AreaChart, CartesianGrid, XAxis } from 'recharts'
import {
ChartConfig,
ChartContainer,
ChartTooltip,
ChartTooltipContent,
} from '@/components/ui/chart'
export const description = 'A step area chart'
const chartData = [
{ month: 'January', desktop: 186 },
{ month: 'February', desktop: 305 },
{ month: 'March', desktop: 237 },
{ month: 'April', desktop: 73 },
{ month: 'May', desktop: 209 },
{ month: 'June', desktop: 214 },
]
const chartConfig = {
desktop: {
label: 'Desktop',
color: 'var(--chart-1)',
icon: Activity,
},
} satisfies ChartConfig
export default function ChartAreaStepCode() {
return (
<>
<div>
<ChartContainer config={chartConfig}>
<AreaChart
accessibilityLayer
data={chartData}
margin={{
left: 12,
right: 12,
}}>
<CartesianGrid vertical={false} />
<XAxis
dataKey='month'
tickLine={false}
axisLine={false}
tickMargin={8}
tickFormatter={(value) => value.slice(0, 3)}
/>
<ChartTooltip
cursor={false}
content={<ChartTooltipContent hideLabel />}
/>
<Area
dataKey='desktop'
type='step'
fill='var(--color-primary)'
fillOpacity={0.4}
stroke='var(--color-primary)'
/>
</AreaChart>
</ChartContainer>
</div>
</>
)
}
Legend
Component Code
Copy Code
'use client'
import { Area, AreaChart, CartesianGrid, XAxis } from 'recharts'
import {
ChartConfig,
ChartContainer,
ChartLegend,
ChartLegendContent,
ChartTooltip,
ChartTooltipContent,
} from '@/components/ui/chart'
export const description = 'An area chart with a legend'
const chartData = [
{ month: 'January', desktop: 186, mobile: 80 },
{ month: 'February', desktop: 305, mobile: 200 },
{ month: 'March', desktop: 237, mobile: 120 },
{ month: 'April', desktop: 73, mobile: 190 },
{ month: 'May', desktop: 209, mobile: 130 },
{ month: 'June', desktop: 214, mobile: 140 },
]
const chartConfig = {
desktop: {
label: 'Desktop',
color: 'var(--chart-1)',
},
mobile: {
label: 'Mobile',
color: 'var(--chart-2)',
},
} satisfies ChartConfig
export default function ChartAreaLegendCode() {
return (
<>
<div>
<ChartContainer config={chartConfig}>
<AreaChart
accessibilityLayer
data={chartData}
margin={{
left: 12,
right: 12,
}}>
<CartesianGrid vertical={false} />
<XAxis
dataKey='month'
tickLine={false}
axisLine={false}
tickMargin={8}
tickFormatter={(value) => value.slice(0, 3)}
/>
<ChartTooltip
cursor={false}
content={<ChartTooltipContent indicator='line' />}
/>
<Area
dataKey='mobile'
type='natural'
fill='var(--color-secondary)'
fillOpacity={0.4}
stroke='var(--color-secondary)'
stackId='a'
/>
<Area
dataKey='desktop'
type='natural'
fill='var(--color-primary)'
fillOpacity={0.4}
stroke='var(--color-primary)'
stackId='a'
/>
<ChartLegend content={<ChartLegendContent />} />
</AreaChart>
</ChartContainer>
</div>
</>
)
}
Stacked
Component Code
Copy Code
'use client'
import { Area, AreaChart, CartesianGrid, XAxis } from 'recharts'
import {
ChartConfig,
ChartContainer,
ChartTooltip,
ChartTooltipContent,
} from '@/components/ui/chart'
export const description = 'A stacked area chart'
const chartData = [
{ month: 'January', desktop: 186, mobile: 80 },
{ month: 'February', desktop: 305, mobile: 200 },
{ month: 'March', desktop: 237, mobile: 120 },
{ month: 'April', desktop: 73, mobile: 190 },
{ month: 'May', desktop: 209, mobile: 130 },
{ month: 'June', desktop: 214, mobile: 140 },
]
const chartConfig = {
desktop: {
label: 'Desktop',
color: 'var(--chart-1)',
},
mobile: {
label: 'Mobile',
color: 'var(--chart-2)',
},
} satisfies ChartConfig
export default function ChartAreaStackedCode() {
return (
<>
<div>
<ChartContainer config={chartConfig}>
<AreaChart
accessibilityLayer
data={chartData}
margin={{
left: 12,
right: 12,
}}>
<CartesianGrid vertical={false} />
<XAxis
dataKey='month'
tickLine={false}
axisLine={false}
tickMargin={8}
tickFormatter={(value) => value.slice(0, 3)}
/>
<ChartTooltip
cursor={false}
content={<ChartTooltipContent indicator='dot' />}
/>
<Area
dataKey='mobile'
type='natural'
fill='var(--color-secondary)'
fillOpacity={0.4}
stroke='var(--color-secondary)'
stackId='a'
/>
<Area
dataKey='desktop'
type='natural'
fill='var(--color-primary)'
fillOpacity={0.4}
stroke='var(--color-primary)'
stackId='a'
/>
</AreaChart>
</ChartContainer>
</div>
</>
)
}
Stacked Expanded
Component Code
Copy Code
'use client'
import { Area, AreaChart, CartesianGrid, XAxis } from 'recharts'
import {
ChartConfig,
ChartContainer,
ChartTooltip,
ChartTooltipContent,
} from '@/components/ui/chart'
export const description = 'A stacked area chart with expand stacking'
const chartData = [
{ month: 'January', desktop: 186, mobile: 80, other: 45 },
{ month: 'February', desktop: 305, mobile: 200, other: 100 },
{ month: 'March', desktop: 237, mobile: 120, other: 150 },
{ month: 'April', desktop: 73, mobile: 190, other: 50 },
{ month: 'May', desktop: 209, mobile: 130, other: 100 },
{ month: 'June', desktop: 214, mobile: 140, other: 160 },
]
const chartConfig = {
desktop: {
label: 'Desktop',
color: 'var(--chart-1)',
},
mobile: {
label: 'Mobile',
color: 'var(--chart-2)',
},
other: {
label: 'Other',
color: 'var(--chart-3)',
},
} satisfies ChartConfig
export default function ChartAreaStackedExpandCode() {
return (
<>
<div>
<ChartContainer config={chartConfig}>
<AreaChart
accessibilityLayer
data={chartData}
margin={{
left: 12,
right: 12,
top: 12,
}}
stackOffset='expand'>
<CartesianGrid vertical={false} />
<XAxis
dataKey='month'
tickLine={false}
axisLine={false}
tickMargin={8}
tickFormatter={(value) => value.slice(0, 3)}
/>
<ChartTooltip
cursor={false}
content={<ChartTooltipContent indicator='line' />}
/>
<Area
dataKey='other'
type='natural'
fill='var(--color-lightprimary)'
fillOpacity={1}
stroke='var(--color-lightprimary)'
stackId='a'
/>
<Area
dataKey='mobile'
type='natural'
fill='var(--color-secondary)'
fillOpacity={0.4}
stroke='var(--color-secondary)'
stackId='a'
/>
<Area
dataKey='desktop'
type='natural'
fill='var(--color-primary)'
fillOpacity={0.4}
stroke='var(--color-primary)'
stackId='a'
/>
</AreaChart>
</ChartContainer>
</div>
</>
)
}
Icons
Component Code
Copy Code
'use client'
import { TrendingDown, TrendingUp } from 'lucide-react'
import { Area, AreaChart, CartesianGrid, XAxis } from 'recharts'
import {
ChartConfig,
ChartContainer,
ChartLegend,
ChartLegendContent,
ChartTooltip,
ChartTooltipContent,
} from '@/components/ui/chart'
export const description = 'An area chart with icons'
const chartData = [
{ month: 'January', desktop: 186, mobile: 80 },
{ month: 'February', desktop: 305, mobile: 200 },
{ month: 'March', desktop: 237, mobile: 120 },
{ month: 'April', desktop: 73, mobile: 190 },
{ month: 'May', desktop: 209, mobile: 130 },
{ month: 'June', desktop: 214, mobile: 140 },
]
const chartConfig = {
desktop: {
label: 'Desktop',
color: 'var(--chart-1)',
icon: TrendingDown,
},
mobile: {
label: 'Mobile',
color: 'var(--chart-2)',
icon: TrendingUp,
},
} satisfies ChartConfig
export default function ChartAreaIconsCode() {
return (
<>
<div>
<ChartContainer config={chartConfig}>
<AreaChart
accessibilityLayer
data={chartData}
margin={{
left: 12,
right: 12,
}}>
<CartesianGrid vertical={false} />
<XAxis
dataKey='month'
tickLine={false}
axisLine={false}
tickMargin={8}
tickFormatter={(value) => value.slice(0, 3)}
/>
<ChartTooltip
cursor={false}
content={<ChartTooltipContent indicator='line' />}
/>
<Area
dataKey='mobile'
type='natural'
fill='var(--color-secondary)'
fillOpacity={0.4}
stroke='var(--color-secondary)'
stackId='a'
/>
<Area
dataKey='desktop'
type='natural'
fill='var(--color-primary)'
fillOpacity={0.4}
stroke='var(--color-primary)'
stackId='a'
/>
<ChartLegend content={<ChartLegendContent />} />
</AreaChart>
</ChartContainer>
</div>
</>
)
}
Gradient
Component Code
Copy Code
'use client'
import { Area, AreaChart, CartesianGrid, XAxis } from 'recharts'
import {
ChartConfig,
ChartContainer,
ChartTooltip,
ChartTooltipContent,
} from '@/components/ui/chart'
export const description = 'An area chart with gradient fill'
const chartData = [
{ month: 'January', desktop: 186, mobile: 80 },
{ month: 'February', desktop: 305, mobile: 200 },
{ month: 'March', desktop: 237, mobile: 120 },
{ month: 'April', desktop: 73, mobile: 190 },
{ month: 'May', desktop: 209, mobile: 130 },
{ month: 'June', desktop: 214, mobile: 140 },
]
const chartConfig = {
desktop: {
label: 'Desktop',
color: 'var(--chart-1)',
},
mobile: {
label: 'Mobile',
color: 'var(--chart-2)',
},
} satisfies ChartConfig
export default function ChartAreaGradientCode() {
return (
<>
<div>
<ChartContainer config={chartConfig}>
<AreaChart
accessibilityLayer
data={chartData}
margin={{
left: 12,
right: 12,
}}>
<CartesianGrid vertical={false} />
<XAxis
dataKey='month'
tickLine={false}
axisLine={false}
tickMargin={8}
tickFormatter={(value) => value.slice(0, 3)}
/>
<ChartTooltip cursor={false} content={<ChartTooltipContent />} />
<defs>
<linearGradient id='fillDesktop' x1='0' y1='0' x2='0' y2='1'>
<stop
offset='5%'
stopColor='var(--color-primary)'
stopOpacity={0.8}
/>
<stop
offset='95%'
stopColor='var(--color-primary)'
stopOpacity={0.1}
/>
</linearGradient>
<linearGradient id='fillMobile' x1='0' y1='0' x2='0' y2='1'>
<stop
offset='5%'
stopColor='var(--color-secondary)'
stopOpacity={0.8}
/>
<stop
offset='95%'
stopColor='var(--color-secondary)'
stopOpacity={0.1}
/>
</linearGradient>
</defs>
<Area
dataKey='mobile'
type='natural'
fill='url(#fillMobile)'
fillOpacity={0.4}
stroke='var(--color-secondary)'
stackId='a'
/>
<Area
dataKey='desktop'
type='natural'
fill='url(#fillDesktop)'
fillOpacity={0.4}
stroke='var(--color-primary)'
stackId='a'
/>
</AreaChart>
</ChartContainer>
</div>
</>
)
}
Axes
Component Code
Copy Code
'use client'
import { Area, AreaChart, CartesianGrid, XAxis, YAxis } from 'recharts'
import {
ChartConfig,
ChartContainer,
ChartTooltip,
ChartTooltipContent,
} from '@/components/ui/chart'
export const description = 'An area chart with axes'
const chartData = [
{ month: 'January', desktop: 186, mobile: 80 },
{ month: 'February', desktop: 305, mobile: 200 },
{ month: 'March', desktop: 237, mobile: 120 },
{ month: 'April', desktop: 73, mobile: 190 },
{ month: 'May', desktop: 209, mobile: 130 },
{ month: 'June', desktop: 214, mobile: 140 },
]
const chartConfig = {
desktop: {
label: 'Desktop',
color: 'var(--chart-1)',
},
mobile: {
label: 'Mobile',
color: 'var(--chart-2)',
},
} satisfies ChartConfig
export default function ChartAreaAxesCode() {
return (
<>
<div>
<ChartContainer config={chartConfig}>
<AreaChart
accessibilityLayer
data={chartData}
margin={{
left: -20,
right: 12,
}}>
<CartesianGrid vertical={false} />
<XAxis
dataKey='month'
tickLine={false}
axisLine={false}
tickMargin={8}
tickFormatter={(value) => value.slice(0, 3)}
/>
<YAxis
tickLine={false}
axisLine={false}
tickMargin={8}
tickCount={3}
/>
<ChartTooltip cursor={false} content={<ChartTooltipContent />} />
<Area
dataKey='mobile'
type='natural'
fill='var(--color-secondary)'
fillOpacity={0.4}
stroke='var(--color-secondary)'
stackId='a'
/>
<Area
dataKey='desktop'
type='natural'
fill='var(--color-primary)'
fillOpacity={0.4}
stroke='var(--color-primary)'
stackId='a'
/>
</AreaChart>
</ChartContainer>
</div>
</>
)
}
Interactive
Component Code
Copy Code
'use client'
import * as React from 'react'
import { Area, AreaChart, CartesianGrid, XAxis } from 'recharts'
import {
ChartConfig,
ChartContainer,
ChartLegend,
ChartLegendContent,
ChartTooltip,
ChartTooltipContent,
} from '@/components/ui/chart'
import {
Select,
SelectContent,
SelectItem,
SelectTrigger,
SelectValue,
} from '@/components/ui/select'
export const description = 'An interactive area chart'
const chartData = [
{ date: '2024-04-01', desktop: 222, mobile: 150 },
{ date: '2024-04-02', desktop: 97, mobile: 180 },
{ date: '2024-04-03', desktop: 167, mobile: 120 },
{ date: '2024-04-04', desktop: 242, mobile: 260 },
{ date: '2024-04-05', desktop: 373, mobile: 290 },
{ date: '2024-04-06', desktop: 301, mobile: 340 },
{ date: '2024-04-07', desktop: 245, mobile: 180 },
{ date: '2024-04-08', desktop: 409, mobile: 320 },
{ date: '2024-04-09', desktop: 59, mobile: 110 },
{ date: '2024-04-10', desktop: 261, mobile: 190 },
{ date: '2024-04-11', desktop: 327, mobile: 350 },
{ date: '2024-04-12', desktop: 292, mobile: 210 },
{ date: '2024-04-13', desktop: 342, mobile: 380 },
{ date: '2024-04-14', desktop: 137, mobile: 220 },
{ date: '2024-04-15', desktop: 120, mobile: 170 },
{ date: '2024-04-16', desktop: 138, mobile: 190 },
{ date: '2024-04-17', desktop: 446, mobile: 360 },
{ date: '2024-04-18', desktop: 364, mobile: 410 },
{ date: '2024-04-19', desktop: 243, mobile: 180 },
{ date: '2024-04-20', desktop: 89, mobile: 150 },
{ date: '2024-04-21', desktop: 137, mobile: 200 },
{ date: '2024-04-22', desktop: 224, mobile: 170 },
{ date: '2024-04-23', desktop: 138, mobile: 230 },
{ date: '2024-04-24', desktop: 387, mobile: 290 },
{ date: '2024-04-25', desktop: 215, mobile: 250 },
{ date: '2024-04-26', desktop: 75, mobile: 130 },
{ date: '2024-04-27', desktop: 383, mobile: 420 },
{ date: '2024-04-28', desktop: 122, mobile: 180 },
{ date: '2024-04-29', desktop: 315, mobile: 240 },
{ date: '2024-04-30', desktop: 454, mobile: 380 },
{ date: '2024-05-01', desktop: 165, mobile: 220 },
{ date: '2024-05-02', desktop: 293, mobile: 310 },
{ date: '2024-05-03', desktop: 247, mobile: 190 },
{ date: '2024-05-04', desktop: 385, mobile: 420 },
{ date: '2024-05-05', desktop: 481, mobile: 390 },
{ date: '2024-05-06', desktop: 498, mobile: 520 },
{ date: '2024-05-07', desktop: 388, mobile: 300 },
{ date: '2024-05-08', desktop: 149, mobile: 210 },
{ date: '2024-05-09', desktop: 227, mobile: 180 },
{ date: '2024-05-10', desktop: 293, mobile: 330 },
{ date: '2024-05-11', desktop: 335, mobile: 270 },
{ date: '2024-05-12', desktop: 197, mobile: 240 },
{ date: '2024-05-13', desktop: 197, mobile: 160 },
{ date: '2024-05-14', desktop: 448, mobile: 490 },
{ date: '2024-05-15', desktop: 473, mobile: 380 },
{ date: '2024-05-16', desktop: 338, mobile: 400 },
{ date: '2024-05-17', desktop: 499, mobile: 420 },
{ date: '2024-05-18', desktop: 315, mobile: 350 },
{ date: '2024-05-19', desktop: 235, mobile: 180 },
{ date: '2024-05-20', desktop: 177, mobile: 230 },
{ date: '2024-05-21', desktop: 82, mobile: 140 },
{ date: '2024-05-22', desktop: 81, mobile: 120 },
{ date: '2024-05-23', desktop: 252, mobile: 290 },
{ date: '2024-05-24', desktop: 294, mobile: 220 },
{ date: '2024-05-25', desktop: 201, mobile: 250 },
{ date: '2024-05-26', desktop: 213, mobile: 170 },
{ date: '2024-05-27', desktop: 420, mobile: 460 },
{ date: '2024-05-28', desktop: 233, mobile: 190 },
{ date: '2024-05-29', desktop: 78, mobile: 130 },
{ date: '2024-05-30', desktop: 340, mobile: 280 },
{ date: '2024-05-31', desktop: 178, mobile: 230 },
{ date: '2024-06-01', desktop: 178, mobile: 200 },
{ date: '2024-06-02', desktop: 470, mobile: 410 },
{ date: '2024-06-03', desktop: 103, mobile: 160 },
{ date: '2024-06-04', desktop: 439, mobile: 380 },
{ date: '2024-06-05', desktop: 88, mobile: 140 },
{ date: '2024-06-06', desktop: 294, mobile: 250 },
{ date: '2024-06-07', desktop: 323, mobile: 370 },
{ date: '2024-06-08', desktop: 385, mobile: 320 },
{ date: '2024-06-09', desktop: 438, mobile: 480 },
{ date: '2024-06-10', desktop: 155, mobile: 200 },
{ date: '2024-06-11', desktop: 92, mobile: 150 },
{ date: '2024-06-12', desktop: 492, mobile: 420 },
{ date: '2024-06-13', desktop: 81, mobile: 130 },
{ date: '2024-06-14', desktop: 426, mobile: 380 },
{ date: '2024-06-15', desktop: 307, mobile: 350 },
{ date: '2024-06-16', desktop: 371, mobile: 310 },
{ date: '2024-06-17', desktop: 475, mobile: 520 },
{ date: '2024-06-18', desktop: 107, mobile: 170 },
{ date: '2024-06-19', desktop: 341, mobile: 290 },
{ date: '2024-06-20', desktop: 408, mobile: 450 },
{ date: '2024-06-21', desktop: 169, mobile: 210 },
{ date: '2024-06-22', desktop: 317, mobile: 270 },
{ date: '2024-06-23', desktop: 480, mobile: 530 },
{ date: '2024-06-24', desktop: 132, mobile: 180 },
{ date: '2024-06-25', desktop: 141, mobile: 190 },
{ date: '2024-06-26', desktop: 434, mobile: 380 },
{ date: '2024-06-27', desktop: 448, mobile: 490 },
{ date: '2024-06-28', desktop: 149, mobile: 200 },
{ date: '2024-06-29', desktop: 103, mobile: 160 },
{ date: '2024-06-30', desktop: 446, mobile: 400 },
]
const chartConfig = {
visitors: {
label: 'Visitors',
},
desktop: {
label: 'Desktop',
color: 'var(--chart-1)',
},
mobile: {
label: 'Mobile',
color: 'var(--chart-2)',
},
} satisfies ChartConfig
export default function ChartAreaInteractiveCode() {
const [timeRange, setTimeRange] = React.useState('90d')
const filteredData = chartData.filter((item) => {
const date = new Date(item.date)
const referenceDate = new Date('2024-06-30')
let daysToSubtract = 90
if (timeRange === '30d') {
daysToSubtract = 30
} else if (timeRange === '7d') {
daysToSubtract = 7
}
const startDate = new Date(referenceDate)
startDate.setDate(startDate.getDate() - daysToSubtract)
return date >= startDate
})
return (
<>
<div className='flex flex-col gap-5'>
<Select value={timeRange} onValueChange={setTimeRange}>
<SelectTrigger
className='w-[160px] rounded-lg sm:ml-auto sm:flex'
aria-label='Select a value'>
<SelectValue placeholder='Last 3 months' />
</SelectTrigger>
<SelectContent className='rounded-xl'>
<SelectItem value='90d' className='rounded-lg'>
Last 3 months
</SelectItem>
<SelectItem value='30d' className='rounded-lg'>
Last 30 days
</SelectItem>
<SelectItem value='7d' className='rounded-lg'>
Last 7 days
</SelectItem>
</SelectContent>
</Select>
<ChartContainer config={chartConfig}>
<AreaChart data={filteredData}>
<defs>
<linearGradient id='fillDesktop' x1='0' y1='0' x2='0' y2='1'>
<stop
offset='5%'
stopColor='var(--color-primary)'
stopOpacity={0.8}
/>
<stop
offset='95%'
stopColor='var(--color-primary)'
stopOpacity={0.1}
/>
</linearGradient>
<linearGradient id='fillMobile' x1='0' y1='0' x2='0' y2='1'>
<stop
offset='5%'
stopColor='var(--color-secondary)'
stopOpacity={0.8}
/>
<stop
offset='95%'
stopColor='var(--color-secondary)'
stopOpacity={0.1}
/>
</linearGradient>
</defs>
<CartesianGrid vertical={false} />
<XAxis
dataKey='date'
tickLine={false}
axisLine={false}
tickMargin={8}
minTickGap={32}
tickFormatter={(value) => {
const date = new Date(value)
return date.toLocaleDateString('en-US', {
month: 'short',
day: 'numeric',
})
}}
/>
<ChartTooltip
cursor={false}
content={
<ChartTooltipContent
labelFormatter={(value) => {
return new Date(value).toLocaleDateString('en-US', {
month: 'short',
day: 'numeric',
})
}}
indicator='dot'
/>
}
/>
<Area
dataKey='mobile'
type='natural'
fill='url(#fillMobile)'
stroke='var(--color-secondary)'
stackId='a'
/>
<Area
dataKey='desktop'
type='natural'
fill='url(#fillDesktop)'
stroke='var(--color-primary)'
stackId='a'
/>
<ChartLegend content={<ChartLegendContent />} />
</AreaChart>
</ChartContainer>
</div>
</>
)
}