shadcn-vue/apps/www/registry/default/example/DonutChartCustomTooltip.vue
2024-11-21 11:52:31 +08:00

23 lines
1022 B
Vue

<script setup lang="ts">
import { DonutChart } from '@/lib/registry/default/ui/chart-donut'
import CustomChartTooltip from './CustomChartTooltip.vue'
const data = [
{ name: 'Jan', total: Math.floor(Math.random() * 2000) + 500, predicted: Math.floor(Math.random() * 2000) + 500 },
{ name: 'Feb', total: Math.floor(Math.random() * 2000) + 500, predicted: Math.floor(Math.random() * 2000) + 500 },
{ name: 'Mar', total: Math.floor(Math.random() * 2000) + 500, predicted: Math.floor(Math.random() * 2000) + 500 },
{ name: 'Apr', total: Math.floor(Math.random() * 2000) + 500, predicted: Math.floor(Math.random() * 2000) + 500 },
{ name: 'May', total: Math.floor(Math.random() * 2000) + 500, predicted: Math.floor(Math.random() * 2000) + 500 },
{ name: 'Jun', total: Math.floor(Math.random() * 2000) + 500, predicted: Math.floor(Math.random() * 2000) + 500 },
]
</script>
<template>
<DonutChart
index="name"
:category="'total'"
:data="data"
:custom-tooltip="CustomChartTooltip"
/>
</template>