Skip to content

Commit

Permalink
refactor: add end angle
Browse files Browse the repository at this point in the history
  • Loading branch information
Siumauricio committed Jan 4, 2025
1 parent 194cc03 commit 198cdf0
Showing 1 changed file with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ export function DiskChart({ data }: RadialChartProps) {

const chartData = [
{
name: "Used",
value: diskUsed,
disk: 25,
fill: "hsl(var(--chart-2))",
},
];
Expand All @@ -41,6 +40,8 @@ export function DiskChart({ data }: RadialChartProps) {
},
} satisfies ChartConfig;

const endAngle = (diskUsed * 360) / 100;

return (
<Card className="flex flex-col bg-transparent">
<CardHeader className="items-center border-b pb-5">
Expand All @@ -54,8 +55,8 @@ export function DiskChart({ data }: RadialChartProps) {
>
<RadialBarChart
data={chartData}
startAngle={180}
endAngle={0}
startAngle={0}
endAngle={endAngle}
innerRadius={80}
outerRadius={110}
>
Expand All @@ -67,7 +68,7 @@ export function DiskChart({ data }: RadialChartProps) {
polarRadius={[86, 74]}
/>
<RadialBar
dataKey="value"
dataKey="disk"
background
cornerRadius={10}
fill="hsl(var(--chart-2))"
Expand Down

0 comments on commit 198cdf0

Please sign in to comment.