y axis formatting
This commit is contained in:
1 parent
38ef9ccad3
commit
227dc9e7e8
3 files changed
+8
-4
No files matched your search
@@ -6,6 +6,8 @@ import type { HardwareCheckStats } from "@/Types/Monitor";
|
||||
import { useMemo } from "react";
|
||||
import { useTheme } from "@mui/material/styles";
|
||||
import useMediaQuery from "@mui/material/useMediaQuery";
|
||||
const formatPercent = (value: number) => `${(value * 100).toFixed(0)}%`;
|
||||
const formatTemp = (value: number) => `${value.toFixed(0)}°C`;
|
||||
|
||||
const getChartConfigs = (theme: any, checks: HardwareCheckStats[], t: any) => {
|
||||
return [
|
||||
@@ -16,6 +18,7 @@ const getChartConfigs = (theme: any, checks: HardwareCheckStats[], t: any) => {
|
||||
strokeColor: theme.palette.primary.main,
|
||||
gradientStartColor: theme.palette.primary.main,
|
||||
yDomain: [0, 1],
|
||||
yAxisFormatter: formatPercent,
|
||||
idx: null,
|
||||
},
|
||||
{
|
||||
@@ -25,6 +28,7 @@ const getChartConfigs = (theme: any, checks: HardwareCheckStats[], t: any) => {
|
||||
strokeColor: theme.palette.success.main,
|
||||
gradientStartColor: theme.palette.success.main,
|
||||
yDomain: [0, 1],
|
||||
yAxisFormatter: formatPercent,
|
||||
idx: null,
|
||||
},
|
||||
{
|
||||
@@ -34,6 +38,7 @@ const getChartConfigs = (theme: any, checks: HardwareCheckStats[], t: any) => {
|
||||
strokeColor: theme.palette.error.main,
|
||||
gradientStartColor: theme.palette.error.main,
|
||||
yDomain: [0, 150],
|
||||
yAxisFormatter: formatTemp,
|
||||
idx: null,
|
||||
},
|
||||
...(checks[0]?.disks?.map((_, idx) => ({
|
||||
@@ -43,6 +48,7 @@ const getChartConfigs = (theme: any, checks: HardwareCheckStats[], t: any) => {
|
||||
strokeColor: theme.palette.warning.main,
|
||||
gradientStartColor: theme.palette.warning.main,
|
||||
yDomain: [0, 1],
|
||||
yAxisFormatter: formatPercent,
|
||||
idx,
|
||||
})) || []),
|
||||
];
|
||||
@@ -88,6 +94,7 @@ export const InfraDetailsCharts = ({
|
||||
gradientStartColor={config.gradientStartColor}
|
||||
gradientEndColor="#ffffff"
|
||||
strokeColor={config.strokeColor}
|
||||
yAxisFormatter={config.yAxisFormatter}
|
||||
/>
|
||||
</Grid>
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user