From e6dfac1ffe138fedb98cbc9dc530ab2db4be7901 Mon Sep 17 00:00:00 2001 From: amal Date: Thu, 16 Apr 2026 11:47:19 +0800 Subject: [PATCH] upd: fix graphic data --- src/frontend/components/DashboardCharts.tsx | 40 +++++++++++++++---- .../apps.$appId.villages.$villageId.tsx | 39 +++--------------- 2 files changed, 37 insertions(+), 42 deletions(-) diff --git a/src/frontend/components/DashboardCharts.tsx b/src/frontend/components/DashboardCharts.tsx index 6322ac2..b1a6604 100644 --- a/src/frontend/components/DashboardCharts.tsx +++ b/src/frontend/components/DashboardCharts.tsx @@ -53,6 +53,9 @@ export function VillageActivityLineChart({ data = [], isLoading }: ChartProps) { gridAxis="x" withTooltip tooltipAnimationDuration={200} + tooltipProps={{ + allowEscapeViewBox: { x: true, y: false }, + }} styles={{ root: { '.recharts-line-curve': { @@ -91,17 +94,38 @@ export function VillageComparisonBarChart({ data = [], isLoading }: ChartProps) h={300} data={data} dataKey="village" - series={[{ name: 'activity', color: 'indigo.6' }]} + series={[{ name: 'activity', color: 'blue.6' }]} // Menggunakan warna dari theme withTooltip - tickLine="none" - gridAxis="y" barProps={{ - radius: [8, 8, 4, 4], + radius: [8, 8, 0, 0], + fill: 'url(#barGradient)', // Menggunakan gradient yang Anda buat }} - styles={{ - bar: { - fill: 'url(#barGradient)', - } + tooltipProps={{ + cursor: { fill: '#373A40', opacity: 0.4 }, + allowEscapeViewBox: { x: false, y: false }, + content: ({ active, payload }) => { + if (active && payload && payload.length) { + return ( +
+
+ {payload[0].payload.village} +
+
+ Activity: {payload[0].value} +
+
+ ); + } + return null; + }, }} > diff --git a/src/frontend/routes/apps.$appId.villages.$villageId.tsx b/src/frontend/routes/apps.$appId.villages.$villageId.tsx index 71e90e9..0ed86c6 100644 --- a/src/frontend/routes/apps.$appId.villages.$villageId.tsx +++ b/src/frontend/routes/apps.$appId.villages.$villageId.tsx @@ -110,49 +110,20 @@ function ActivityChart({ villageId }: { villageId: string }) { h={280} data={data} dataKey="label" - series={[{ name: 'aktivitas', color: '#2563EB' }]} + series={[{ name: 'activity', color: '#2563EB' }]} curveType="monotone" - withTooltip - withDots - tickLine="none" - gridAxis="x" - tooltipAnimationDuration={150} + withTooltip={true} + withDots={true} withPointLabels={false} - withXAxis={true} - withYAxis={true} - fillOpacity={1} + tooltipAnimationDuration={150} tooltipProps={{ allowEscapeViewBox: { x: true, y: false }, }} - areaProps={{ - strokeWidth: 2.5, - fill: 'url(#villageAreaGrad)', - stroke: '#2563EB', - filter: 'drop-shadow(0 4px 12px rgba(37,99,235,0.3))', - }} - dotProps={{ - r: 4, - strokeWidth: 2, - stroke: '#2563EB', - fill: 'white', - style: { cursor: 'pointer' }, - }} activeDotProps={{ r: 6, strokeWidth: 2, - stroke: '#2563EB', - fill: '#2563EB', - children: null, }} - > - - - - - - - - + /> )} )