ChartAreaInteractive() — ui Function Reference
Architecture documentation for the ChartAreaInteractive() function in chart-area-interactive.tsx from the ui codebase.
Entity Profile
Dependency Diagram
graph TD e60e374b_3f90_4eb7_fd7b_6b013fd7b99a["ChartAreaInteractive()"] 4ed8b911_419f_bdc4_116b_8cd786bcd67f["chart-area-interactive.tsx"] e60e374b_3f90_4eb7_fd7b_6b013fd7b99a -->|defined in| 4ed8b911_419f_bdc4_116b_8cd786bcd67f style e60e374b_3f90_4eb7_fd7b_6b013fd7b99a fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
apps/v4/registry/new-york-v4/charts/chart-area-interactive.tsx lines 139–266
export function ChartAreaInteractive() {
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 (
<Card className="pt-0">
<CardHeader className="flex items-center gap-2 space-y-0 border-b py-5 sm:flex-row">
<div className="grid flex-1 gap-1">
<CardTitle>Area Chart - Interactive</CardTitle>
<CardDescription>
Showing total visitors for the last 3 months
</CardDescription>
</div>
<Select value={timeRange} onValueChange={setTimeRange}>
<SelectTrigger
className="hidden 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>
</CardHeader>
<CardContent className="px-2 pt-4 sm:px-6 sm:pt-6">
<ChartContainer
config={chartConfig}
className="aspect-auto h-[250px] w-full"
>
<AreaChart data={filteredData}>
<defs>
<linearGradient id="fillDesktop" x1="0" y1="0" x2="0" y2="1">
<stop
offset="5%"
stopColor="var(--color-desktop)"
stopOpacity={0.8}
/>
<stop
offset="95%"
stopColor="var(--color-desktop)"
stopOpacity={0.1}
/>
</linearGradient>
<linearGradient id="fillMobile" x1="0" y1="0" x2="0" y2="1">
<stop
offset="5%"
stopColor="var(--color-mobile)"
stopOpacity={0.8}
/>
<stop
offset="95%"
stopColor="var(--color-mobile)"
stopOpacity={0.1}
/>
</linearGradient>
</defs>
<CartesianGrid vertical={false} />
<XAxis
dataKey="date"
Domain
Subdomains
Source
Frequently Asked Questions
What does ChartAreaInteractive() do?
ChartAreaInteractive() is a function in the ui codebase, defined in apps/v4/registry/new-york-v4/charts/chart-area-interactive.tsx.
Where is ChartAreaInteractive() defined?
ChartAreaInteractive() is defined in apps/v4/registry/new-york-v4/charts/chart-area-interactive.tsx at line 139.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free