@@ -15,10 +15,10 @@ import {
1515} from "@repo/ui"
1616import dayjs from "dayjs"
1717import { ArrowDown , TrendingUp } from "lucide-react"
18- import { Area , AreaChart , CartesianGrid , XAxis } from "recharts"
18+ import { Area , AreaChart , CartesianGrid , XAxis , YAxis } from "recharts"
1919
2020const chartConfig = {
21- totalSubscribers : {
21+ count : {
2222 label : "Total Subscribers" ,
2323 color : "hsl(var(--chart-1))" ,
2424 } ,
@@ -49,6 +49,10 @@ export const SubscriberGrowthChart = () => {
4949
5050 const isLoading = analyticsLoading || dashboardLoading
5151
52+ const maxCount = Math . max (
53+ ...( dashboard ?. subscriberGrowth . map ( ( item ) => item . count ) || [ ] )
54+ )
55+
5256 return (
5357 < Card hoverEffect className = "col-span-4" >
5458 < CardHeader >
@@ -79,16 +83,23 @@ export const SubscriberGrowthChart = () => {
7983 tickMargin = { 8 }
8084 tickFormatter = { ( value ) => dayjs ( value ) . format ( "DD MMM" ) }
8185 />
86+ < YAxis
87+ tickFormatter = { ( value ) => value . toLocaleString ( ) }
88+ tickLine = { false }
89+ axisLine = { false }
90+ tickMargin = { 8 }
91+ tickCount = { Math . min ( maxCount , 10 ) }
92+ />
8293 < ChartTooltip
8394 cursor = { false }
8495 content = { < ChartTooltipContent indicator = "dot" /> }
8596 />
8697 < Area
8798 dataKey = "count"
8899 type = "natural"
89- fill = "var(--color-totalSubscribers )"
100+ fill = "var(--color-count )"
90101 fillOpacity = { 0.4 }
91- stroke = "var(--color-totalSubscribers )"
102+ stroke = "var(--color-count )"
92103 stackId = "a"
93104 />
94105 </ AreaChart >
0 commit comments