Ran formattor.
This commit is contained in:
1 parent
e27cc8a12b
commit
f5aefb1f0b
2 files changed
+4
-4
No files matched your search
@@ -101,12 +101,12 @@ const getFormattedPercentage = (value) => {
|
|||||||
* @param {number} props.index - The index of the tick.
|
* @param {number} props.index - The index of the tick.
|
||||||
* @returns {JSX.Element|null} The rendered tick component or null for the first tick.
|
* @returns {JSX.Element|null} The rendered tick component or null for the first tick.
|
||||||
*/
|
*/
|
||||||
export const NetworkTick = ({ x, y, payload, index, formatter}) => {
|
export const NetworkTick = ({ x, y, payload, index, formatter }) => {
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
if (index === 0) return null;
|
if (index === 0) return null;
|
||||||
|
|
||||||
if (formatter === undefined) {
|
if (formatter === undefined) {
|
||||||
formatter = (value, space=false) => {
|
formatter = (value, space = false) => {
|
||||||
if (typeof value !== "number") return value;
|
if (typeof value !== "number") return value;
|
||||||
// need to add space between value and unit
|
// need to add space between value and unit
|
||||||
return `${(value / 1024).toFixed(2)}${space ? " " : ""}Kbps`;
|
return `${(value / 1024).toFixed(2)}${space ? " " : ""}Kbps`;
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ const NetworkCharts = ({ ethernetData, dateRange }) => {
|
|||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
|
||||||
const {formatBytesString} = useHardwareUtils();
|
const { formatBytesString } = useHardwareUtils();
|
||||||
|
|
||||||
if (!ethernetData?.length) {
|
if (!ethernetData?.length) {
|
||||||
return <Typography>{t("noNetworkStatsAvailable")}</Typography>;
|
return <Typography>{t("noNetworkStatsAvailable")}</Typography>;
|
||||||
@@ -31,7 +31,7 @@ const NetworkCharts = ({ ethernetData, dateRange }) => {
|
|||||||
gradientStartColor: theme.palette.info.main,
|
gradientStartColor: theme.palette.info.main,
|
||||||
yLabel: t("bytesPerSecond"),
|
yLabel: t("bytesPerSecond"),
|
||||||
xTick: <TzTick dateRange={dateRange} />,
|
xTick: <TzTick dateRange={dateRange} />,
|
||||||
yTick: <NetworkTick formatter={formatBytesString}/>,
|
yTick: <NetworkTick formatter={formatBytesString} />,
|
||||||
toolTip: (
|
toolTip: (
|
||||||
<InfrastructureTooltip
|
<InfrastructureTooltip
|
||||||
dotColor={theme.palette.info.main}
|
dotColor={theme.palette.info.main}
|
||||||
|
|||||||
Reference in new issue
Block a user