chart
Area chart with glowing dot markers
Area chart with glowing dot markers
Загрузка превью…
src/chart/c-chart-16.vue
<!--
Замена библиотеки: см. c-chart-13.vue / docs/PORTING.md §19/§27. Свечение
(`feGaussianBlur`/`feComposite` SVG-фильтры) и маркеры точек на линии
(`dot`/`activeDot`) не переносятся — `AreaChart` не принимает произвольный
SVG-фильтр на линию/область и не рисует точки-маркеры по умолчанию.
-->
<script setup lang="ts">
import { AreaChart, CurveType } from "vue-chrts"
import { Badge } from "@/components/reui/badge"
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card"
import { ChartContainer, type ChartConfig } from "@/components/ui/chart"
const chartData = [
{ week: "W1", signups: 64 },
{ week: "W2", signups: 78 },
{ week: "W3", signups: 52 },
{ week: "W4", signups: 92 },
{ week: "W5", signups: 85 },
{ week: "W6", signups: 110 },
{ week: "W7", signups: 98 },
{ week: "W8", signups: 125 },
]
const chartConfig = {
signups: { label: "Signups", color: "var(--chart-3)" },
} satisfies ChartConfig
const categories = { signups: { name: "Signups", color: "var(--chart-3)" } }
function xFormatter(tick: number) {
return chartData[tick]?.week ?? ""
}
</script>
<template>
<Card class="w-full max-w-md">
<CardHeader>
<CardTitle>
New Signups
<Badge variant="success-light" class="ml-2">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" class="lucide lucide-trending-up">
<path d="M16 7h6v6" />
<path d="m22 7-8.5 8.5-5-5L2 17" />
</svg>
+144%
</Badge>
</CardTitle>
<CardDescription>Weekly user registration trends</CardDescription>
</CardHeader>
<CardContent>
<ChartContainer :config="chartConfig">
<AreaChart
:data="chartData"
:categories="categories"
:height="200"
:x-formatter="xFormatter"
:curve-type="CurveType.Natural"
:line-width="2"
:duration="0"
hide-tooltip
hide-legend
/>
</ChartContainer>
</CardContent>
</Card>
</template>