diff --git a/frontend/components/dashboard/span-stat-chart.tsx b/frontend/components/dashboard/span-stat-chart.tsx index 531585e..03e0d7b 100644 --- a/frontend/components/dashboard/span-stat-chart.tsx +++ b/frontend/components/dashboard/span-stat-chart.tsx @@ -13,6 +13,7 @@ import { AggregationFunction } from '@/lib/clickhouse/utils'; import { cn, formatTimestamp, + formatTimestampFromSecondsWithInterval, formatTimestampWithInterval, } from '@/lib/utils'; @@ -156,7 +157,8 @@ interface ChartProps { keys: Set, xAxisKey: string, chartConfig: ChartConfig, - groupByInterval: GroupByInterval + groupByInterval: GroupByInterval, + numericTimestamp?: boolean } function StackedBarChart({ @@ -238,7 +240,8 @@ export function DefaultLineChart({ keys, xAxisKey, chartConfig, - groupByInterval + groupByInterval, + numericTimestamp }: ChartProps) { const dataMax = useMemo(() => Math.max(...data.map((d) => Object.entries(d) .filter(([key]) => key !== xAxisKey) @@ -270,12 +273,15 @@ export function DefaultLineChart({ type="category" domain={['dataMin', 'dataMax']} tickLine={false} - tickFormatter={(value) => - formatTimestampWithInterval( + tickFormatter={(value) => { + if (numericTimestamp) { + return formatTimestampFromSecondsWithInterval(value, groupByInterval ?? 'hour'); + } + return formatTimestampWithInterval( value, groupByInterval ?? 'hour' - ) - } + ); + }} axisLine={false} tickMargin={8} dataKey={xAxisKey} diff --git a/frontend/components/dashboard/trace-stat-chart.tsx b/frontend/components/dashboard/trace-stat-chart.tsx index 5d7e875..68796b1 100644 --- a/frontend/components/dashboard/trace-stat-chart.tsx +++ b/frontend/components/dashboard/trace-stat-chart.tsx @@ -7,7 +7,6 @@ import { GroupByInterval } from '@/lib/clickhouse/modifiers'; import { TraceMetricDatapoint } from '@/lib/traces/types'; import { cn, - formatTimestampFromSeconds, toFixedIfFloat, } from '@/lib/utils'; @@ -107,12 +106,13 @@ export function TraceStatChart({ ({ "value": d.value, - "timestamp": formatTimestampFromSeconds(d.time) + "timestamp": d.time })) ?? []} xAxisKey="timestamp" chartConfig={chartConfig} groupByInterval={defaultGroupByInterval as GroupByInterval} keys={new Set(["value"])} + numericTimestamp={true} /> )}