diff --git a/Client/src/Components/Charts/Utils/chartUtils.jsx b/Client/src/Components/Charts/Utils/chartUtils.jsx index 546d05cec..004f9a227 100644 --- a/Client/src/Components/Charts/Utils/chartUtils.jsx +++ b/Client/src/Components/Charts/Utils/chartUtils.jsx @@ -165,7 +165,6 @@ export const InfrastructureTooltip = ({ ? `${yLabel} ${getFormattedPercentage(payload[0].payload[hardwareType][yIdx][metric])}` : `${yLabel} ${getFormattedPercentage(payload[0].payload[hardwareType][metric])}`} - {/* Display original value */} @@ -188,3 +187,91 @@ InfrastructureTooltip.propTypes = { yLabel: PropTypes.string, dotColor: PropTypes.string, }; + +export const TemperatureTooltip = ({ active, payload, label, keys, dotColor }) => { + const uiTimezone = useSelector((state) => state.ui.timezone); + const theme = useTheme(); + const formatCoreKey = (key) => { + return key.replace(/^core(\d+)$/, "Core $1"); + }; + if (active && payload && payload.length) { + return ( + + + {formatDateWithTz(label, "ddd, MMMM D, YYYY, h:mm A", uiTimezone)} + + + + {keys.map((key) => { + return ( + + + + + + {`${formatCoreKey(key)}: ${payload[0].payload[key]} °C`} + + + + + ); + })} + + + ); + } + return null; +}; + +TemperatureTooltip.propTypes = { + active: PropTypes.bool, + keys: PropTypes.array, + payload: PropTypes.array, + label: PropTypes.oneOfType([ + PropTypes.instanceOf(Date), + PropTypes.string, + PropTypes.number, + ]), +};