add max 1 min memory

This commit is contained in:
henrygd
2025-08-28 20:07:22 -04:00
parent e1bb17ee9e
commit a3420b8c67
7 changed files with 35 additions and 31 deletions

View File

@@ -7,7 +7,7 @@ import { useMemo } from "react"
export type DataPoint = {
label: string
dataKey: (data: SystemStatsRecord) => number | undefined
color: string
color: number | string
opacity: number
}

View File

@@ -6,7 +6,7 @@ import { ChartData } from "@/types"
import { useLingui } from "@lingui/react/macro"
import { Unit } from "@/lib/enums"
export default memo(function MemChart({ chartData }: { chartData: ChartData }) {
export default memo(function MemChart({ chartData, showMax }: { chartData: ChartData; showMax: boolean }) {
const { yAxisWidth, updateYAxisWidth } = useYAxisWidth()
const { t } = useLingui()
@@ -66,7 +66,7 @@ export default memo(function MemChart({ chartData }: { chartData: ChartData }) {
<Area
name={t`Used`}
order={3}
dataKey="stats.mu"
dataKey={({ stats }) => (showMax ? stats?.mm : stats?.mu)}
type="monotoneX"
fill="var(--chart-2)"
fillOpacity={0.4}
@@ -74,31 +74,31 @@ export default memo(function MemChart({ chartData }: { chartData: ChartData }) {
stackId="1"
isAnimationActive={false}
/>
{chartData.systemStats.at(-1)?.stats.mz && (
<Area
name="ZFS ARC"
order={2}
dataKey="stats.mz"
type="monotoneX"
fill="hsla(175 60% 45% / 0.8)"
fillOpacity={0.5}
stroke="hsla(175 60% 45% / 0.8)"
stackId="1"
isAnimationActive={false}
/>
)}
{/* {chartData.systemStats.at(-1)?.stats.mz && ( */}
<Area
name="ZFS ARC"
order={2}
dataKey={({ stats }) => (showMax ? null : stats?.mz)}
type="monotoneX"
fill="hsla(175 60% 45% / 0.8)"
fillOpacity={0.5}
stroke="hsla(175 60% 45% / 0.8)"
stackId="1"
isAnimationActive={false}
/>
{/* )} */}
<Area
name={t`Cache / Buffers`}
order={1}
dataKey="stats.mb"
dataKey={({ stats }) => (showMax ? null : stats?.mb)}
type="monotoneX"
fill="hsla(160 60% 45% / 0.5)"
fillOpacity={0.4}
// strokeOpacity={1}
stroke="hsla(160 60% 45% / 0.5)"
stackId="1"
isAnimationActive={false}
/>
{/* <ChartLegend content={<ChartLegendContent />} /> */}
</AreaChart>
</ChartContainer>
</div>