feat: add YAxis to all chart components for improved data visualization

This commit is contained in:
Yoga Pangestu 2026-04-23 20:17:51 +07:00
parent ee79523a4b
commit 07d5219e78
4 changed files with 32 additions and 6 deletions

View File

@ -1,6 +1,6 @@
"use client" "use client"
import { CartesianGrid, Line, LineChart, XAxis } from "recharts" import { CartesianGrid, Line, LineChart, XAxis, YAxis } from "recharts"
import { import {
Card, Card,
@ -15,7 +15,7 @@ import {
ChartTooltipContent, ChartTooltipContent,
type ChartConfig, type ChartConfig,
} from "@/components/ui/chart" } from "@/components/ui/chart"
import { formatCurrency } from "@/lib/formatters" import { formatCurrency, formatShortCurrency } from "@/lib/formatters"
export const description = "Perbandingan Pendapatan vs Laba Bersih per bulan." export const description = "Perbandingan Pendapatan vs Laba Bersih per bulan."
@ -55,6 +55,13 @@ export function RevenueVsProfitChart({ data }: { data: any[] }) {
tickMargin={8} tickMargin={8}
tickFormatter={(value) => value.slice(0, 3)} tickFormatter={(value) => value.slice(0, 3)}
/> />
<YAxis
tickLine={false}
axisLine={false}
tickMargin={8}
tickFormatter={formatShortCurrency}
width={60}
/>
<ChartTooltip <ChartTooltip
cursor={false} cursor={false}
content={ content={

View File

@ -1,6 +1,6 @@
"use client" "use client"
import { Bar, BarChart, CartesianGrid, XAxis } from "recharts" import { Bar, BarChart, CartesianGrid, XAxis, YAxis } from "recharts"
import { import {
Card, Card,
@ -17,7 +17,7 @@ import {
ChartTooltipContent, ChartTooltipContent,
type ChartConfig, type ChartConfig,
} from "@/components/ui/chart" } from "@/components/ui/chart"
import { formatCurrency } from "@/lib/formatters" import { formatCurrency, formatShortCurrency } from "@/lib/formatters"
export const description = "Perbandingan total penjualan dan belanja per bulan." export const description = "Perbandingan total penjualan dan belanja per bulan."
@ -50,6 +50,13 @@ export function RevenueVsPurchasesChart({ data }: { data: any[] }) {
axisLine={false} axisLine={false}
tickFormatter={(value) => value.slice(0, 3)} tickFormatter={(value) => value.slice(0, 3)}
/> />
<YAxis
tickLine={false}
axisLine={false}
tickMargin={8}
tickFormatter={formatShortCurrency}
width={60}
/>
<ChartTooltip <ChartTooltip
cursor={false} cursor={false}
content={ content={

View File

@ -1,6 +1,6 @@
"use client" "use client"
import { Area, AreaChart, CartesianGrid, XAxis } from "recharts" import { Area, AreaChart, CartesianGrid, XAxis, YAxis } from "recharts"
import { import {
Card, Card,
@ -82,6 +82,12 @@ export function SalesByHourChart({
axisLine={false} axisLine={false}
tickMargin={8} tickMargin={8}
/> />
<YAxis
tickLine={false}
axisLine={false}
tickMargin={8}
width={30}
/>
<ChartTooltip <ChartTooltip
cursor={false} cursor={false}
content={<ChartTooltipContent indicator="dot" />} content={<ChartTooltipContent indicator="dot" />}

View File

@ -1,7 +1,7 @@
"use client" "use client"
import { GitCommitVertical, TrendingUp } from "lucide-react" import { GitCommitVertical, TrendingUp } from "lucide-react"
import { CartesianGrid, Line, LineChart, XAxis } from "recharts" import { CartesianGrid, Line, LineChart, XAxis, YAxis } from "recharts"
import { import {
Card, Card,
@ -57,6 +57,12 @@ export function TransactionVolumeChart({ data }: { data: any[] }) {
tickMargin={8} tickMargin={8}
tickFormatter={(value) => value.slice(0, 3)} tickFormatter={(value) => value.slice(0, 3)}
/> />
<YAxis
tickLine={false}
axisLine={false}
tickMargin={8}
width={30}
/>
<ChartTooltip <ChartTooltip
cursor={false} cursor={false}
content={ content={