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={
|
content={
|
||||||
<ChartTooltipContent
|
<ChartTooltipContent
|
||||||
hideLabel
|
hideLabel
|
||||||
formatter={(value) => [
|
formatter={(value, name) => [
|
||||||
formatCurrency(Number(value)),
|
formatCurrency(Number(value)),
|
||||||
chartConfig.aov.label
|
` - ${chartConfig[name as keyof typeof chartConfig]?.label ?? name}`,
|
||||||
]}
|
]}
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,15 +1,14 @@
|
|||||||
"use client"
|
"use client"
|
||||||
|
|
||||||
import { GitCommitVertical, TrendingUp } from "lucide-react"
|
import { GitCommitVertical } from "lucide-react"
|
||||||
import { CartesianGrid, Line, LineChart, XAxis, YAxis } from "recharts"
|
import { CartesianGrid, Line, LineChart, XAxis, YAxis } from "recharts"
|
||||||
|
|
||||||
import {
|
import {
|
||||||
Card,
|
Card,
|
||||||
CardContent,
|
CardContent,
|
||||||
CardDescription,
|
CardDescription,
|
||||||
CardFooter,
|
|
||||||
CardHeader,
|
CardHeader,
|
||||||
CardTitle,
|
CardTitle
|
||||||
} from "@/components/ui/card"
|
} from "@/components/ui/card"
|
||||||
import {
|
import {
|
||||||
ChartContainer,
|
ChartContainer,
|
||||||
@ -17,7 +16,6 @@ import {
|
|||||||
ChartTooltipContent,
|
ChartTooltipContent,
|
||||||
type ChartConfig,
|
type ChartConfig,
|
||||||
} from "@/components/ui/chart"
|
} from "@/components/ui/chart"
|
||||||
import { formatCurrency } from "@/lib/formatters"
|
|
||||||
|
|
||||||
export const description = "Menampilkan volume transaksi per bulan."
|
export const description = "Menampilkan volume transaksi per bulan."
|
||||||
|
|
||||||
|
|||||||
@ -24,11 +24,13 @@ export const formatDate = (date: Date | string | undefined) => {
|
|||||||
year: 'numeric',
|
year: 'numeric',
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
export const formatCurrency = (value: number) => {
|
export const formatCurrency = (value: number) => {
|
||||||
return new Intl.NumberFormat('id-ID', {
|
return new Intl.NumberFormat('id-ID', {
|
||||||
style: 'currency',
|
style: 'currency',
|
||||||
currency: 'IDR',
|
currency: 'IDR',
|
||||||
minimumFractionDigits: 0,
|
minimumFractionDigits: 0,
|
||||||
|
maximumFractionDigits: 0,
|
||||||
}).format(value);
|
}).format(value);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user