labels with proper formatting

This commit is contained in:
2026-04-07 11:12:29 +05:30
parent b587f8aeb6
commit 6c305e0cdd

View File

@@ -5,6 +5,7 @@ export interface ChartDataPoint {
id: string; id: string;
amount: number; amount: number;
compareAmount?: number; compareAmount?: number;
compareLabel?: compareLabel;
highlighted?: boolean; highlighted?: boolean;
} }
@@ -232,18 +233,40 @@ export default function HistoryChart({
</Box> </Box>
</Box> </Box>
<Typography <Box
variant="caption"
color="text.secondary"
sx={{ sx={{
mt: 1, mt: 1,
fontSize: "0.7rem",
textAlign: "center", textAlign: "center",
lineHeight: 1.2 display: "flex",
flexDirection: "column",
alignItems: "center",
lineHeight: 1.1
}}
>
<Typography
variant="caption"
sx={{
fontSize: "0.7rem",
opacity: 0.7,
color: "text.primary",
}} }}
> >
{formatLabel(point.id, activeDataKey)} {formatLabel(point.id, activeDataKey)}
</Typography> </Typography>
{comparison && point.compareLabel && activeDataKey !== "daily" && (
<Typography
variant="caption"
sx={{
fontSize: "0.7rem",
opacity: 0.7,
color: "grey.400",
}}
>
{formatLabel(point.compareLabel, activeDataKey)}
</Typography>
)}
</Box>
</Box> </Box>
); );
})} })}