refactor: update chart tooltip formatting and enhance currency formatter for consistency
This commit is contained in:
parent
50953e1c37
commit
861cd6d26f
@ -73,9 +73,9 @@ export function AovTrendChart({
|
||||
content={
|
||||
<ChartTooltipContent
|
||||
hideLabel
|
||||
formatter={(value) => [
|
||||
formatter={(value, name) => [
|
||||
formatCurrency(Number(value)),
|
||||
chartConfig.aov.label
|
||||
` - ${chartConfig[name as keyof typeof chartConfig]?.label ?? name}`,
|
||||
]}
|
||||
/>
|
||||
}
|
||||
|
||||
@ -1,15 +1,14 @@
|
||||
"use client"
|
||||
|
||||
import { GitCommitVertical, TrendingUp } from "lucide-react"
|
||||
import { GitCommitVertical } from "lucide-react"
|
||||
import { CartesianGrid, Line, LineChart, XAxis, YAxis } from "recharts"
|
||||
|
||||
import {
|
||||
Card,
|
||||
CardContent,
|
||||
CardDescription,
|
||||
CardFooter,
|
||||
CardHeader,
|
||||
CardTitle,
|
||||
CardTitle
|
||||
} from "@/components/ui/card"
|
||||
import {
|
||||
ChartContainer,
|
||||
@ -17,7 +16,6 @@ import {
|
||||
ChartTooltipContent,
|
||||
type ChartConfig,
|
||||
} from "@/components/ui/chart"
|
||||
import { formatCurrency } from "@/lib/formatters"
|
||||
|
||||
export const description = "Menampilkan volume transaksi per bulan."
|
||||
|
||||
@ -28,14 +26,14 @@ const chartConfig = {
|
||||
},
|
||||
} satisfies ChartConfig
|
||||
|
||||
export function TransactionVolumeChart({
|
||||
data,
|
||||
title = "Volume Transaksi",
|
||||
description = "Total jumlah pesanan yang diproses per bulan."
|
||||
}: {
|
||||
data: any[],
|
||||
title?: string,
|
||||
description?: string
|
||||
export function TransactionVolumeChart({
|
||||
data,
|
||||
title = "Volume Transaksi",
|
||||
description = "Total jumlah pesanan yang diproses per bulan."
|
||||
}: {
|
||||
data: any[],
|
||||
title?: string,
|
||||
description?: string
|
||||
}) {
|
||||
return (
|
||||
<Card>
|
||||
|
||||
@ -24,11 +24,13 @@ export const formatDate = (date: Date | string | undefined) => {
|
||||
year: 'numeric',
|
||||
});
|
||||
};
|
||||
|
||||
export const formatCurrency = (value: number) => {
|
||||
return new Intl.NumberFormat('id-ID', {
|
||||
style: 'currency',
|
||||
currency: 'IDR',
|
||||
minimumFractionDigits: 0,
|
||||
maximumFractionDigits: 0,
|
||||
}).format(value);
|
||||
};
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user