| 1 | "use client" |
| 2 | |
| 3 | import { useChartPart } from "./chart-context" |
| 4 | |
| 5 | export function YAxis({ |
| 6 | tickFormatter, |
| 7 | tickCount = 4, |
| 8 | tickMargin = 8, |
| 9 | }: { |
| 10 | tickFormatter?: ( |
| 11 | tickCount?: number |
| 12 | tickMargin?: number |
| 13 | }) { |
| 14 | const ctx = |
| 15 | if (!ctx.ready |
| 16 | |
| 17 | return ( |
| 18 | <g className="fill-current font-mono text-[10px] text-muted-foreground |
| 19 | {ctx.y.ticks |
| 20 | <text |
| 21 | key={t} |
| 22 | x={-tickMargin} |
| 23 | y={ctx.y |
| 24 | textAnchor="end" |
| 25 | dominantBaseline="central" |
| 26 | fill="currentColor" |
| 27 | > |
| 28 | {tickFormatter ? tickFormatter |
| 29 | </text> |
| 30 | ))} |
| 31 | </g> |
| 32 | ) |
| 33 | } |