diff --git a/src/pages/dashboards/home/blocks/MemberActivity.tsx b/src/pages/dashboards/home/blocks/MemberActivity.tsx index bdfd43e..172c019 100644 --- a/src/pages/dashboards/home/blocks/MemberActivity.tsx +++ b/src/pages/dashboards/home/blocks/MemberActivity.tsx @@ -30,19 +30,19 @@ const MemberActivity = ({ startdate, enddate }: Props) => { fetchDataTransactionValue(); }, [startdate, enddate, GetData]); - const percentage = responseTransactionValue?.data?.total_customer_active_percentage ?? 0; + const percentage = parseFloat((responseTransactionValue?.data?.total_customer_active_percentage ?? 0).toFixed(2)) ?? 0; const totalCustomer = responseTransactionValue?.data?.total_customer ?? 0; const activeCustomer = responseTransactionValue?.data?.total_customer_active ?? 0; // Hitung sudut pointer - const angle = 180 - (percentage / 100) * 180; // 180° (kiri bawah) ke 0° (kanan bawah) - const radians = (angle * Math.PI) / 180; // Mengubah derajat ke radian + const angle = (percentage / 100) * 180; // 0° (kiri) ke 180° (kanan) + const radians = (angle * Math.PI) / 180; const radius = 40; // Radius dari setengah lingkaran const center = 50; // Titik pusat lingkaran const pointerLength = 25; // Panjang pointer - const x = center + pointerLength * Math.cos(radians); - const y = center + pointerLength * Math.sin(radians); + const x = center + pointerLength * Math.cos(radians - Math.PI); // offset agar mulai dari kiri + const y = center + pointerLength * Math.sin(radians - Math.PI); // Hitung titik akhir untuk arc aktif const arcAngle = (Math.PI * percentage) / 100;