update cpu / container axis datamax calculations

This commit is contained in:
henrygd
2025-11-14 15:43:50 -05:00
parent 3650482b09
commit 32c8e047e3
4 changed files with 19 additions and 3 deletions

View File

@@ -5,6 +5,7 @@ import * as RechartsPrimitive from "recharts"
import { chartTimeData, cn } from "@/lib/utils"
import type { ChartData } from "@/types"
import { Separator } from "./separator"
import { AxisDomain } from "recharts/types/util/types"
// Format: { THEME_NAME: CSS_SELECTOR }
const THEMES = { light: "", dark: ".dark" } as const
@@ -454,3 +455,15 @@ export {
xAxis,
// ChartStyle,
}
export function pinnedAxisDomain(): AxisDomain {
return [0, (dataMax: number) => {
if (dataMax > 10) {
return Math.round(dataMax)
}
if (dataMax > 1) {
return Math.round(dataMax / 0.1) * 0.1
}
return dataMax
}]
}