Skip to content

Commit 8c443b6

Browse files
committed
add axis
1 parent 187975c commit 8c443b6

File tree

2 files changed

+21
-28
lines changed

2 files changed

+21
-28
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
.DS_Store
22
.venv
33
.tinyb
4+
.tmp

apps/web/src/components/tools/auth0/dau-chart.tsx

Lines changed: 20 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import {
1212
ChartConfig,
1313
ChartTooltipContent
1414
} from "@/components/ui/chart"
15-
import { Line, LineChart, XAxis } from "recharts"
15+
import { Line, LineChart, XAxis, YAxis } from "recharts"
1616

1717
interface DauDataPoint {
1818
day: string
@@ -41,8 +41,10 @@ export function DauChart({ data }: DauChartData) {
4141
<LineChart
4242
data={data}
4343
margin={{
44-
left: 12,
44+
left: 48,
4545
right: 12,
46+
top: 12,
47+
bottom: 32
4648
}}
4749
>
4850
<XAxis
@@ -52,37 +54,27 @@ export function DauChart({ data }: DauChartData) {
5254
tickMargin={8}
5355
interval="equidistantPreserveStart"
5456
tickFormatter={(value) => value.split('-')[2]}
57+
label={{
58+
value: "Day of Month",
59+
position: "bottom",
60+
offset: 20
61+
}}
62+
/>
63+
<YAxis
64+
tickLine={false}
65+
axisLine={false}
66+
tickMargin={8}
67+
label={{
68+
value: "Active Users",
69+
angle: -90,
70+
position: "left",
71+
offset: 32
72+
}}
5573
/>
5674
<ChartTooltip
5775
cursor={false}
5876
content={<ChartTooltipContent indicator="dot" />}
5977
/>
60-
{/* <ChartTooltip content={({ payload }) => {
61-
if (!payload?.length) return null
62-
63-
return (
64-
<div className="rounded-lg border bg-background p-2 shadow-sm">
65-
<div className="grid grid-cols-2 gap-2">
66-
<div className="flex flex-col">
67-
<span className="text-[0.70rem] uppercase text-muted-foreground">
68-
Date
69-
</span>
70-
<span className="font-bold text-muted-foreground">
71-
{payload[0].payload.day}
72-
</span>
73-
</div>
74-
<div className="flex flex-col">
75-
<span className="text-[0.70rem] uppercase text-muted-foreground">
76-
Active Users
77-
</span>
78-
<span className="font-bold">
79-
{payload[0].value}
80-
</span>
81-
</div>
82-
</div>
83-
</div>
84-
)
85-
}} /> */}
8678
<Line
8779
type="monotone"
8880
dataKey="active"

0 commit comments

Comments
 (0)