import { useMemo } from "react"
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card"
import { LineChart } from "@/components/ui/line-chart"
import { useIsMobile } from "@/hooks/use-mobile"
export default function LineChartStackedDemo() {
const isMobile = useIsMobile()
const data = useMemo(
() =>
Array.from({ length: 7 }, (_, i) => ({
day: `Day ${i + 1}`,
likes: Math.floor(100 + Math.random() * 300),
comments: Math.floor(20 + Math.random() * 80),
shares: Math.floor(10 + Math.random() * 50),
})),
[],
)
return (
<Card>
<CardHeader>
<CardTitle>Engagement last 7d</CardTitle>
<CardDescription>
Tracks likes, comments, and shares during the most recent 7-day period.
</CardDescription>
</CardHeader>
<CardContent>
<LineChart
containerHeight={isMobile ? 200 : 300}
data={data}
dataKey="day"
type="stacked"
lineProps={{
type: "basis",
}}
xAxisProps={{ interval: 0 }}
config={{
likes: { label: "Likes" },
comments: { label: "Comments" },
shares: { label: "Shares" },
}}
/>
</CardContent>
</Card>
)
}
npx shadcn@latest add @intentui/line-chart-stacked-demoUsage varies by registry entry. Refer to the registry docs or source files below for details.