diff --git a/web/src/components/dashboard/BarChart.jsx b/web/src/components/dashboard/BarChart.jsx index ca3c1cc..fcee3d7 100644 --- a/web/src/components/dashboard/BarChart.jsx +++ b/web/src/components/dashboard/BarChart.jsx @@ -1,42 +1,27 @@ import React from 'react'; -const BarChart = ({ data = [], width = 400, height = 80, color = 'currentColor' }) => { +const BarChart = ({ data = [], height = 80, barW = 24 }) => { if (!data || data.length === 0) return null; const max = Math.max(...data, 1); - const barCount = data.length; - const gap = 4; - const totalGap = (barCount - 1) * gap; - const barWidth = Math.max(8, (width - totalGap) / barCount); - const totalUsed = barCount * barWidth + totalGap; - const offsetX = (width - totalUsed) / 2; return ( - +
{data.map((v, i) => { - const barH = Math.max(2, (v / max) * (height - 4)); - const x = offsetX + i * (barWidth + gap); - const y = height - barH; - const rx = Math.min(3, barWidth / 3); + const pct = Math.max(2, Math.round((v / max) * 100)); return ( - + className='w-full flex justify-center' + > +
+
); })} - +
); }; diff --git a/web/src/components/dashboard/BentoTrend.jsx b/web/src/components/dashboard/BentoTrend.jsx index 666198f..c93d94e 100644 --- a/web/src/components/dashboard/BentoTrend.jsx +++ b/web/src/components/dashboard/BentoTrend.jsx @@ -224,27 +224,20 @@ const BentoTrend = ({
- +
- {dailyStats.map((d, i) => { - const isPeak = d.count === peak && peak > 0; - return ( - - {formatMD(d.date)} - - ); - })} + {dailyStats.map((d, i) => ( + + {formatMD(d.date)} + + ))}
峰值{' '}