🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.
TypeScript analyticsautogenevaluationlangchainlarge-language-modelsllama-indexllmllm-evaluationllm-observabilityllmopsmonitoringobservabilityopen-sourceopenaiplaygroundprompt-engineeringprompt-managementself-hostedycombinator
chore(home-dashboards): replace tremor with recharts (#11916)
Thorsten Spiekere74d26e1740e
diff --git a/CLAUDE.md b/CLAUDE.mdindex 8fb97abdc1..c8055dd530 100644--- a/CLAUDE.md+++ b/CLAUDE.md@@ -115,7 +115,7 @@ pnpm run nuke # Remove all node_modules, build files, wipe database- **Styling**: Tailwind CSS with CSS variables for theming- **Components**: shadcn/ui (Radix UI primitives)- **State Management**: TanStack Query (React Query) + tRPC-- **Charts**: Tremor, Recharts+- **Charts**: Recharts### Worker Application (`/worker/`)- **Framework**: Express.jsdiff --git a/packages/shared/prisma/generated/types.ts b/packages/shared/prisma/generated/types.tsindex 672ec3095e..6e5e038130 100644--- a/packages/shared/prisma/generated/types.ts+++ b/packages/shared/prisma/generated/types.ts@@ -146,6 +146,7 @@ export type DashboardWidgetViews =(typeof DashboardWidgetViews)[keyof typeof DashboardWidgetViews];export const DashboardWidgetChartType = {LINE_TIME_SERIES: "LINE_TIME_SERIES",+ AREA_TIME_SERIES: "AREA_TIME_SERIES",BAR_TIME_SERIES: "BAR_TIME_SERIES",HORIZONTAL_BAR: "HORIZONTAL_BAR",VERTICAL_BAR: "VERTICAL_BAR",diff --git a/packages/shared/prisma/migrations/20260211132728_add_chart_type_area_time_series/migration.sql b/packages/shared/prisma/migrations/20260211132728_add_chart_type_area_time_series/migration.sqlnew file mode 100644index 0000000000..0ec675dec1--- /dev/null+++ b/packages/shared/prisma/migrations/20260211132728_add_chart_type_area_time_series/migration.sql@@ -0,0 +1 @@+ALTER TYPE "DashboardWidgetChartType" ADD VALUE 'AREA_TIME_SERIES';diff --git a/packages/shared/prisma/schema.prisma b/packages/shared/prisma/schema.prismaindex a269c2fc22..6083edf283 100644--- a/packages/shared/prisma/schema.prisma+++ b/packages/shared/prisma/schema.prisma@@ -1335,6 +1335,7 @@ enum DashboardWidgetViews {enum DashboardWidgetChartType {LINE_TIME_SERIES+ AREA_TIME_SERIESBAR_TIME_SERIESHORIZONTAL_BARVERTICAL_BARdiff --git a/packages/shared/src/server/services/DashboardService/types.ts b/packages/shared/src/server/services/DashboardService/types.tsindex 96c943e112..fbec43482d 100644--- a/packages/shared/src/server/services/DashboardService/types.ts+++ b/packages/shared/src/server/services/DashboardService/types.ts@@ -13,9 +13,13 @@ export const LineChartTimeSeriesConfig = BaseTimeSeriesChartConfig.extend({export const BarChartTimeSeriesConfig = BaseTimeSeriesChartConfig.extend({type: z.literal("BAR_TIME_SERIES"),});+export const AreaChartTimeSeriesConfig = BaseTimeSeriesChartConfig.extend({+ type: z.literal("AREA_TIME_SERIES"),+});export const HorizontalBarChartConfig = BaseTotalValueChartConfig.extend({type: z.literal("HORIZONTAL_BAR"),+ show_value_labels: z.boolean().optional(),});export const VerticalBarChartConfig = BaseTotalValueChartConfig.extend({type: z.literal("VERTICAL_BAR"),@@ -58,6 +62,7 @@ export const MetricSchema = z.object({export const ChartConfigSchema = z.discriminatedUnion("type", [LineChartTimeSeriesConfig,BarChartTimeSeriesConfig,+ AreaChartTimeSeriesConfig,HorizontalBarChartConfig,VerticalBarChartConfig,PieChartConfig,diff --git a/web/src/components/NoDataOrLoading.tsx b/web/src/components/NoDataOrLoading.tsxindex 40ebb3a1f9..5efa842b0c 100644--- a/web/src/components/NoDataOrLoading.tsx+++ b/web/src/components/NoDataOrLoading.tsx@@ -23,11 +23,11 @@ const NoData = ({return (<divclassName={cn(- "flex h-3/4 min-h-[9rem] w-full items-center justify-center rounded-tremor-default border border-dashed",+ "flex h-3/4 min-h-[9rem] w-full items-center justify-center rounded-md border border-dashed",className,)}>- <p className="text-tremor-content">{noDataText}</p>+ <p className="text-muted-foreground">{noDataText}</p>{children}</div>);@@ -43,7 +43,7 @@ export function NoDataOrLoading({return (<divclassName={cn(- "flex h-3/4 min-h-[9rem] w-full items-center justify-center rounded-tremor-default",+ "flex h-3/4 min-h-[9rem] w-full items-center justify-center rounded-md",className,)}>diff --git a/web/src/components/ui/chart.tsx b/web/src/components/ui/chart.tsxindex ebf0ebc7f0..3833833538 100644--- a/web/src/components/ui/chart.tsx+++ b/web/src/components/ui/chart.tsx@@ -111,6 +111,9 @@ const ChartTooltipContent = React.forwardRef<indicator?: "line" | "dot" | "dashed";nameKey?: string;labelKey?: string;+ valueFormatter?: (value: number) => string;+ nameFormatter?: (name: string) => string;+ sortPayloadByValue?: "asc" | "desc";}>((@@ -128,11 +131,23 @@ const ChartTooltipContent = React.forwardRef<color,nameKey,labelKey,+ valueFormatter,+ nameFormatter,+ sortPayloadByValue,},ref,) => {const { config } = useChart();+ const displayPayload = React.useMemo(() => {+ if (!payload?.length || !sortPayloadByValue) return payload ?? [];+ return [...payload].sort((a, b) => {+ const va = Number(a.value ?? 0);+ const vb = Number(b.value ?? 0);+ return sortPayloadByValue === "desc" ? vb - va : va - vb;+ });+ }, [payload, sortPayloadByValue]);+const tooltipLabel = React.useMemo(() => {if (hideLabel || !payload?.length) {return null;@@ -173,7 +188,7 @@ const ChartTooltipContent = React.forwardRef<return null;}- const nestLabel = payload.length === 1 && indicator !== "dot";+ const nestLabel = displayPayload.length === 1 && indicator !== "dot";return (<div@@ -185,7 +200,7 @@ const ChartTooltipContent = React.forwardRef<>{!nestLabel ? tooltipLabel : null}<div className="grid gap-1.5">- {payload.map((item, index) => {+ {displayPayload.map((item, index) => {const key = `${nameKey || item.name || item.dataKey || "value"}`;const itemConfig = getPayloadConfigFromPayload(config, item, key);const indicatorColor = color || item.payload.fill || item.color;@@ -235,12 +250,18 @@ const ChartTooltipContent = React.forwardRef<<div className="grid gap-1.5">{nestLabel ? tooltipLabel : null}<span className="text-muted-foreground">- {itemConfig?.label || item.name}+ {nameFormatter+ ? nameFormatter(+ String(item.name ?? item.dataKey ?? ""),+ )+ : itemConfig?.label || item.name}</span></div>- {item.value && (+ {item.value !== undefined && item.value !== null && (<span className="font-mono font-medium tabular-nums text-foreground">- {item.value.toLocaleString()}+ {valueFormatter+ ? valueFormatter(Number(item.value))+ : item.value.toLocaleString()}</span>)}</div>diff --git a/web/src/ee/features/billing/components/BillingUsageChart.tsx b/web/src/ee/features/billing/components/BillingUsageChart.tsxindex e0395381ff..5405e571aa 100644--- a/web/src/ee/features/billing/components/BillingUsageChart.tsx+++ b/web/src/ee/features/billing/components/BillingUsageChart.tsx@@ -1,7 +1,6 @@// Langfuse Cloud onlyimport { api } from "@/src/utils/api";-import { MarkerBar } from "@tremor/react";import { useQueryOrganization } from "@/src/features/organizations/hooks";import { Card } from "@/src/components/ui/card";import { numberFormatter, compactNumberFormatter } from "@/src/utils/numbers";@@ -60,13 +59,26 @@ export const BillingUsageChart = () => {Plan limit: {compactNumberFormatter(hobbyPlanLimit)}</span></div>- <MarkerBar- value={Math.min(+ <div+ className="mt-3 h-2 w-full overflow-hidden rounded-full bg-muted"+ role="progressbar"+ aria-valuenow={Math.min((usage.data.usageCount / hobbyPlanLimit) * 100,100,)}- className="mt-3"- />+ aria-valuemin={0}+ aria-valuemax={100}+ >+ <div+ className="h-full rounded-full bg-primary transition-all"+ style={{+ width: `${Math.min(+ (usage.data.usageCount / hobbyPlanLimit) * 100,+ 100,+ )}%`,+ }}+ />+ </div></>)}</>diff --git a/web/src/features/dashboard/components/ChartScores.tsx b/web/src/features/dashboard/components/ChartScores.tsxindex 1427f7081c..91e13d5b4b 100644--- a/web/src/features/dashboard/components/ChartScores.tsx+++ b/web/src/features/dashboard/components/ChartScores.tsx@@ -19,6 +19,8 @@ import {mapLegacyUiTableFilterToView,} from "@/src/features/query";import { type DatabaseRow } from "@/src/server/api/services/sqlInterface";+import { Chart } from "@/src/features/widgets/chart-library/Chart";+import { timeSeriesToDataPoints } from "@/src/features/dashboard/lib/tremorv4-recharts-chart-adapters";export function ChartScores(props: {className?: string;@@ -28,6 +30,7 @@ export function ChartScores(props: {toTimestamp: Date;projectId: string;isLoading?: boolean;+ isDashboardChartsBeta?: boolean;}) {const scoresQuery: QueryType = {view: "scores-numeric",@@ -91,12 +94,28 @@ export function ChartScores(props: {isLoading={props.isLoading || scores.isPending}>{!isEmptyTimeSeries({ data: extractedScores }) ? (- <BaseTimeSeriesChart- className="[&_text]:fill-muted-foreground [&_tspan]:fill-muted-foreground"- agg={props.agg}- data={extractedScores}- connectNulls- />+ props.isDashboardChartsBeta ? (+ <div className="min-h-80">+ <Chart+ chartType="LINE_TIME_SERIES"+ data={timeSeriesToDataPoints(extractedScores, props.agg)}+ rowLimit={100}+ chartConfig={{+ type: "LINE_TIME_SERIES",+ show_data_point_dots: false,+ subtle_fill: true,+ }}+ legendPosition="above"+ />+ </div>+ ) : (+ <BaseTimeSeriesChart+ className="[&_text]:fill-muted-foreground [&_tspan]:fill-muted-foreground"+ agg={props.agg}+ data={extractedScores}+ connectNulls+ />+ )) : (<NoDataOrLoadingisLoading={props.isLoading || scores.isPending}diff --git a/web/src/features/dashboard/components/LatencyChart.tsx b/web/src/features/dashboard/components/LatencyChart.tsxindex 33ce3d7c72..172433e174 100644--- a/web/src/features/dashboard/components/LatencyChart.tsx+++ b/web/src/features/dashboard/components/LatencyChart.tsx@@ -23,6 +23,8 @@ import {mapLegacyUiTableFilterToView,} from "@/src/features/query";import type { DatabaseRow } from "@/src/server/api/services/sqlInterface";+import { Chart } from "@/src/features/widgets/chart-library/Chart";+import { timeSeriesToDataPoints } from "@/src/features/dashboard/lib/tremorv4-recharts-chart-adapters";export const GenerationLatencyChart = ({className,@@ -32,6 +34,7 @@ export const GenerationLatencyChart = ({fromTimestamp,toTimestamp,isLoading = false,+ isDashboardChartsBeta = false,}: {className?: string;projectId: string;@@ -40,6 +43,7 @@ export const GenerationLatencyChart = ({fromTimestamp: Date;toTimestamp: Date;isLoading?: boolean;+ isDashboardChartsBeta?: boolean;}) => {const {allModels,@@ -173,13 +177,29 @@ export const GenerationLatencyChart = ({content: (<>{!isEmptyTimeSeries({ data: item.data }) ? (- <BaseTimeSeriesChart- className="[&_text]:fill-muted-foreground [&_tspan]:fill-muted-foreground"- agg={agg}- data={item.data}- connectNulls={true}- valueFormatter={latencyFormatter}- />+ isDashboardChartsBeta ? (+ <div className="h-80 w-full shrink-0">+ <Chart+ chartType="LINE_TIME_SERIES"+ data={timeSeriesToDataPoints(item.data, agg)}+ rowLimit={100}+ chartConfig={{+ type: "LINE_TIME_SERIES",+ show_data_point_dots: false,+ }}+ valueFormatter={latencyFormatter}+ legendPosition="above"+ />+ </div>+ ) : (+ <BaseTimeSeriesChart+ className="[&_text]:fill-muted-foreground [&_tspan]:fill-muted-foreground"+ agg={agg}+ data={item.data}+ connectNulls={true}+ valueFormatter={latencyFormatter}+ />+ )) : (<NoDataOrLoadingisLoading={isLoading || latencies.isPending}diff --git a/web/src/features/dashboard/components/ModelUsageChart.tsx b/web/src/features/dashboard/components/ModelUsageChart.tsxindex 193793c289..11d6adbbdf 100644--- a/web/src/features/dashboard/components/ModelUsageChart.tsx+++ b/web/src/features/dashboard/components/ModelUsageChart.tsx@@ -25,6 +25,8 @@ import {mapLegacyUiTableFilterToView,} from "@/src/features/query";import { type DatabaseRow } from "@/src/server/api/services/sqlInterface";+import { Chart } from "@/src/features/widgets/chart-library/Chart";+import { timeSeriesToDataPoints } from "@/src/features/dashboard/lib/tremorv4-recharts-chart-adapters";export const ModelUsageChart = ({className,@@ -35,6 +37,7 @@ export const ModelUsageChart = ({toTimestamp,userAndEnvFilterState,isLoading = false,+ isDashboardChartsBeta = false,}: {className?: string;projectId: string;@@ -44,6 +47,7 @@ export const ModelUsageChart = ({toTimestamp: Date;userAndEnvFilterState: FilterState;isLoading?: boolean;+ isDashboardChartsBeta?: boolean;}) => {const {allModels,@@ -355,6 +359,21 @@ export const ModelUsageChart = ({<NoDataOrLoadingisLoading={isLoading || queryResult.isPending}/>+ ) : isDashboardChartsBeta ? (+ <div className="h-80 w-full shrink-0">+ <Chart+ chartType="AREA_TIME_SERIES"+ data={timeSeriesToDataPoints(item.data, agg)}+ rowLimit={100}+ chartConfig={{+ type: "AREA_TIME_SERIES",+ show_data_point_dots: false,+ subtle_fill: true,+ }}+ valueFormatter={item.formatter}+ legendPosition="above"+ />+ </div>) : (<BaseTimeSeriesChartclassName="[&_text]:fill-muted-foreground [&_tspan]:fill-muted-foreground"diff --git a/web/src/features/dashboard/components/TabTimeSeriesChart.tsx b/web/src/features/dashboard/components/TabTimeSeriesChart.tsxdeleted file mode 100644index 66cab92049..0000000000--- a/web/src/features/dashboard/components/TabTimeSeriesChart.tsx+++ /dev/null@@ -1,60 +0,0 @@-import {- BaseTimeSeriesChart,- type TimeSeriesChartDataPoint,-} from "@/src/features/dashboard/components/BaseTimeSeriesChart";-import { TotalMetric } from "@/src/features/dashboard/components/TotalMetric";-import { type DashboardDateRangeAggregationOption } from "@/src/utils/date-range-utils";-import { Tab, TabList, TabGroup, TabPanel, TabPanels } from "@tremor/react";-import { type ReactNode, useState } from "react";--export type BaseTabTimeseriesChartProps = {- agg: DashboardDateRangeAggregationOption;- showLegend?: boolean;- connectNulls?: boolean;- data: {- totalMetric: ReactNode;- metricDescription: ReactNode;- tabTitle: string;- formatter?: (value: number) => string;- data: TimeSeriesChartDataPoint[];- }[];-};--export const BaseTabTimeseriesChart = (props: BaseTabTimeseriesChartProps) => {- const [selectedIndex, setSelectedIndex] = useState(0);-- return (- <div className="flex flex-col justify-between">- <TotalMetric- metric={props.data[selectedIndex]?.totalMetric}- description={props.data[selectedIndex]?.metricDescription}- />- <TabGroup- className="mt-4"- index={selectedIndex}- onIndexChange={(i) => setSelectedIndex(i)}- defaultIndex={0}- >- <TabList className="h-8">- {props.data.map((data, index) => (- <Tab tabIndex={index} key={index}>- {data.tabTitle}- </Tab>- ))}- </TabList>- <TabPanels>- {props.data.map((data, index) => (- <TabPanel key={index}>- <BaseTimeSeriesChart- agg={props.agg}- data={data.data}- showLegend={true}- valueFormatter={data.formatter}- />- </TabPanel>- ))}- </TabPanels>- </TabGroup>- </div>- );-};diff --git a/web/src/features/dashboard/components/TabsComponent.tsx b/web/src/features/dashboard/components/TabsComponent.tsxindex 12c1b5256b..71d8bfc3a4 100644--- a/web/src/features/dashboard/components/TabsComponent.tsx+++ b/web/src/features/dashboard/components/TabsComponent.tsx@@ -59,9 +59,7 @@ export const TabComponent = ({ tabs }: TabComponentProps) => {</nav></div></div>- <div className="mt-4 flex h-3/4 flex-col">- {tabs[selectedIndex]?.content}- </div>+ <div className="mt-4 flex flex-col">{tabs[selectedIndex]?.content}</div></div>);};diff --git a/web/src/features/dashboard/components/TracesBarListChart.tsx b/web/src/features/dashboard/components/TracesBarListChart.tsxindex 1a73b0fee2..a3f256f7da 100644--- a/web/src/features/dashboard/components/TracesBarListChart.tsx+++ b/web/src/features/dashboard/components/TracesBarListChart.tsx@@ -5,12 +5,14 @@ import { useState } from "react";import { DashboardCard } from "@/src/features/dashboard/components/cards/DashboardCard";import { TotalMetric } from "@/src/features/dashboard/components/TotalMetric";import { BarList } from "@tremor/react";-import { compactNumberFormatter } from "@/src/utils/numbers";+import { compactNumberFormatter, numberFormatter } from "@/src/utils/numbers";import { NoDataOrLoading } from "@/src/components/NoDataOrLoading";import {type QueryType,mapLegacyUiTableFilterToView,} from "@/src/features/query";+import { Chart } from "@/src/features/widgets/chart-library/Chart";+import { barListToDataPoints } from "@/src/features/dashboard/lib/tremorv4-recharts-chart-adapters";export const TracesBarListChart = ({className,@@ -19,6 +21,7 @@ export const TracesBarListChart = ({fromTimestamp,toTimestamp,isLoading = false,+ isDashboardChartsBeta = false,}: {className?: string;projectId: string;@@ -26,6 +29,7 @@ export const TracesBarListChart = ({fromTimestamp: Date;toTimestamp: Date;isLoading?: boolean;+ isDashboardChartsBeta?: boolean;}) => {const [isExpanded, setIsExpanded] = useState(false);@@ -98,6 +102,10 @@ export const TracesBarListChart = ({? transformedTraces.slice(0, maxNumberOfEntries.expanded): transformedTraces.slice(0, maxNumberOfEntries.collapsed);+ // Height scales with bar count so each bar keeps the same height when expanding, otherwise recharts chart would resize to fit into the container.+ const BAR_ROW_HEIGHT = 36;+ const CHART_AXIS_PADDING = 32;+return (<DashboardCardclassName={className}@@ -116,15 +124,39 @@ export const TracesBarListChart = ({/>{adjustedData.length > 0 ? (<>- <BarList- data={adjustedData}- valueFormatter={(number: number) =>- Intl.NumberFormat("en-US").format(number).toString()- }- className="mt-6 [&_*]:text-muted-foreground [&_p]:text-muted-foreground [&_span]:text-muted-foreground"- showAnimation={true}- color={"indigo"}- />+ {isDashboardChartsBeta ? (+ <div+ className="mt-4 w-full"+ style={{+ minHeight: 200,+ height: Math.max(+ 200,+ adjustedData.length * BAR_ROW_HEIGHT + CHART_AXIS_PADDING,+ ),+ }}+ >+ <Chart+ chartType="HORIZONTAL_BAR"+ data={barListToDataPoints(adjustedData)}+ rowLimit={maxNumberOfEntries.expanded}+ chartConfig={{+ type: "HORIZONTAL_BAR",+ row_limit: maxNumberOfEntries.expanded,+ subtle_fill: true,+ show_value_labels: true,+ }}+ valueFormatter={(n) => numberFormatter(n, 0)}+ />+ </div>+ ) : (+ <BarList+ data={adjustedData}+ valueFormatter={(number: number) => numberFormatter(number, 0)}+ className="mt-6 [&_*]:text-muted-foreground [&_p]:text-muted-foreground [&_span]:text-muted-foreground"+ showAnimation={true}+ color={"indigo"}+ />+ )}</>) : (<NoDataOrLoadingdiff --git a/web/src/features/dashboard/components/TracesTimeSeriesChart.tsx b/web/src/features/dashboard/components/TracesTimeSeriesChart.tsxindex 00738f27c9..78faca1bff 100644--- a/web/src/features/dashboard/components/TracesTimeSeriesChart.tsx+++ b/web/src/features/dashboard/components/TracesTimeSeriesChart.tsx@@ -15,6 +15,8 @@ import {type QueryType,mapLegacyUiTableFilterToView,} from "@/src/features/query";+import { Chart } from "@/src/features/widgets/chart-library/Chart";+import { timeSeriesToDataPoints } from "@/src/features/dashboard/lib/tremorv4-recharts-chart-adapters";export const TracesAndObservationsTimeSeriesChart = ({className,@@ -24,6 +26,7 @@ export const TracesAndObservationsTimeSeriesChart = ({toTimestamp,agg,isLoading = false,+ isDashboardChartsBeta = false,}: {className?: string;projectId: string;@@ -32,6 +35,7 @@ export const TracesAndObservationsTimeSeriesChart = ({toTimestamp: Date;agg: DashboardDateRangeAggregationOption;isLoading?: boolean;+ isDashboardChartsBeta?: boolean;}) => {const tracesQuery: QueryType = {view: "traces",@@ -178,13 +182,31 @@ export const TracesAndObservationsTimeSeriesChart = ({}/>{!isEmptyTimeSeries({ data: item.data }) ? (- <BaseTimeSeriesChart- className="h-full min-h-80 self-stretch [&_text]:fill-muted-foreground [&_tspan]:fill-muted-foreground"- agg={agg}- data={item.data}- connectNulls={true}- chartType="area"- />+ isDashboardChartsBeta ? (+ <div className="h-80 w-full shrink-0">+ <Chart+ chartType="AREA_TIME_SERIES"+ data={timeSeriesToDataPoints(item.data, agg)}+ rowLimit={100}+ chartConfig={{+ type: "AREA_TIME_SERIES",+ show_data_point_dots: false,+ subtle_fill: true,+ }}+ legendPosition="above"+ />+ </div>+ ) : (+ <div className="h-80 w-full shrink-0">+ <BaseTimeSeriesChart+ className="h-full [&_text]:fill-muted-foreground [&_tspan]:fill-muted-foreground"+ agg={agg}+ data={item.data}+ connectNulls={true}+ chartType="area"+ />+ </div>+ )) : (<NoDataOrLoadingisLoading={isLoading || traces.isPending}diff --git a/web/src/features/dashboard/components/UserChart.tsx b/web/src/features/dashboard/components/UserChart.tsxindex 98f686975d..8fb7d3349b 100644--- a/web/src/features/dashboard/components/UserChart.tsx+++ b/web/src/features/dashboard/components/UserChart.tsx@@ -13,6 +13,8 @@ import {type QueryType,mapLegacyUiTableFilterToView,} from "@/src/features/query";+import { Chart } from "@/src/features/widgets/chart-library/Chart";+import { barListToDataPoints } from "@/src/features/dashboard/lib/tremorv4-recharts-chart-adapters";type BarChartDataPoint = {name: string;@@ -26,6 +28,7 @@ export const UserChart = ({fromTimestamp,toTimestamp,isLoading = false,+ isDashboardChartsBeta = false,}: {className?: string;projectId: string;@@ -33,6 +36,7 @@ export const UserChart = ({fromTimestamp: Date;toTimestamp: Date;isLoading?: boolean;+ isDashboardChartsBeta?: boolean;}) => {const [isExpanded, setIsExpanded] = useState(false);const userCostQuery: QueryType = {@@ -132,6 +136,9 @@ export const UserChart = ({const maxNumberOfEntries = { collapsed: 5, expanded: 20 } as const;+ const BAR_ROW_HEIGHT = 36;+ const CHART_AXIS_PADDING = 32;+const localUsdFormatter = (value: number) =>totalCostDashboardFormatted(value);@@ -170,19 +177,48 @@ export const UserChart = ({content: (<>{item.data.length > 0 ? (- <>+ <div className="flex flex-col"><TotalMetricmetric={item.totalMetric}description={item.metricDescription}/>- <BarList- data={item.data}- valueFormatter={item.formatter}- className="mt-2 [&_*]:text-muted-foreground [&_p]:text-muted-foreground [&_span]:text-muted-foreground"- showAnimation={true}- color={"indigo"}- />- </>+ {isDashboardChartsBeta ? (+ <div+ className="mt-4 w-full"+ style={{+ minHeight: 200,+ height: Math.max(+ 200,+ item.data.length * BAR_ROW_HEIGHT ++ CHART_AXIS_PADDING,+ ),+ }}+ >+ <Chart+ chartType="HORIZONTAL_BAR"+ data={barListToDataPoints(item.data)}+ rowLimit={maxNumberOfEntries.expanded}+ chartConfig={{+ type: "HORIZONTAL_BAR",+ row_limit: maxNumberOfEntries.expanded,+ show_value_labels: true,+ subtle_fill: true,+ }}+ valueFormatter={item.formatter}+ />+ </div>+ ) : (+ <div>+ <BarList+ data={item.data}+ valueFormatter={item.formatter}+ className="mt-2 [&_*]:text-muted-foreground [&_p]:text-muted-foreground [&_span]:text-muted-foreground"+ showAnimation={true}+ color={"indigo"}+ />+ </div>+ )}+ </div>) : (<NoDataOrLoadingisLoading={isLoading || user.isPending}diff --git a/web/src/features/dashboard/components/score-analytics/CategoricalScoreChart.tsx b/web/src/features/dashboard/components/score-analytics/CategoricalScoreChart.tsxindex 2abf4616c0..f3d2265988 100644--- a/web/src/features/dashboard/components/score-analytics/CategoricalScoreChart.tsx+++ b/web/src/features/dashboard/components/score-analytics/CategoricalScoreChart.tsx@@ -14,6 +14,10 @@ import {mapLegacyUiTableFilterToView,} from "@/src/features/query";import { type DatabaseRow } from "@/src/server/api/services/sqlInterface";+import { Chart } from "@/src/features/widgets/chart-library/Chart";+import { scoreChartDataToDataPoints } from "@/src/features/dashboard/lib/tremorv4-recharts-chart-adapters";+import { isEmptyChart } from "@/src/features/dashboard/lib/score-analytics-utils";+import { NoDataOrLoading } from "@/src/components/NoDataOrLoading";export function CategoricalScoreChart(props: {projectId: string;@@ -22,6 +26,7 @@ export function CategoricalScoreChart(props: {fromTimestamp: Date;toTimestamp: Date;agg?: DashboardDateRangeAggregationOption;+ isDashboardChartsBeta?: boolean;}) {const scoresQuery: QueryType = {view: "scores-categorical",@@ -91,6 +96,31 @@ export function CategoricalScoreChart(props: {return adapter.toChartData();}, [scores.data, props.agg]);+ if (props.isDashboardChartsBeta) {+ if (isEmptyChart({ data: chartData })) {+ return (+ <NoDataOrLoading+ isLoading={scores.isLoading}+ className="min-h-[9rem] flex-1"+ />+ );+ }+ return (+ <div className="h-80 w-full shrink-0">+ <Chart+ chartType="VERTICAL_BAR"+ data={scoreChartDataToDataPoints(chartData, chartLabels)}+ rowLimit={100}+ chartConfig={{+ type: "VERTICAL_BAR",+ row_limit: 100,+ subtle_fill: true,+ }}+ />+ </div>+ );+ }+return (<CategoricalChartchartData={chartData}diff --git a/web/src/features/dashboard/components/score-analytics/NumericScoreHistogram.tsx b/web/src/features/dashboard/components/score-analytics/NumericScoreHistogram.tsxindex 0642288d4d..fa10d2c477 100644--- a/web/src/features/dashboard/components/score-analytics/NumericScoreHistogram.tsx+++ b/web/src/features/dashboard/components/score-analytics/NumericScoreHistogram.tsx@@ -12,6 +12,9 @@ import { getColorsForCategories } from "@/src/features/dashboard/utils/getColorsimport { padChartData } from "@/src/features/dashboard/lib/score-analytics-utils";import { NoDataOrLoading } from "@/src/components/NoDataOrLoading";import { Tooltip } from "@/src/features/dashboard/components/Tooltip";+import { Chart } from "@/src/features/widgets/chart-library/Chart";+import { scoreHistogramToDataPoints } from "@/src/features/dashboard/lib/tremorv4-recharts-chart-adapters";+import { numberFormatter } from "@/src/utils/numbers";export function NumericScoreHistogram(props: {projectId: string;@@ -19,6 +22,7 @@ export function NumericScoreHistogram(props: {source: ScoreSourceType;dataType: Extract<ScoreDataTypeType, "NUMERIC" | "BOOLEAN">;globalFilterState: FilterState;+ isDashboardChartsBeta?: boolean;}) {const histogram = api.dashboard.scoreHistogram.useQuery({@@ -67,23 +71,30 @@ export function NumericScoreHistogram(props: {const TooltipComponent = (tooltipProps: CustomTooltipProps) => (<Tooltip{...tooltipProps}- formatter={(value) => Intl.NumberFormat("en-US").format(value).toString()}+ formatter={(value) => numberFormatter(Number(value), 0)}/>);return histogram.isLoading || !Boolean(chartData.length) ? (<NoDataOrLoading isLoading={histogram.isLoading} />+ ) : props.isDashboardChartsBeta ? (+ <div className="h-80 w-full shrink-0">+ <Chart+ chartType="HISTOGRAM"+ data={scoreHistogramToDataPoints(chartData, chartLabels)}+ rowLimit={100}+ chartConfig={{ type: "HISTOGRAM", subtle_fill: true }}+ />+ </div>) : (- <Card className="min-h-[9rem] w-full flex-1 rounded-tremor-default border">+ <Card className="min-h-[9rem] w-full flex-1 rounded-md border"><BarChartclassName="mt-4 [&_text]:fill-muted-foreground [&_tspan]:fill-muted-foreground"data={paddedChartData}index="binLabel"categories={chartLabels}colors={colors}- valueFormatter={(number: number) =>- Intl.NumberFormat("en-US").format(number).toString()- }+ valueFormatter={(number: number) => numberFormatter(number, 0)}yAxisWidth={48}barCategoryGap={"0%"}customTooltip={TooltipComponent}diff --git a/web/src/features/dashboard/components/score-analytics/NumericScoreTimeSeriesChart.tsx b/web/src/features/dashboard/components/score-analytics/NumericScoreTimeSeriesChart.tsxindex 81240decbf..0456802b15 100644--- a/web/src/features/dashboard/components/score-analytics/NumericScoreTimeSeriesChart.tsx+++ b/web/src/features/dashboard/components/score-analytics/NumericScoreTimeSeriesChart.tsx@@ -24,6 +24,8 @@ import {mapLegacyUiTableFilterToView,} from "@/src/features/query";import { type DatabaseRow } from "@/src/server/api/services/sqlInterface";+import { Chart } from "@/src/features/widgets/chart-library/Chart";+import { timeSeriesToDataPoints } from "@/src/features/dashboard/lib/tremorv4-recharts-chart-adapters";export function NumericScoreTimeSeriesChart(props: {projectId: string;@@ -34,6 +36,7 @@ export function NumericScoreTimeSeriesChart(props: {globalFilterState: FilterState;fromTimestamp: Date;toTimestamp: Date;+ isDashboardChartsBeta?: boolean;}) {const scoresQuery: QueryType = {view: "scores-numeric",@@ -107,14 +110,30 @@ export function NumericScoreTimeSeriesChart(props: {data: extractedScores,isNullValueAllowed: true,}) ? (- <Card className="min-h-[9rem] w-full flex-1 rounded-tremor-default border">- <BaseTimeSeriesChart- className="[&_text]:fill-muted-foreground [&_tspan]:fill-muted-foreground"- agg={props.agg}- data={extractedScores}- connectNulls- />- </Card>+ props.isDashboardChartsBeta ? (+ <div className="h-80 w-full shrink-0">+ <Chart+ chartType="LINE_TIME_SERIES"+ data={timeSeriesToDataPoints(extractedScores, props.agg)}+ rowLimit={100}+ chartConfig={{+ type: "LINE_TIME_SERIES",+ show_data_point_dots: false,+ subtle_fill: true,+ }}+ legendPosition="above"+ />+ </div>+ ) : (+ <Card className="min-h-[9rem] w-full flex-1 rounded-md border">+ <BaseTimeSeriesChart+ className="[&_text]:fill-muted-foreground [&_tspan]:fill-muted-foreground"+ agg={props.agg}+ data={extractedScores}+ connectNulls+ />+ </Card>+ )) : (<NoDataOrLoading isLoading={scores.isLoading} />);diff --git a/web/src/features/dashboard/components/score-analytics/ScoreAnalytics.tsx b/web/src/features/dashboard/components/score-analytics/ScoreAnalytics.tsxindex 2702ae3b0a..d465ccd11d 100644--- a/web/src/features/dashboard/components/score-analytics/ScoreAnalytics.tsx+++ b/web/src/features/dashboard/components/score-analytics/ScoreAnalytics.tsx@@ -29,6 +29,7 @@ export function ScoreAnalytics(props: {toTimestamp: Date;projectId: string;isLoading?: boolean;+ isDashboardChartsBeta?: boolean;}) {// Stale score selections in localStorage are ignored as we only show scores that exist in scoreAnalyticsOptionsconst [selectedDashboardScoreKeys, setSelectedDashboardScoreKeys] =@@ -122,6 +123,7 @@ export function ScoreAnalytics(props: {globalFilterState={props.globalFilterState}fromTimestamp={props.fromTimestamp}toTimestamp={props.toTimestamp}+ isDashboardChartsBeta={props.isDashboardChartsBeta}/>)}{(isNumericDataType(dataType) ||@@ -137,6 +139,7 @@ export function ScoreAnalytics(props: {>}globalFilterState={props.globalFilterState}+ isDashboardChartsBeta={props.isDashboardChartsBeta}/>)}</div>@@ -155,6 +158,7 @@ export function ScoreAnalytics(props: {globalFilterState={props.globalFilterState}fromTimestamp={props.fromTimestamp}toTimestamp={props.toTimestamp}+ isDashboardChartsBeta={props.isDashboardChartsBeta}/>)}{(isNumericDataType(dataType) ||@@ -173,6 +177,7 @@ export function ScoreAnalytics(props: {globalFilterState={props.globalFilterState}fromTimestamp={props.fromTimestamp}toTimestamp={props.toTimestamp}+ isDashboardChartsBeta={props.isDashboardChartsBeta}/>)}</div>@@ -185,8 +190,8 @@ export function ScoreAnalytics(props: {})}</div>) : Boolean(scoreKeysAndProps.data?.scoreColumns.length) ? (- <div className="flex min-h-[9rem] w-full flex-1 items-center justify-center rounded-tremor-default border">- <p className="text-tremor-content">+ <div className="flex min-h-[9rem] w-full flex-1 items-center justify-center rounded-md border">+ <p className="text-muted-foreground">Select a score to view analytics</p></div>diff --git a/web/src/features/dashboard/hooks/useDashboardChartsBeta.ts b/web/src/features/dashboard/hooks/useDashboardChartsBeta.tsnew file mode 100644index 0000000000..a360ed6b09--- /dev/null+++ b/web/src/features/dashboard/hooks/useDashboardChartsBeta.ts@@ -0,0 +1,35 @@+import { useCallback, useEffect, useState } from "react";++const STORAGE_KEY = "dashboardChartsBeta";++function getStored(): boolean {+ if (typeof window === "undefined") return false;+ try {+ const v = localStorage.getItem(STORAGE_KEY);+ return v === "true";+ } catch {+ return false;+ }+}++export function useDashboardChartsBeta() {+ const [isDashboardChartsBeta, setState] = useState(false);++ useEffect(() => {+ setState(getStored());+ }, []);++ const setDashboardChartsBeta = useCallback((enabled: boolean) => {+ setState(enabled);+ try {+ localStorage.setItem(STORAGE_KEY, String(enabled));+ } catch {+ // ignore+ }+ }, []);++ return {+ isDashboardChartsBeta,+ setDashboardChartsBeta,+ };+}diff --git a/web/src/features/dashboard/lib/tremorv4-recharts-chart-adapters.ts b/web/src/features/dashboard/lib/tremorv4-recharts-chart-adapters.tsnew file mode 100644index 0000000000..50259a8467--- /dev/null+++ b/web/src/features/dashboard/lib/tremorv4-recharts-chart-adapters.ts@@ -0,0 +1,150 @@+/**+ * Adapters that transform data prepared for tremor-v4-chart to the recharts chart library data format.+ * This can be removed once we have removed the tremor charts completely and converted all data API+ * calls to the DataPoint format that recharts expects.+ */+import type { DataPoint } from "@/src/features/widgets/chart-library/chart-props";+import type { TimeSeriesChartDataPoint } from "@/src/features/dashboard/components/BaseTimeSeriesChart";+import type { ChartBin } from "@/src/features/scores/types";+import {+ dashboardDateRangeAggregationSettings,+ type DashboardDateRangeAggregationOption,+} from "@/src/utils/date-range-utils";++/** Histogram bin shape: binLabel plus numeric fields (e.g. count). Compatible with createHistogramData return type. */+type HistogramBinLike = { binLabel: string; [key: string]: string | number };++function convertDate(+ date: number,+ agg: DashboardDateRangeAggregationOption,+): string {+ const showMinutes = ["minute", "hour"].includes(+ dashboardDateRangeAggregationSettings[agg].dateTrunc ?? "",+ );++ if (showMinutes) {+ return new Date(date).toLocaleTimeString("en-US", {+ year: "2-digit",+ month: "numeric",+ day: "numeric",+ hour: "2-digit",+ minute: "2-digit",+ });+ }+ return new Date(date).toLocaleDateString("en-US", {+ year: "2-digit",+ month: "numeric",+ day: "numeric",+ });+}++/**+ * Converts legacy time series data (ts + values per point) to widget Chart DataPoint[].+ * One row per (timestamp, label) with dimension = label, metric = value.+ */+export function timeSeriesToDataPoints(+ data: TimeSeriesChartDataPoint[],+ agg: DashboardDateRangeAggregationOption,+): DataPoint[] {+ const result: DataPoint[] = [];+ for (const point of data) {+ const timeDimension = convertDate(point.ts, agg);+ for (const v of point.values) {+ result.push({+ time_dimension: timeDimension,+ dimension: v.label,+ metric: v.value ?? 0,+ });+ }+ }+ return result;+}++/**+ * Converts bar list items (name, value) to widget Chart DataPoint[].+ */+export function barListToDataPoints(+ items: {+ name: string;+ value: number;+ }[],+): DataPoint[] {+ return items.map(({ name, value }) => ({+ dimension: name,+ metric: value,+ time_dimension: undefined,+ }));+}++/**+ * Converts score histogram chartData (binLabel + numeric fields, e.g. from createHistogramData) to DataPoint[].+ * One row per bin: dimension = binLabel, metric = sum of values for chartLabels (or single count).+ */+export function scoreHistogramToDataPoints(+ chartData: HistogramBinLike[],+ chartLabels: string[],+): DataPoint[] {+ return chartData.map((bin) => {+ const metric = chartLabels.length+ ? chartLabels.reduce(+ (sum, label) =>+ sum + (Number((bin as Record<string, number>)[label]) || 0),+ 0,+ )+ : 0;+ return {+ dimension: bin.binLabel,+ metric,+ time_dimension: undefined,+ };+ });+}++/**+ * Converts categorical score chartData (ChartBin[] with binLabel and category keys) to DataPoint[].+ * One row per bin: dimension = binLabel, metric = sum of all category values for that bin.+ * (Widget VerticalBarChart shows one bar per row; for stacked view we'd need chart-library extension.)+ */+export function scoreChartDataToDataPoints(+ chartData: ChartBin[],+ chartLabels: string[],+): DataPoint[] {+ return chartData.map((bin) => {+ const metric = chartLabels.reduce(+ (sum, label) => sum + ((bin as Record<string, number>)[label] ?? 0),+ 0,+ );+ return {+ dimension: bin.binLabel,+ metric,+ time_dimension: undefined,+ };+ });+}++/**+ * Converts dataset run compare-view chartData (ChartBin[] from CompareViewAdapter) to DataPoint[].+ * - Single series (chartLabels.length === 1): one row per run → HORIZONTAL_BAR / VERTICAL_BAR.+ * - Multi series (categorical): one row per (run, category) → BAR_TIME_SERIES.+ */+export function compareViewChartDataToDataPoints(+ chartData: ChartBin[],+ chartLabels: string[],+): DataPoint[] {+ if (chartLabels.length === 0) return [];+ if (chartLabels.length === 1) {+ const label = chartLabels[0]!;+ return chartData.map((bin) => ({+ dimension: bin.binLabel,+ metric: (bin as Record<string, number>)[label] ?? 0,+ time_dimension: undefined,+ }));+ }+ return chartData.flatMap((bin) =>+ chartLabels.map((label) => ({+ time_dimension: bin.binLabel,+ dimension: label,+ metric: (bin as Record<string, number>)[label] ?? 0,+ })),+ );+}diff --git a/web/src/features/dashboard/utils/getColorsForCategories.tsx b/web/src/features/dashboard/utils/getColorsForCategories.tsxindex e562e9d249..abbcad9c53 100644--- a/web/src/features/dashboard/utils/getColorsForCategories.tsx+++ b/web/src/features/dashboard/utils/getColorsForCategories.tsx@@ -55,7 +55,7 @@ export function getColorsForCategories(categories: string[]): Color[] {if (categories.length <= predefinedColors.length) {return predefinedColors.slice(0, categories.length);}- const colors: Color[] = predefinedColors;+ const colors: Color[] = [...predefinedColors];while (colors.length < categories.length) {colors.push(getRandomColor());}diff --git a/web/src/features/datasets/components/DatasetRunsTable.tsx b/web/src/features/datasets/components/DatasetRunsTable.tsxindex 13377cd884..d680f1e9d0 100644--- a/web/src/features/datasets/components/DatasetRunsTable.tsx+++ b/web/src/features/datasets/components/DatasetRunsTable.tsx@@ -7,7 +7,11 @@ import { formatIntervalSeconds } from "@/src/utils/dates";import { useQueryParams, withDefault, NumberParam } from "use-query-params";import { type RouterOutput } from "@/src/utils/types";import { useEffect, useMemo, useState } from "react";-import { usdFormatter } from "../../../utils/numbers";+import {+ compactNumberFormatter,+ latencyFormatter,+ usdFormatter,+} from "@/src/utils/numbers";import { DataTableToolbar } from "@/src/components/table/data-table-toolbar";import useColumnVisibility from "@/src/features/column-visibility/hooks/useColumnVisibility";import { type Prisma, datasetRunsTableColsWithOptions } from "@langfuse/shared";@@ -36,6 +40,9 @@ import {RESOURCE_METRICS,transformAggregatedRunMetricsToChartData,} from "@/src/features/dashboard/lib/score-analytics-utils";+import { compareViewChartDataToDataPoints } from "@/src/features/dashboard/lib/tremorv4-recharts-chart-adapters";+import { useDashboardChartsBeta } from "@/src/features/dashboard/hooks/useDashboardChartsBeta";+import { Chart } from "@/src/features/widgets/chart-library/Chart";import { TimeseriesChart } from "@/src/features/scores/components/TimeseriesChart";import { CompareViewAdapter } from "@/src/features/scores/adapters";import { isNumericDataType } from "@/src/features/scores/lib/helpers";@@ -184,6 +191,7 @@ export function DatasetRunsTable(props: {selectedMetrics: string[];setScoreOptions: (options: { key: string; value: string }[]) => void;}) {+ const { isDashboardChartsBeta } = useDashboardChartsBeta();const [paginationState, setPaginationState] = useQueryParams({pageIndex: withDefault(NumberParam, 0),pageSize: withDefault(NumberParam, 50),@@ -640,6 +648,53 @@ export function DatasetRunsTable(props: {const { chartData, chartLabels } = adapter.toChartData();const scoreData = scoreKeyToData.get(key);+ const valueFormatter =+ key === "latency"+ ? latencyFormatter+ : key === "cost"+ ? usdFormatter+ : compactNumberFormatter;++ if (isDashboardChartsBeta) {+ const dataPoints =+ chartLabels.length === 1+ ? chartData.map((d) => ({+ time_dimension: d.binLabel,+ dimension: chartLabels[0]!,+ metric: (d[chartLabels[0]!] as number) ?? 0,+ }))+ : compareViewChartDataToDataPoints(+ chartData,+ chartLabels,+ );+ const chartType =+ chartLabels.length === 1+ ? "LINE_TIME_SERIES"+ : "BAR_TIME_SERIES";+ return (+ <div+ key={key}+ className="flex h-full min-w-80 max-w-full flex-col gap-2"+ >+ <span className="shrink-0 text-sm font-medium">+ {title}+ </span>+ <div className="min-h-0 flex-1">+ <Chart+ chartType={chartType}+ data={dataPoints}+ rowLimit={Math.max(dataPoints.length, 1)}+ chartConfig={{ type: chartType }}+ valueFormatter={valueFormatter}+ legendPosition={+ chartLabels.length > 1 ? "above" : "none"+ }+ />+ </div>+ </div>+ );+ }+if (!scoreData)return (<div key={key} className="h-full min-w-80 max-w-full">diff --git a/web/src/features/organizations/components/ProjectOverview.tsx b/web/src/features/organizations/components/ProjectOverview.tsxindex 7dbfccc06c..67da727c7d 100644--- a/web/src/features/organizations/components/ProjectOverview.tsx+++ b/web/src/features/organizations/components/ProjectOverview.tsx@@ -13,6 +13,7 @@ import {CardHeader,CardTitle,} from "@/src/components/ui/card";+import { Separator } from "@/src/components/ui/separator";import Header from "@/src/components/layouts/header";import { Button } from "@/src/components/ui/button";import { PlusIcon } from "lucide-react";@@ -21,7 +22,6 @@ import { StringParam, useQueryParams } from "use-query-params";import { Input } from "@/src/components/ui/input";import { useHasOrganizationAccess } from "@/src/features/rbac/utils/checkOrganizationAccess";import { env } from "@/src/env.mjs";-import { Divider } from "@tremor/react";import { Fragment } from "react";import { useRouter } from "next/router";import { useSession } from "next-auth/react";@@ -312,7 +312,7 @@ export const OrganizationProjectOverview = () => {.map((org) => (<Fragment key={org.id}>{!queryOrgId && org.id === env.NEXT_PUBLIC_DEMO_ORG_ID && (- <Divider />+ <Separator />)}<SingleOrganizationProjectOverviewTileorgId={org.id}diff --git a/web/src/features/playground/page/components/MessagePlaceholders.tsx b/web/src/features/playground/page/components/MessagePlaceholders.tsxindex 36aafda105..a66fe88df9 100644--- a/web/src/features/playground/page/components/MessagePlaceholders.tsx+++ b/web/src/features/playground/page/components/MessagePlaceholders.tsx@@ -1,5 +1,4 @@-import { Divider } from "@tremor/react";-+import { Separator } from "@/src/components/ui/separator";import { usePlaygroundContext } from "../context";import { MessagePlaceholderComponent } from "./MessagePlaceholderComponent";@@ -29,7 +28,7 @@ export const MessagePlaceholders = () => {<div key={placeholder.name}><MessagePlaceholderComponent messagePlaceholder={placeholder} />{index !== messagePlaceholders.length - 1 && (- <Divider className="my-2 text-muted-foreground" />+ <Separator className="my-2" />)}</div>))}diff --git a/web/src/features/playground/page/components/Variables.tsx b/web/src/features/playground/page/components/Variables.tsxindex bca36bfe4e..5ce11061a6 100644--- a/web/src/features/playground/page/components/Variables.tsx+++ b/web/src/features/playground/page/components/Variables.tsx@@ -1,5 +1,4 @@-import { Divider } from "@tremor/react";-+import { Separator } from "@/src/components/ui/separator";import { usePlaygroundContext } from "../context";import { PromptVariableComponent } from "./PromptVariableComponent";@@ -29,7 +28,7 @@ export const Variables = () => {<div key={promptVariable.name}><PromptVariableComponent promptVariable={promptVariable} />{index !== promptVariables.length - 1 && (- <Divider className="my-2 text-muted-foreground" />+ <Separator className="my-2" />)}</div>))}diff --git a/web/src/features/scores/components/ScoreChart.tsx b/web/src/features/scores/components/ScoreChart.tsxindex 9168b1d9b9..8f3828e75a 100644--- a/web/src/features/scores/components/ScoreChart.tsx+++ b/web/src/features/scores/components/ScoreChart.tsx@@ -40,7 +40,7 @@ export function CategoricalChart(props: {) : (<CardclassName={cn(- "max-h-full min-h-0 min-w-0 max-w-full flex-1 rounded-tremor-default border",+ "max-h-full min-h-0 min-w-0 max-w-full flex-1 rounded-md border",props.className,)}>@@ -88,7 +88,7 @@ export function NumericChart(props: {return isEmptyChart({ data: props.chartData }) ? (<NoDataOrLoading isLoading={false} />) : (- <Card className="max-h-full min-h-0 min-w-0 max-w-full flex-1 rounded-tremor-default border">+ <Card className="max-h-full min-h-0 min-w-0 max-w-full flex-1 rounded-md border"><LineChartclassName="max-h-full min-h-0 min-w-0 max-w-full [&_text]:fill-muted-foreground [&_tspan]:fill-muted-foreground"data={props.chartData}diff --git a/web/src/features/widgets/chart-library/AreaChartTimeSeries.tsx b/web/src/features/widgets/chart-library/AreaChartTimeSeries.tsxnew file mode 100644index 0000000000..159bf6ee64--- /dev/null+++ b/web/src/features/widgets/chart-library/AreaChartTimeSeries.tsx@@ -0,0 +1,136 @@+import React, { useMemo, useState } from "react";+import {+ ChartContainer,+ ChartTooltip,+ ChartTooltipContent,+} from "@/src/components/ui/chart";+import { Area, AreaChart, CartesianGrid, XAxis, YAxis } from "recharts";+import { type ChartProps } from "@/src/features/widgets/chart-library/chart-props";+import {+ getUniqueDimensions,+ groupDataByTimeDimension,+} from "@/src/features/widgets/chart-library/utils";+import { compactNumberFormatter } from "@/src/utils/numbers";+import { cn } from "@/src/utils/tailwind";++export const AreaChartTimeSeries: React.FC<ChartProps> = ({+ data,+ config = {+ metric: {+ theme: {+ light: "hsl(var(--chart-1))",+ dark: "hsl(var(--chart-1))",+ },+ },+ },+ accessibilityLayer = true,+ valueFormatter,+ legendPosition = "none",+ subtleFill = false,+}) => {+ const [highlightedDimension, setHighlightedDimension] = useState<+ string | null+ >(null);++ const groupedData = useMemo(() => groupDataByTimeDimension(data), [data]);+ const dimensions = useMemo(() => getUniqueDimensions(data), [data]);++ const tooltipFormatter = valueFormatter ?? compactNumberFormatter;++ const handleLegendClick = (dimension: string) => {+ setHighlightedDimension((prev) => (prev === dimension ? null : dimension));+ };++ return (+ <div className="flex h-full w-full min-w-0 flex-col">+ {legendPosition === "above" && dimensions.length > 0 && (+ <div className="min-w-0 shrink-0 overflow-x-auto overflow-y-hidden pb-3">+ <div className="flex w-max min-w-full flex-nowrap justify-end gap-4">+ {dimensions.map((dimension, index) => {+ const isHighlighted =+ highlightedDimension === null ||+ highlightedDimension === dimension;+ const isMuted = highlightedDimension !== null && !isHighlighted;+ return (+ <button+ key={dimension}+ type="button"+ onClick={() => handleLegendClick(dimension)}+ className={cn(+ "flex shrink-0 items-center gap-1.5 whitespace-nowrap text-xs transition-opacity",+ "cursor-pointer hover:opacity-80",+ isMuted && "opacity-40",+ )}+ aria-pressed={isHighlighted}+ aria-label={+ isHighlighted ? `Show only ${dimension}` : "Show all series"+ }+ >+ <div+ className="h-2 w-2 shrink-0 rounded-[2px]"+ style={{+ backgroundColor: `hsl(var(--chart-${(index % 8) + 1}))`,+ }}+ />+ <span className="text-muted-foreground">{dimension}</span>+ </button>+ );+ })}+ </div>+ </div>+ )}+ <ChartContainer config={config} className="min-h-0 flex-1">+ <AreaChart accessibilityLayer={accessibilityLayer} data={groupedData}>+ <CartesianGrid stroke="hsl(var(--chart-grid))" vertical={false} />+ <XAxis+ dataKey="time_dimension"+ stroke="hsl(var(--chart-grid))"+ fontSize={12}+ tickLine={false}+ axisLine={false}+ />+ <YAxis+ type="number"+ stroke="hsl(var(--chart-grid))"+ fontSize={12}+ tickLine={false}+ axisLine={false}+ tickFormatter={(value) => tooltipFormatter(Number(value))}+ />+ {dimensions.map((dimension, index) => {+ const isMuted =+ highlightedDimension !== null &&+ highlightedDimension !== dimension;+ return (+ <Area+ key={dimension}+ type="monotone"+ dataKey={dimension}+ stroke={`hsl(var(--chart-${(index % 8) + 1}))`}+ fill={`hsl(var(--chart-${(index % 8) + 1}))`}+ fillOpacity={isMuted ? 0.15 : subtleFill ? 0.3 : 0.75}+ strokeWidth={2.5}+ strokeOpacity={isMuted ? 0.2 : 1}+ connectNulls+ />+ );+ })}+ <ChartTooltip+ contentStyle={{ backgroundColor: "hsl(var(--background))" }}+ content={({ active, payload, label }) => (+ <ChartTooltipContent+ active={active}+ payload={payload}+ label={label}+ valueFormatter={tooltipFormatter}+ sortPayloadByValue="desc"+ />+ )}+ />+ </AreaChart>+ </ChartContainer>+ </div>+ );+};++export default AreaChartTimeSeries;diff --git a/web/src/features/widgets/chart-library/Chart.tsx b/web/src/features/widgets/chart-library/Chart.tsxindex bf8953c8d5..ee59d65bdc 100644--- a/web/src/features/widgets/chart-library/Chart.tsx+++ b/web/src/features/widgets/chart-library/Chart.tsx@@ -2,6 +2,7 @@ import React, { useState, useMemo } from "react";import { type DataPoint } from "@/src/features/widgets/chart-library/chart-props";import { CardContent } from "@/src/components/ui/card";import LineChartTimeSeries from "@/src/features/widgets/chart-library/LineChartTimeSeries";+import AreaChartTimeSeries from "@/src/features/widgets/chart-library/AreaChartTimeSeries";import VerticalBarChartTimeSeries from "@/src/features/widgets/chart-library/VerticalBarChartTimeSeries";import HorizontalBarChart from "@/src/features/widgets/chart-library/HorizontalBarChart";import VerticalBarChart from "@/src/features/widgets/chart-library/VerticalBarChart";@@ -22,6 +23,9 @@ export const Chart = ({sortState,onSortChange,isLoading = false,+ valueFormatter,+ legendPosition,+ overrideWarning = false,}: {chartType: DashboardWidgetChartType;data: DataPoint[];@@ -33,45 +37,113 @@ export const Chart = ({dimensions?: string[];metrics?: string[];defaultSort?: OrderByState;+ show_value_labels?: boolean;+ show_data_point_dots?: boolean;+ subtle_fill?: boolean;};sortState?: OrderByState | null;onSortChange?: (sortState: OrderByState | null) => void;isLoading?: boolean;+ valueFormatter?: (value: number) => string;+ legendPosition?: "above" | "none";+ overrideWarning?: boolean;}) => {- const [forceRender, setForceRender] = useState(false);+ const [forceRender, setForceRender] = useState(overrideWarning);const shouldWarn = data.length > 2000 && !forceRender;const renderedData = useMemo(() => {return data.map((item) => {- return {- ...item,- time_dimension: item.time_dimension- ? new Date(item.time_dimension).toLocaleTimeString("en-US", {- year: "2-digit",- month: "numeric",- day: "numeric",- hour: "2-digit",- minute: "2-digit",- })- : undefined,- };+ if (!item.time_dimension) return { ...item, time_dimension: undefined };+ const value = item.time_dimension;+ const looksLikeIso =+ value.includes("T") || /^\d{4}-\d{2}-\d{2}$/.test(value);+ if (!looksLikeIso) {+ return { ...item, time_dimension: value };+ }+ const parsed = new Date(value);+ if (Number.isNaN(parsed.getTime())) return { ...item };+ const isMidnight =+ parsed.getUTCHours() === 0 &&+ parsed.getUTCMinutes() === 0 &&+ parsed.getUTCSeconds() === 0 &&+ parsed.getUTCMilliseconds() === 0;+ const time_dimension = isMidnight+ ? parsed.toLocaleDateString("en-US", {+ year: "2-digit",+ month: "numeric",+ day: "numeric",+ })+ : parsed.toLocaleTimeString("en-US", {+ year: "2-digit",+ month: "numeric",+ day: "numeric",+ hour: "2-digit",+ minute: "2-digit",+ });+ return { ...item, time_dimension };});}, [data]);const renderChart = () => {switch (chartType) {case "LINE_TIME_SERIES":- return <LineChartTimeSeries data={renderedData} />;+ return (+ <LineChartTimeSeries+ data={renderedData}+ valueFormatter={valueFormatter}+ legendPosition={legendPosition}+ showDataPointDots={chartConfig?.show_data_point_dots ?? true}+ />+ );+ case "AREA_TIME_SERIES":+ return (+ <AreaChartTimeSeries+ data={renderedData}+ valueFormatter={valueFormatter}+ legendPosition={legendPosition}+ subtleFill={chartConfig?.subtle_fill}+ />+ );case "BAR_TIME_SERIES":- return <VerticalBarChartTimeSeries data={renderedData} />;+ return (+ <VerticalBarChartTimeSeries+ data={renderedData}+ valueFormatter={valueFormatter}+ subtleFill={chartConfig?.subtle_fill}+ />+ );case "HORIZONTAL_BAR":- return <HorizontalBarChart data={renderedData.slice(0, rowLimit)} />;+ return (+ <HorizontalBarChart+ data={renderedData.slice(0, rowLimit)}+ showValueLabels={chartConfig?.show_value_labels}+ valueFormatter={valueFormatter}+ subtleFill={chartConfig?.subtle_fill}+ />+ );case "VERTICAL_BAR":- return <VerticalBarChart data={renderedData.slice(0, rowLimit)} />;+ return (+ <VerticalBarChart+ data={renderedData.slice(0, rowLimit)}+ valueFormatter={valueFormatter}+ subtleFill={chartConfig?.subtle_fill}+ />+ );case "PIE":- return <PieChart data={renderedData.slice(0, rowLimit)} />;+ return (+ <PieChart+ data={renderedData.slice(0, rowLimit)}+ valueFormatter={valueFormatter}+ subtleFill={chartConfig?.subtle_fill}+ />+ );case "HISTOGRAM":- return <HistogramChart data={renderedData} />;+ return (+ <HistogramChart+ data={renderedData}+ subtleFill={chartConfig?.subtle_fill}+ />+ );case "NUMBER": {return <BigNumber data={renderedData} />;}@@ -94,7 +166,13 @@ export const Chart = ({);}default:- return <HorizontalBarChart data={renderedData.slice(0, rowLimit)} />;+ return (+ <HorizontalBarChart+ data={renderedData.slice(0, rowLimit)}+ showValueLabels={chartConfig?.show_value_labels}+ valueFormatter={valueFormatter}+ />+ );}};diff --git a/web/src/features/widgets/chart-library/HistogramChart.tsx b/web/src/features/widgets/chart-library/HistogramChart.tsxindex 2f567945c1..d479447774 100644--- a/web/src/features/widgets/chart-library/HistogramChart.tsx+++ b/web/src/features/widgets/chart-library/HistogramChart.tsx@@ -1,7 +1,11 @@import React from "react";import { type DataPoint } from "@/src/features/widgets/chart-library/chart-props";import { BarChart, Bar, XAxis, YAxis, ResponsiveContainer } from "recharts";-import { ChartContainer, ChartTooltip } from "@/src/components/ui/chart";+import {+ ChartContainer,+ ChartTooltip,+ ChartTooltipContent,+} from "@/src/components/ui/chart";import { compactSmallNumberFormatter } from "@/src/utils/numbers";interface HistogramDataPoint {@@ -12,7 +16,13 @@ interface HistogramDataPoint {height?: number;}-const HistogramChart = ({ data }: { data: DataPoint[] }) => {+const HistogramChart = ({+ data,+ subtleFill = false,+}: {+ data: DataPoint[];+ subtleFill?: boolean;+}) => {const transformHistogramData = (data: DataPoint[]): HistogramDataPoint[] => {if (!data.length) return [];@@ -83,14 +93,20 @@ const HistogramChart = ({ data }: { data: DataPoint[] }) => {dataKey="count"fill="hsl(var(--chart-1))"radius={[2, 2, 0, 0]}+ fillOpacity={subtleFill ? 0.3 : 1}/><ChartTooltipcontentStyle={{ backgroundColor: "hsl(var(--background))" }}- formatter={(value, name) => [- `${value}`,- name === "count" ? "Count" : name,- ]}- labelFormatter={(label) => `Bin: ${label}`}+ content={({ active, payload, label }) => (+ <ChartTooltipContent+ active={active}+ payload={payload}+ label={label}+ valueFormatter={(v) => compactSmallNumberFormatter(Number(v))}+ nameFormatter={(name) => (name === "count" ? "Count" : name)}+ labelFormatter={(label) => `Bin: ${label}`}+ />+ )}/></BarChart></ResponsiveContainer>diff --git a/web/src/features/widgets/chart-library/HorizontalBarChart.tsx b/web/src/features/widgets/chart-library/HorizontalBarChart.tsxindex 7d89a624cb..62a6996cd6 100644--- a/web/src/features/widgets/chart-library/HorizontalBarChart.tsx+++ b/web/src/features/widgets/chart-library/HorizontalBarChart.tsx@@ -1,9 +1,13 @@import React from "react";-import { ChartContainer, ChartTooltip } from "@/src/components/ui/chart";-import { Bar, BarChart, XAxis, YAxis } from "recharts";+import {+ ChartContainer,+ ChartTooltip,+ ChartTooltipContent,+} from "@/src/components/ui/chart";+import { Bar, BarChart, LabelList, XAxis, YAxis } from "recharts";import { type ChartProps } from "@/src/features/widgets/chart-library/chart-props";import { formatAxisLabel } from "@/src/features/widgets/chart-library/utils";-+import { compactNumberFormatter } from "@/src/utils/numbers";/*** HorizontalBarChart component* @param data - Data to be displayed. Expects an array of objects with dimension and metric properties.@@ -21,13 +25,19 @@ export const HorizontalBarChart: React.FC<ChartProps> = ({},},accessibilityLayer = true,+ showValueLabels = false,+ valueFormatter = compactNumberFormatter,+ subtleFill = false,}) => {return (- <ChartContainer config={config}>+ <ChartContainer config={config} className="min-h-0 w-full"><BarChartaccessibilityLayer={accessibilityLayer}data={data}layout="vertical"+ margin={{ top: 4, right: 8, bottom: 4, left: 0 }}+ barCategoryGap="12%"+ barGap={4}><XAxistype="number"@@ -44,16 +54,35 @@ export const HorizontalBarChart: React.FC<ChartProps> = ({tickLine={false}axisLine={false}tickFormatter={formatAxisLabel}- width={90}+ width={100}/><BardataKey="metric"radius={[0, 4, 4, 0]}+ maxBarSize={28}className="fill-[--color-metric]"- />+ fillOpacity={subtleFill ? 0.3 : 1}+ >+ {showValueLabels ? (+ <LabelList+ dataKey="metric"+ position="right"+ formatter={(value: number) => valueFormatter(value)}+ className="fill-muted-foreground"+ style={{ fontSize: 12 }}+ />+ ) : null}+ </Bar><ChartTooltipcontentStyle={{ backgroundColor: "hsl(var(--background))" }}- itemStyle={{ color: "hsl(var(--foreground))" }}+ content={({ active, payload, label }) => (+ <ChartTooltipContent+ active={active}+ payload={payload}+ label={label}+ valueFormatter={(v) => valueFormatter(Number(v))}+ />+ )}/></BarChart></ChartContainer>diff --git a/web/src/features/widgets/chart-library/LineChartTimeSeries.tsx b/web/src/features/widgets/chart-library/LineChartTimeSeries.tsxindex 2a0047b26b..1ae81364f6 100644--- a/web/src/features/widgets/chart-library/LineChartTimeSeries.tsx+++ b/web/src/features/widgets/chart-library/LineChartTimeSeries.tsx@@ -1,11 +1,17 @@-import React, { useMemo } from "react";-import { ChartContainer, ChartTooltip } from "@/src/components/ui/chart";-import { Line, LineChart, XAxis, YAxis } from "recharts";+import React, { useMemo, useState } from "react";+import {+ ChartContainer,+ ChartTooltip,+ ChartTooltipContent,+} from "@/src/components/ui/chart";+import { CartesianGrid, Line, LineChart, XAxis, YAxis } from "recharts";import { type ChartProps } from "@/src/features/widgets/chart-library/chart-props";import {getUniqueDimensions,groupDataByTimeDimension,} from "@/src/features/widgets/chart-library/utils";+import { compactNumberFormatter } from "@/src/utils/numbers";+import { cn } from "@/src/utils/tailwind";/*** LineChartTimeSeries component@@ -24,43 +30,116 @@ export const LineChartTimeSeries: React.FC<ChartProps> = ({},},accessibilityLayer = true,+ valueFormatter,+ legendPosition = "none",+ showDataPointDots = true,}) => {+ const [highlightedDimension, setHighlightedDimension] = useState<+ string | null+ >(null);+const groupedData = useMemo(() => groupDataByTimeDimension(data), [data]);const dimensions = useMemo(() => getUniqueDimensions(data), [data]);+ const tooltipFormatter = valueFormatter ?? compactNumberFormatter;++ const handleLegendClick = (dimension: string) => {+ setHighlightedDimension((prev) => (prev === dimension ? null : dimension));+ };+return (- <ChartContainer config={config}>- <LineChart accessibilityLayer={accessibilityLayer} data={groupedData}>- <XAxis- dataKey="time_dimension"- stroke="hsl(var(--chart-grid))"- fontSize={12}- tickLine={false}- axisLine={false}- />- <YAxis- type="number"- stroke="hsl(var(--chart-grid))"- fontSize={12}- tickLine={false}- axisLine={false}- />- {dimensions.map((dimension, index) => (- <Line- key={dimension}- type="monotone"- dataKey={dimension}- strokeWidth={2}- dot={true}- activeDot={{ r: 6, strokeWidth: 0 }}- stroke={`hsl(var(--chart-${(index % 4) + 1}))`}+ <div className="flex size-full min-w-0 flex-col">+ {legendPosition === "above" && dimensions.length > 0 && (+ <div className="min-w-0 shrink-0 overflow-x-auto pb-3">+ <div className="flex w-max min-w-full flex-nowrap justify-end gap-4">+ {dimensions.map((dimension, index) => {+ const isHighlighted =+ highlightedDimension === null ||+ highlightedDimension === dimension;+ const isMuted = highlightedDimension !== null && !isHighlighted;+ return (+ <button+ key={dimension}+ type="button"+ onClick={() => handleLegendClick(dimension)}+ className={cn(+ "flex shrink-0 items-center gap-1.5 whitespace-nowrap text-xs transition-opacity",+ "cursor-pointer hover:opacity-80",+ isMuted && "opacity-40",+ )}+ aria-pressed={isHighlighted}+ aria-label={+ isHighlighted ? `Show only ${dimension}` : "Show all series"+ }+ >+ <div+ className="h-2 w-2 shrink-0 rounded-[2px]"+ style={{+ backgroundColor: `hsl(var(--chart-${(index % 8) + 1}))`,+ }}+ />+ <span className="text-muted-foreground">{dimension}</span>+ </button>+ );+ })}+ </div>+ </div>+ )}+ <ChartContainer config={config} className="min-h-0 flex-1">+ <LineChart accessibilityLayer={accessibilityLayer} data={groupedData}>+ <CartesianGrid stroke="hsl(var(--chart-grid))" vertical={false} />+ <XAxis+ dataKey="time_dimension"+ stroke="hsl(var(--chart-grid))"+ fontSize={12}+ tickLine={false}+ axisLine={false}+ />+ <YAxis+ type="number"+ stroke="hsl(var(--chart-grid))"+ fontSize={12}+ tickLine={false}+ axisLine={false}+ tickFormatter={(value) => tooltipFormatter(Number(value))}+ />+ {dimensions.map((dimension, index) => {+ const isMuted =+ highlightedDimension !== null &&+ highlightedDimension !== dimension;+ return (+ <Line+ key={dimension}+ type="monotone"+ dataKey={dimension}+ strokeWidth={2.5}+ dot={showDataPointDots && !isMuted ? { r: 4 } : false}+ activeDot={+ showDataPointDots && !isMuted+ ? { r: 5, strokeWidth: 0 }+ : false+ }+ stroke={`hsl(var(--chart-${(index % 8) + 1}))`}+ strokeOpacity={isMuted ? 0.2 : 1}+ connectNulls+ />+ );+ })}+ <ChartTooltip+ contentStyle={{ backgroundColor: "hsl(var(--background))" }}+ content={({ active, payload, label }) => (+ <ChartTooltipContent+ active={active}+ payload={payload}+ label={label}+ valueFormatter={tooltipFormatter}+ sortPayloadByValue="desc"+ />+ )}/>- ))}- <ChartTooltip- contentStyle={{ backgroundColor: "hsl(var(--background))" }}- />- </LineChart>- </ChartContainer>+ </LineChart>+ </ChartContainer>+ </div>);};diff --git a/web/src/features/widgets/chart-library/PieChart.tsx b/web/src/features/widgets/chart-library/PieChart.tsxindex 603ed3c6e1..6dcdbc2029 100644--- a/web/src/features/widgets/chart-library/PieChart.tsx+++ b/web/src/features/widgets/chart-library/PieChart.tsx@@ -1,7 +1,12 @@import React, { useMemo } from "react";-import { ChartContainer, ChartTooltip } from "@/src/components/ui/chart";-import { Label, Pie, PieChart as PieChartComponent } from "recharts";+import {+ ChartContainer,+ ChartTooltip,+ ChartTooltipContent,+} from "@/src/components/ui/chart";+import { Cell, Label, Pie, PieChart as PieChartComponent } from "recharts";import { type ChartProps } from "@/src/features/widgets/chart-library/chart-props";+import { compactNumberFormatter, numberFormatter } from "@/src/utils/numbers";/*** PieChart component@@ -20,6 +25,8 @@ export const PieChart: React.FC<ChartProps> = ({},},accessibilityLayer = true,+ valueFormatter = compactNumberFormatter,+ subtleFill = false,}) => {// Calculate total metric value for center labelconst totalValue = useMemo(() => {@@ -31,7 +38,7 @@ export const PieChart: React.FC<ChartProps> = ({return data.map((item, index) => ({name: item.dimension || "Unknown",value: item.metric,- fill: `hsl(var(--chart-${(index % 4) + 1}))`,+ fill: `hsl(var(--chart-${(index % 8) + 1}))`,}));}, [data]);@@ -40,7 +47,14 @@ export const PieChart: React.FC<ChartProps> = ({<PieChartComponent accessibilityLayer={accessibilityLayer}><ChartTooltipcontentStyle={{ backgroundColor: "hsl(var(--background))" }}- itemStyle={{ color: "hsl(var(--foreground))" }}+ content={({ active, payload, label }) => (+ <ChartTooltipContent+ active={active}+ payload={payload}+ label={label}+ valueFormatter={(v) => valueFormatter(Number(v))}+ />+ )}/><Piedata={chartData}@@ -53,6 +67,13 @@ export const PieChart: React.FC<ChartProps> = ({paddingAngle={2}strokeWidth={5}>+ {chartData.map((entry) => (+ <Cell+ key={entry.name}+ fill={entry.fill}+ fillOpacity={subtleFill ? 0.3 : 1}+ />+ ))}{/* Label in the center of the donut */}{data.length > 0 && (<Label@@ -70,7 +91,7 @@ export const PieChart: React.FC<ChartProps> = ({y={viewBox.cy}className="fill-foreground text-3xl font-bold">- {totalValue.toLocaleString()}+ {numberFormatter(totalValue, 0)}</tspan><tspanx={viewBox.cx}diff --git a/web/src/features/widgets/chart-library/VerticalBarChart.tsx b/web/src/features/widgets/chart-library/VerticalBarChart.tsxindex 06b475c7a4..2b5dfee4ac 100644--- a/web/src/features/widgets/chart-library/VerticalBarChart.tsx+++ b/web/src/features/widgets/chart-library/VerticalBarChart.tsx@@ -1,7 +1,12 @@import React from "react";-import { ChartContainer, ChartTooltip } from "@/src/components/ui/chart";+import {+ ChartContainer,+ ChartTooltip,+ ChartTooltipContent,+} from "@/src/components/ui/chart";import { Bar, BarChart, XAxis, YAxis } from "recharts";import { type ChartProps } from "@/src/features/widgets/chart-library/chart-props";+import { compactNumberFormatter } from "@/src/utils/numbers";/*** VerticalBarChart component@@ -20,6 +25,8 @@ export const VerticalBarChart: React.FC<ChartProps> = ({},},accessibilityLayer = true,+ valueFormatter = compactNumberFormatter,+ subtleFill = false,}) => {return (<ChartContainer config={config}>@@ -43,10 +50,18 @@ export const VerticalBarChart: React.FC<ChartProps> = ({dataKey="metric"radius={[4, 4, 0, 0]}className="fill-[--color-metric]"+ fillOpacity={subtleFill ? 0.3 : 1}/><ChartTooltipcontentStyle={{ backgroundColor: "hsl(var(--background))" }}- itemStyle={{ color: "hsl(var(--foreground))" }}+ content={({ active, payload, label }) => (+ <ChartTooltipContent+ active={active}+ payload={payload}+ label={label}+ valueFormatter={(v) => valueFormatter(Number(v))}+ />+ )}/></BarChart></ChartContainer>diff --git a/web/src/features/widgets/chart-library/VerticalBarChartTimeSeries.tsx b/web/src/features/widgets/chart-library/VerticalBarChartTimeSeries.tsxindex 22647017f2..ef059c0ce1 100644--- a/web/src/features/widgets/chart-library/VerticalBarChartTimeSeries.tsx+++ b/web/src/features/widgets/chart-library/VerticalBarChartTimeSeries.tsx@@ -1,11 +1,16 @@import React, { useMemo } from "react";-import { ChartContainer, ChartTooltip } from "@/src/components/ui/chart";+import {+ ChartContainer,+ ChartTooltip,+ ChartTooltipContent,+} from "@/src/components/ui/chart";import { Bar, BarChart, XAxis, YAxis } from "recharts";import { type ChartProps } from "@/src/features/widgets/chart-library/chart-props";import {getUniqueDimensions,groupDataByTimeDimension,} from "@/src/features/widgets/chart-library/utils";+import { compactNumberFormatter } from "@/src/utils/numbers";/*** VerticalBarChartTimeSeries component@@ -24,6 +29,8 @@ export const VerticalBarChartTimeSeries: React.FC<ChartProps> = ({},},accessibilityLayer = true,+ valueFormatter = compactNumberFormatter,+ subtleFill = false,}) => {const groupedData = useMemo(() => groupDataByTimeDimension(data), [data]);const dimensions = useMemo(() => getUniqueDimensions(data), [data]);@@ -49,14 +56,24 @@ export const VerticalBarChartTimeSeries: React.FC<ChartProps> = ({<Barkey={dimension}dataKey={dimension}- stroke={`hsl(var(--chart-${(index % 4) + 1}))`}- fill={`hsl(var(--chart-${(index % 4) + 1}))`}+ stroke={`hsl(var(--chart-${(index % 8) + 1}))`}+ fill={`hsl(var(--chart-${(index % 8) + 1}))`}+ fillOpacity={subtleFill ? 0.3 : 1}// Stack bars if there are multiple dimensionsstackId={dimensions.length > 1 ? "stack" : undefined}/>))}<ChartTooltipcontentStyle={{ backgroundColor: "hsl(var(--background))" }}+ content={({ active, payload, label }) => (+ <ChartTooltipContent+ active={active}+ payload={payload}+ label={label}+ valueFormatter={valueFormatter}+ sortPayloadByValue="desc"+ />+ )}/></BarChart></ChartContainer>diff --git a/web/src/features/widgets/chart-library/chart-props.ts b/web/src/features/widgets/chart-library/chart-props.tsindex 131a3e7515..738f2be371 100644--- a/web/src/features/widgets/chart-library/chart-props.ts+++ b/web/src/features/widgets/chart-library/chart-props.ts@@ -6,8 +6,15 @@ export interface DataPoint {metric: number | Array<Array<number>>;}+export type LegendPosition = "above" | "none";+export interface ChartProps {data: DataPoint[];config?: ChartConfig;accessibilityLayer?: boolean;+ valueFormatter?: (value: number) => string;+ legendPosition?: LegendPosition;+ showValueLabels?: boolean;+ showDataPointDots?: boolean;+ subtleFill?: boolean;}diff --git a/web/src/features/widgets/chart-library/utils.ts b/web/src/features/widgets/chart-library/utils.tsindex e143bb61a7..fdeb94dd69 100644--- a/web/src/features/widgets/chart-library/utils.ts+++ b/web/src/features/widgets/chart-library/utils.ts@@ -44,6 +44,7 @@ export const isTimeSeriesChart = (): boolean => {switch (chartType) {case "LINE_TIME_SERIES":+ case "AREA_TIME_SERIES":case "BAR_TIME_SERIES":return true;case "HORIZONTAL_BAR":@@ -71,6 +72,8 @@ export function getChartTypeDisplayName(switch (chartType) {case "LINE_TIME_SERIES":return "Line Chart (Time Series)";+ case "AREA_TIME_SERIES":+ return "Area Chart (Time Series)";case "BAR_TIME_SERIES":return "Bar Chart (Time Series)";case "HORIZONTAL_BAR":diff --git a/web/src/features/widgets/components/DashboardWidget.tsx b/web/src/features/widgets/components/DashboardWidget.tsxindex caebf3fb66..389bc928ef 100644--- a/web/src/features/widgets/components/DashboardWidget.tsx+++ b/web/src/features/widgets/components/DashboardWidget.tsx@@ -317,7 +317,8 @@ export function DashboardWidget({data={transformedData}rowLimit={widget.data.chartConfig.type === "LINE_TIME_SERIES" ||- widget.data.chartConfig.type === "BAR_TIME_SERIES"+ widget.data.chartConfig.type === "BAR_TIME_SERIES" ||+ widget.data.chartConfig.type === "AREA_TIME_SERIES"? 100: (widget.data.chartConfig.row_limit ?? 100)}diff --git a/web/src/pages/project/[projectId]/index.tsx b/web/src/pages/project/[projectId]/index.tsxindex 768800a36e..027aca9269 100644--- a/web/src/pages/project/[projectId]/index.tsx+++ b/web/src/pages/project/[projectId]/index.tsx@@ -17,7 +17,7 @@ import { type FilterState } from "@langfuse/shared";import { type ColumnDefinition } from "@langfuse/shared";import { useQueryFilterState } from "@/src/features/filters/hooks/useFilterState";import { LatencyTables } from "@/src/features/dashboard/components/LatencyTables";-import { useMemo } from "react";+import { useEffect, useMemo, useRef } from "react";import {findClosestDashboardInterval,DASHBOARD_AGGREGATION_OPTIONS,@@ -36,11 +36,41 @@ import {convertSelectedEnvironmentsToFilter,useEnvironmentFilter,} from "@/src/hooks/use-environment-filter";+import { useDashboardChartsBeta } from "@/src/features/dashboard/hooks/useDashboardChartsBeta";+import { Label } from "@/src/components/ui/label";+import { Switch } from "@/src/components/ui/switch";+import {+ Tooltip,+ TooltipContent,+ TooltipTrigger,+} from "@/src/components/ui/tooltip";+import { useSession } from "next-auth/react";++const isLangfuseEmail = (email: string | null | undefined) =>+ Boolean(email?.toLowerCase().endsWith("@langfuse.com"));export default function Dashboard() {const router = useRouter();const projectId = router.query.projectId as string;+ const utils = api.useUtils();+ const { data: session } = useSession();const { timeRange, setTimeRange } = useDashboardDateRange();+ const { isDashboardChartsBeta, setDashboardChartsBeta } =+ useDashboardChartsBeta();+ const prevBetaRef = useRef<boolean | null>(null);+ const showChartsBetaToggle = isLangfuseEmail(session?.user?.email ?? null);++ // Reload all dashboard data when the charts beta toggle is switched+ useEffect(() => {+ if (+ prevBetaRef.current !== null &&+ prevBetaRef.current !== isDashboardChartsBeta+ ) {+ void utils.dashboard.invalidate();+ }+ prevBetaRef.current = isDashboardChartsBeta;+ }, [isDashboardChartsBeta, utils.dashboard]);+const absoluteTimeRange = useMemo(() => toAbsoluteTimeRange(timeRange),[timeRange],@@ -186,6 +216,30 @@ export default function Dashboard() {scrollableheaderProps={{title: "Home",+ titleBadges: showChartsBetaToggle ? (+ <Tooltip>+ <TooltipTrigger asChild>+ <div className="flex items-center gap-2">+ <Switch+ id="dashboard-charts-beta-toggle"+ size="sm"+ checked={isDashboardChartsBeta}+ onCheckedChange={setDashboardChartsBeta}+ className="shrink-0"+ />+ <Label+ htmlFor="dashboard-charts-beta-toggle"+ className="cursor-pointer text-sm font-normal text-muted-foreground"+ >+ Charts (beta)+ </Label>+ </div>+ </TooltipTrigger>+ <TooltipContent className="max-w-xs text-xs">+ Unified Recharts charts. Toggle to compare with previous charts.+ </TooltipContent>+ </Tooltip>+ ) : undefined,actionButtonsLeft: (<><TimeRangePicker@@ -257,6 +311,7 @@ export default function Dashboard() {fromTimestamp={fromTimestamp}toTimestamp={toTimestamp}isLoading={environmentFilterOptions.isPending}+ isDashboardChartsBeta={isDashboardChartsBeta}/><ModelCostTableclassName="col-span-1 xl:col-span-2"@@ -280,6 +335,7 @@ export default function Dashboard() {toTimestamp={toTimestamp}agg={agg}isLoading={environmentFilterOptions.isPending}+ isDashboardChartsBeta={isDashboardChartsBeta}/><ModelUsageChartclassName="col-span-1 min-h-24 xl:col-span-3"@@ -290,6 +346,7 @@ export default function Dashboard() {userAndEnvFilterState={[...userFilterState, ...environmentFilter]}agg={agg}isLoading={environmentFilterOptions.isPending}+ isDashboardChartsBeta={isDashboardChartsBeta}/><UserChartclassName="col-span-1 xl:col-span-3"@@ -298,6 +355,7 @@ export default function Dashboard() {fromTimestamp={fromTimestamp}toTimestamp={toTimestamp}isLoading={environmentFilterOptions.isPending}+ isDashboardChartsBeta={isDashboardChartsBeta}/><ChartScoresclassName="col-span-1 xl:col-span-3"@@ -307,6 +365,7 @@ export default function Dashboard() {fromTimestamp={fromTimestamp}toTimestamp={toTimestamp}isLoading={environmentFilterOptions.isPending}+ isDashboardChartsBeta={isDashboardChartsBeta}/><LatencyTablesprojectId={projectId}@@ -323,6 +382,7 @@ export default function Dashboard() {fromTimestamp={fromTimestamp}toTimestamp={toTimestamp}isLoading={environmentFilterOptions.isPending}+ isDashboardChartsBeta={isDashboardChartsBeta}/><ScoreAnalyticsclassName="col-span-1 flex-auto justify-between lg:col-span-full"@@ -332,6 +392,7 @@ export default function Dashboard() {fromTimestamp={fromTimestamp}toTimestamp={toTimestamp}isLoading={environmentFilterOptions.isPending}+ isDashboardChartsBeta={isDashboardChartsBeta}/></div></Page>diff --git a/web/src/pages/project/[projectId]/settings/integrations/blobstorage.tsx b/web/src/pages/project/[projectId]/settings/integrations/blobstorage.tsxindex 657c65ab25..630d3e6748 100644--- a/web/src/pages/project/[projectId]/settings/integrations/blobstorage.tsx+++ b/web/src/pages/project/[projectId]/settings/integrations/blobstorage.tsx@@ -29,7 +29,7 @@ import {import { useHasProjectAccess } from "@/src/features/rbac/utils/checkProjectAccess";import { api } from "@/src/utils/api";import { zodResolver } from "@hookform/resolvers/zod";-import { Card } from "@tremor/react";+import { Card } from "@/src/components/ui/card";import Link from "next/link";import { useRouter } from "next/router";import { useEffect, useState } from "react";diff --git a/web/src/pages/project/[projectId]/settings/integrations/mixpanel.tsx b/web/src/pages/project/[projectId]/settings/integrations/mixpanel.tsxindex 1104595cf5..0d0ecf9c69 100644--- a/web/src/pages/project/[projectId]/settings/integrations/mixpanel.tsx+++ b/web/src/pages/project/[projectId]/settings/integrations/mixpanel.tsx@@ -31,7 +31,7 @@ import { useHasProjectAccess } from "@/src/features/rbac/utils/checkProjectAccesimport { api } from "@/src/utils/api";import { type RouterOutput } from "@/src/utils/types";import { zodResolver } from "@hookform/resolvers/zod";-import { Card } from "@tremor/react";+import { Card } from "@/src/components/ui/card";import Link from "next/link";import { useRouter } from "next/router";import { useEffect } from "react";diff --git a/web/src/pages/project/[projectId]/settings/integrations/posthog.tsx b/web/src/pages/project/[projectId]/settings/integrations/posthog.tsxindex 393b5bd3a5..21cb9d54a7 100644--- a/web/src/pages/project/[projectId]/settings/integrations/posthog.tsx+++ b/web/src/pages/project/[projectId]/settings/integrations/posthog.tsx@@ -21,7 +21,7 @@ import { useHasProjectAccess } from "@/src/features/rbac/utils/checkProjectAccesimport { api } from "@/src/utils/api";import { type RouterOutput } from "@/src/utils/types";import { zodResolver } from "@hookform/resolvers/zod";-import { Card } from "@tremor/react";+import { Card } from "@/src/components/ui/card";import Link from "next/link";import { useRouter } from "next/router";import { useEffect } from "react";diff --git a/web/src/styles/globals.css b/web/src/styles/globals.cssindex 4a5884ec5a..ef9a5b47b5 100644--- a/web/src/styles/globals.css+++ b/web/src/styles/globals.css@@ -74,10 +74,14 @@--sidebar-border: 220 13% 91%;--sidebar-ring: 217.2 91.2% 59.8%;- --chart-1: var(--dark-green);- --chart-2: var(--dark-yellow);- --chart-3: var(--dark-blue);- --chart-4: var(--dark-red);+ --chart-1: 239 84% 58%;+ --chart-2: 188 94% 43%;+ --chart-3: 240 4% 46%;+ --chart-4: 271 91% 65%;+ --chart-5: 48 96% 47%;+ --chart-6: 0 84% 60%;+ --chart-7: 84 81% 44%;+ --chart-8: 330 81% 60%;--chart-grid: var(--muted-gray);--color-1: oklch(66.2% 0.225 25.9);--color-2: oklch(60.4% 0.26 302);@@ -166,10 +170,14 @@--sidebar-border: 217.2 32.6% 26.5%;--sidebar-ring: 224.3 76.3% 46%;- --chart-1: var(--dark-green);- --chart-2: var(--dark-yellow);- --chart-3: var(--dark-blue);- --chart-4: var(--dark-red);+ --chart-1: 239 84% 58%;+ --chart-2: 188 94% 43%;+ --chart-3: 240 4% 46%;+ --chart-4: 271 91% 65%;+ --chart-5: 48 96% 47%;+ --chart-6: 0 84% 60%;+ --chart-7: 84 81% 44%;+ --chart-8: 330 81% 60%;--chart-grid: var(--muted-gray);--color-1: oklch(66.2% 0.225 25.9);--color-2: oklch(60.4% 0.26 302);