diff --git a/client/src/Components/v2/common/charts/HistogramResponseTime.tsx b/client/src/Components/v2/common/charts/HistogramResponseTime.tsx
index 75ae25001..1ef400daf 100644
--- a/client/src/Components/v2/common/charts/HistogramResponseTime.tsx
+++ b/client/src/Components/v2/common/charts/HistogramResponseTime.tsx
@@ -17,31 +17,23 @@ interface HistogramResponseTimeProps {
}
interface ResponseTimeStats {
- max: number;
- avg: number;
+ max: number | string;
+ avg: number | string;
}
const DEFAULT_HEIGHT = 50;
const calculateResponseTimeStats = (checks: CheckSnapshot[]): ResponseTimeStats => {
if (!Array.isArray(checks) || checks.length === 0) {
- return { max: 0, avg: 0 };
+ return { max: "-", avg: "-" };
}
- const validChecks = checks.filter(
- (check) =>
- (check as any).status !== "placeholder" &&
- (check.originalResponseTime != null || check.responseTime != null)
- );
-
+ const validChecks = checks.filter((check) => check.originalResponseTime != null);
if (validChecks.length === 0) {
- return { max: 0, avg: 0 };
+ return { max: "-", avg: "-" };
}
- const responseTimes = validChecks.map(
- (check) => check.originalResponseTime ?? check.responseTime ?? 0
- );
-
+ const responseTimes = validChecks.map((check) => check.originalResponseTime);
const max = Math.max(...responseTimes);
const avg = Math.round(
responseTimes.reduce((sum, time) => sum + time, 0) / responseTimes.length
@@ -72,48 +64,30 @@ export const HistogramResponseTime = ({
const chartHeight = typeof height === "number" ? `${height}px` : height;
const gridGap = gap ?? theme.spacing(0.5);
- const statsContent = showStats && (stats.max > 0 || stats.avg > 0) && (
-
-
- {t("common.charts.histogram.avg", { value: stats.avg })}
-
-
- {t("common.charts.histogram.max", { value: stats.max })}
-
-
- );
+
+ {t("common.charts.histogram.avg", { value: stats.avg })}
+
+
+ {t("common.charts.histogram.max", { value: stats.max })}
+
+
+ );
return (
- {statsPosition === "left" && statsContent}
- {statsPosition === "right" && statsContent}
+ {statsContent}
);
};