Donut Chart
Native SVG donut chart with interactive legend — ideal for portfolio breakdown, categories, and percentage composition.
Default
Portfolio by type
import { DonutChart } from "@/components/blocks/donut-chart";
<DonutChart />
// Customizado:
<DonutChart
title="Receita por Segmento"
segments={[
{ name: "Residencial", value: 6730, color: "var(--chart-1)" },
{ name: "Comercial", value: 4120, color: "var(--chart-2)" },
{ name: "Industrial", value: 2800, color: "var(--chart-3)" },
{ name: "Misto", value: 1950, color: "var(--chart-4)" },
{ name: "Rural", value: 900, color: "var(--chart-5)" },
]}
valueFormatter={(n) =>
Intl.NumberFormat("pt-BR", { notation: "compact" }).format(n)
}
/>With description
With subtitle
<DonutChart
title="Despesas por Categoria"
description="Ano fiscal 2024"
segments={[
{ name: "Manutenção", value: 3800, color: "var(--chart-1)" },
{ name: "Administrativo", value: 2500, color: "var(--chart-2)" },
{ name: "Marketing", value: 1900, color: "var(--chart-3)" },
{ name: "Jurídico", value: 1100, color: "var(--chart-4)" },
]}
/>