Skip to content

🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.

fix(ui): x axis of timeseries charts on dashboard for some time ranges (#3261)

Marc Klingenb10353115b4c
diff --git a/web/src/features/dashboard/components/BaseTimeSeriesChart.tsx b/web/src/features/dashboard/components/BaseTimeSeriesChart.tsx
index 201a136b35..c992354df1 100644
--- a/web/src/features/dashboard/components/BaseTimeSeriesChart.tsx
+++ b/web/src/features/dashboard/components/BaseTimeSeriesChart.tsx
@@ -3,7 +3,10 @@ import { compactNumberFormatter } from "@/src/utils/numbers";
import { cn } from "@/src/utils/tailwind";
import { AreaChart, type CustomTooltipProps, LineChart } from "@tremor/react";
import { Tooltip } from "@/src/features/dashboard/components/Tooltip";
-import { type DashboardDateRangeAggregationOption } from "@/src/utils/date-range-utils";
+import {
+ dashboardDateRangeAggregationSettings,
+ type DashboardDateRangeAggregationOption,
+} from "@/src/utils/date-range-utils";
export type TimeSeriesChartDataPoint = {
ts: number;
@@ -45,13 +48,11 @@ export function BaseTimeSeriesChart(props: {
date: number,
agg: DashboardDateRangeAggregationOption,
) => {
- const showMinutes: DashboardDateRangeAggregationOption[] = [
- "5 min",
- "30 min",
- "1 hour",
- "3 hours",
- ];
- if (showMinutes.includes(agg)) {
+ const showMinutes = ["minute", "hour"].includes(
+ dashboardDateRangeAggregationSettings[agg].date_trunc,
+ );
+
+ if (showMinutes) {
return new Date(date).toLocaleTimeString("en-US", {
year: "2-digit",
month: "numeric",