chart
Vertical bar chart
Vertical bar chart
Загрузка превью…
src/chart/c-chart-12.vue
<!-- Замена библиотеки: см. c-chart-1.vue / docs/PORTING.md §19/§27. -->
<script setup lang="ts">
import { BarChart, Orientation } 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 = [
{ month: "Jan", desktop: 342, mobile: 245 },
{ month: "Feb", desktop: 876, mobile: 654 },
{ month: "Mar", desktop: 512, mobile: 389 },
{ month: "Apr", desktop: 629, mobile: 521 },
{ month: "May", desktop: 458, mobile: 367 },
{ month: "Jun", desktop: 781, mobile: 598 },
]
const chartConfig = {
desktop: { label: "Desktop", color: "var(--chart-1)" },
mobile: { label: "Mobile", color: "var(--chart-2)" },
} satisfies ChartConfig
const categories = {
desktop: { name: "Desktop", color: "var(--chart-1)" },
mobile: { name: "Mobile", color: "var(--chart-2)" },
}
</script>
<template>
<Card class="w-full max-w-md">
<CardHeader>
<CardTitle>
Inventory Levels
<Badge variant="destructive-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-down">
<path d="M16 17h6v-6" />
<path d="m22 17-8.5-8.5-5 5L2 7" />
</svg>
-3.2%
</Badge>
</CardTitle>
<CardDescription>Stock availability across warehouses</CardDescription>
</CardHeader>
<CardContent>
<ChartContainer :config="chartConfig">
<BarChart
:data="chartData"
x-axis="month"
:y-axis="['desktop', 'mobile']"
:categories="categories"
:height="200"
:radius="2"
:orientation="Orientation.Horizontal"
:duration="0"
hide-tooltip
hide-legend
hide-x-axis
/>
</ChartContainer>
</CardContent>
</Card>
</template>