From 830da49c5f30ee6fde9d03b5532bb08f4784f01e Mon Sep 17 00:00:00 2001 From: Usman Baig Date: Sat, 21 Mar 2026 22:55:19 +0100 Subject: [PATCH] feat: add bar chart toggle to dashboard Added visx bar chart component with rounded corners and grow animation. Dashboard now has area/bar toggle buttons next to the export icon. --- components/dashboard/Chart.tsx | 119 +++-- components/ui/bar-chart.tsx | 867 +++++++++++++++++++++++++++++++++ package-lock.json | 14 + package.json | 1 + 4 files changed, 966 insertions(+), 35 deletions(-) create mode 100644 components/ui/bar-chart.tsx diff --git a/components/dashboard/Chart.tsx b/components/dashboard/Chart.tsx index 8e4938d..e78c424 100644 --- a/components/dashboard/Chart.tsx +++ b/components/dashboard/Chart.tsx @@ -3,6 +3,8 @@ import { useState, useMemo, useRef, useCallback, useEffect } from 'react' import { useTheme } from '@ciphera-net/ui' import { AreaChart as VisxAreaChart, Area as VisxArea, Grid as VisxGrid, XAxis as VisxXAxis, YAxis as VisxYAxis, ChartTooltip as VisxChartTooltip, type TooltipRow } from '@/components/ui/area-chart' +import { BarChart as VisxBarChart, Bar as VisxBar, Grid as VisxBarGrid, BarXAxis as VisxBarXAxis, ChartTooltip as VisxBarChartTooltip } from '@/components/ui/bar-chart' +import { ChartLine, ChartBar } from '@phosphor-icons/react' import { Card, CardContent, CardHeader } from '@/components/ui/card' import { formatNumber, formatDuration, formatUpdatedAgo, DatePicker } from '@ciphera-net/ui' import { Select, DownloadIcon, PlusIcon, XIcon } from '@ciphera-net/ui' @@ -132,6 +134,7 @@ export default function Chart({ onDeleteAnnotation, }: ChartProps) { const [metric, setMetric] = useState('visitors') + const [chartType, setChartType] = useState<'area' | 'bar'>('area') const chartContainerRef = useRef(null) const { resolvedTheme } = useTheme() const [showComparison, setShowComparison] = useState(false) @@ -392,6 +395,23 @@ export default function Chart({ /> ) : null} +
+ + +
+