fix(chart): corrige overflow no gráfico Abertos x Resolvidos

- Adiciona YAxis com domain=[0, dataMax+1] para forçar mínimo em 0
- Muda type="monotone" para type="linear" para evitar curvas que
  ultrapassam os pontos de dados

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
esdrasrenan 2025-12-13 23:01:31 -03:00
parent a04618afc0
commit cf7ff01e34

View file

@ -1,7 +1,7 @@
"use client"
import * as React from "react"
import { CartesianGrid, Line, LineChart, XAxis } from "recharts"
import { CartesianGrid, Line, LineChart, XAxis, YAxis } from "recharts"
import { useQuery } from "convex/react"
import { api } from "@/convex/_generated/api"
@ -103,7 +103,7 @@ export function ChartOpenedResolved() {
</div>
) : (
<ChartContainer config={chartConfig} className="aspect-auto h-[320px] w-full">
<LineChart data={data.series} margin={{ top: 20, left: 16, right: 16, bottom: 12 }}>
<LineChart data={data.series} margin={{ top: 20, left: 12, right: 16, bottom: 12 }}>
<CartesianGrid vertical={false} />
<XAxis
dataKey="date"
@ -113,6 +113,13 @@ export function ChartOpenedResolved() {
minTickGap={32}
tickFormatter={(v) => formatDateDM(new Date(v))}
/>
<YAxis
tickLine={false}
axisLine={false}
tickMargin={8}
domain={[0, "dataMax + 1"]}
allowDecimals={false}
/>
<ChartTooltip
cursor={false}
content={
@ -122,8 +129,8 @@ export function ChartOpenedResolved() {
/>
}
/>
<Line dataKey="opened" type="monotone" stroke="var(--color-opened)" strokeWidth={2} dot={{ r: 2 }} strokeLinecap="round" />
<Line dataKey="resolved" type="monotone" stroke="var(--color-resolved)" strokeWidth={2} dot={{ r: 2 }} strokeLinecap="round" />
<Line dataKey="opened" type="linear" stroke="var(--color-opened)" strokeWidth={2} dot={{ r: 2 }} strokeLinecap="round" />
<Line dataKey="resolved" type="linear" stroke="var(--color-resolved)" strokeWidth={2} dot={{ r: 2 }} strokeLinecap="round" />
</LineChart>
</ChartContainer>
)}