Skip to content

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

chore: remove tremor based charts and dependency (#12010)

Thorsten Spieker718faa10f8c0
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index ca550dd39c..11c1bc4e2d 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -566,9 +566,6 @@ importers:
'@team-plain/typescript-sdk':
specifier: ^5.10.3
version: 5.10.3
- '@tremor/react':
- specifier: 4.0.0-beta-tremor-v4.4
'@trpc/client':
specifier: ^11.8.0
@@ -2494,24 +2491,12 @@ packages:
'@floating-ui/[email protected]':
resolution: {integrity: sha512-OOchDgh4F2CchOX94cRVqhvy7b3AFb+/rQXyswmzmGakRfkMgoWVjfnLWkRirfLEfuD4ysVW16eXzwt3jHIzKA==}
- '@floating-ui/[email protected]':
- resolution: {integrity: sha512-htwHm67Ji5E/pROEAr7f8IKFShuiCKHwUC/UY4vC3I5jiSvGFAYnSYiZO5MlGmads+QqvUkR9ANHEguGrDv72g==}
- peerDependencies:
- react: '>=16.8.0'
- react-dom: '>=16.8.0'
-
'@floating-ui/[email protected]':
resolution: {integrity: sha512-4JX6rEatQEvlmgU80wZyq9RT96HZJa88q8hp0pBd+LrczeDI4o6uA2M+uvxngVHo4Ihr8uibXxH6+70zhAFrVw==}
peerDependencies:
react: '>=16.8.0'
react-dom: '>=16.8.0'
- '@floating-ui/[email protected]':
- resolution: {integrity: sha512-JyNk4A0Ezirq8FlXECvRtQOX/iBe5Ize0W/pLkrZjfHW9GUV7Xnq6zm6fyZuQzaHHqEnVizmvlA96e1/CkZv+w==}
- peerDependencies:
- react: '>=16.8.0'
- react-dom: '>=16.8.0'
-
'@floating-ui/[email protected]':
resolution: {integrity: sha512-2ly0pCkZIGEQUq5H8bBK0XJmc1xIK/RM3tvVzY3GBER7IOD1UgmC2Y2tjj4AuS+TC+vTE1KJv2053290jua0Sw==}
peerDependencies:
@@ -2555,13 +2540,6 @@ packages:
engines: {node: '>=6'}
hasBin: true
- '@headlessui/[email protected]':
- resolution: {integrity: sha512-RzCEg+LXsuI7mHiSomsu/gBJSjpupm6A1qIZ5sWjd7JhARNlMiSA4kKfJpCKwU9tE+zMRterhhrP74PvfJrpXQ==}
- engines: {node: '>=10'}
- peerDependencies:
- react: ^18 || ^19 || ^19.0.0-rc
- react-dom: ^18 || ^19 || ^19.0.0-rc
-
'@headlessui/[email protected]':
resolution: {integrity: sha512-WKdTymY8Y49H8/gUc/lIyYK1M+/6dq0Iywh4zTZVAaiTDprRfioxSgD0wnXTQTBpjpGJuTL1NO/mqEvc//5SSg==}
engines: {node: '>=10'}
@@ -4661,22 +4639,12 @@ packages:
'@radix-ui/[email protected]':
resolution: {integrity: sha512-HPwpGIzkl28mWyZqG52jiqDJ12waP11Pa1lGoiyUkIEuMLBP0oeK/C89esbXrxsky5we7dfd8U58nm0SgAWpVw==}
- '@react-aria/[email protected]':
- resolution: {integrity: sha512-WKUElg+5zS0D3xlVn8MntNnkzJql2J6MuzAMP8Sv5WTgFDse/XGR842dsxPTIyKKdrWVCRegCuwa4m3n/GzgJw==}
- peerDependencies:
- react: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0
-
'@react-aria/[email protected]':
resolution: {integrity: sha512-hmH1IhHlcQ2lSIxmki1biWzMbGgnhdxJUM0MFfzc71Rv6YAzhlx4kX3GYn4VNcjCeb6cdPv4RZ5vunV4kgMZYQ==}
peerDependencies:
react: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1
react-dom: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1
- '@react-aria/[email protected]':
- resolution: {integrity: sha512-RRUb/aG+P0IKTIWikY/SylB6bIbLZeztnZY2vbe7RAG5MgVaCgn5HQ45SI15GlTmhsFG8CnF6slJsUFJiNHpbQ==}
- peerDependencies:
- react: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0
-
'@react-aria/[email protected]':
resolution: {integrity: sha512-EweYHOEvMwef/wsiEqV73KurX/OqnmbzKQa2fLxdULbec5+yDj6wVGaRHIzM4NiijIDe+bldEl5DG05CAKOAHA==}
peerDependencies:
@@ -4689,17 +4657,6 @@ packages:
peerDependencies:
react: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1
- '@react-aria/[email protected]':
- resolution: {integrity: sha512-iLo82l82ilMiVGy342SELjshuWottlb5+VefO3jOQqQRNYnJBFpUSadswDPbRimSgJUZuFwIEYs6AabkP038fA==}
- engines: {node: '>= 12'}
- peerDependencies:
- react: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0
-
- '@react-aria/[email protected]':
- resolution: {integrity: sha512-PR5H/2vaD8fSq0H/UB9inNbc8KDcVmW6fYAfSWkkn+OAdhTTMVKqXXrZuZBWyFfSD5Ze7VN6acr4hrOQm2bmrA==}
- peerDependencies:
- react: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0
-
'@react-aria/[email protected]':
resolution: {integrity: sha512-zETcbDd6Vf9GbLndO6RiWJadIZsBU2MMm23rBACXLmpRztkrIqPEb2RVdlLaq1+GklDx0Ii6PfveVjx+8S5U6A==}
peerDependencies:
@@ -4834,21 +4791,11 @@ packages:
'@react-stately/[email protected]':
resolution: {integrity: sha512-2HjFcZx1MyQXoPqcBGALwWWmgFVUk2TuKVIQxCbRq7fPyWXIl6VHcakCLurdtYC2Iks7zizvz0Idv48MQ38DWg==}
- '@react-stately/[email protected]':
- resolution: {integrity: sha512-gBEQEIMRh5f60KCm7QKQ2WfvhB2gLUr9b72sqUdIZ2EG+xuPgaIlCBeSicvjmjBvYZwOjoOEnmIkcx2GHp/HWw==}
- peerDependencies:
- react: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0
-
'@react-stately/[email protected]':
resolution: {integrity: sha512-SN3/h7SzRsusVQjQ4v10LaVsDc81jyyR0DD5HnsQitm/I5WDpaSr2nRHtyloPFU48jlql1XX/S04T2DLQM7Y3g==}
peerDependencies:
react: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1
- '@react-types/[email protected]':
- resolution: {integrity: sha512-OZSyhzU6vTdW3eV/mz5i6hQwQUhkRs7xwY2d1aqPvTdMe0+2cY7Fwp45PAiwYLEj73i9ro2FxF9qC4DvHGSCgQ==}
- peerDependencies:
- react: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0
-
'@react-types/[email protected]':
resolution: {integrity: sha512-t+cligIJsZYFMSPFMvsJMjzlzde06tZMOIOFa1OV5Z0BcMowrb2g4mB57j/9nP28iJIRYn10xCniQts+qadrqQ==}
peerDependencies:
@@ -5818,12 +5765,6 @@ packages:
'@tootallnate/[email protected]':
resolution: {integrity: sha512-C5Mc6rdnsaJDjO3UpGW/CQTHtCKaYlScZTly4JIu97Jxo/odCiH0ITnDXSJPTOrEKk/ycSZ0AOgTmkDtkOsvIA==}
- '@tremor/[email protected]':
- resolution: {integrity: sha512-S7HRQDSo4F30npQyhUqMsOZ8Lw+w1DNaUjftBCw+Psj2UHnoK8U/GVpw2kfWxrL5zh8Ym8v34MQMpgpfBU8mAQ==}
- peerDependencies:
- react: ^19.0.0
- react-dom: '>=16.6.0'
-
resolution: {integrity: sha512-imJQeESX1hAapDaC4JB91yvXg41AZfBuTh/scnEiN/hAubZa5s/ikp0n+w29q2GCf+hREkr3WptUFKFJoDAIug==}
peerDependencies:
@@ -10873,12 +10814,6 @@ packages:
resolution: {integrity: sha512-btXCnMmRIBINM2LDZoEmOogIZU7Qe7zn4BpomSKZ/ykbLObuBdvG+mFq11DL6fjH1DRwHhrlgtYWG96bJiC7Cg==}
- resolution: {integrity: sha512-TMx7fNbhLk15eqcMt+7Z7S2KF7mfTId/XJDjKE8f+IUcFn0l08/kI4FiYTL/0yuOLmEcbR4Fwe3GJf/NiiMnPA==}
- peerDependencies:
- date-fns: ^2.28.0 || ^3.0.0
- react: ^16.8.0 || ^17.0.0 || ^18.0.0
-
resolution: {integrity: sha512-NtkJbuX6cl/VaGNb3sVVhmMA6LSMnL5G3xNL+61IyoZj0mUZFWTg4hmj7PHjIQ8MXN9dHWhUHFoJWG6y60DKSg==}
engines: {node: '>=18'}
@@ -11747,18 +11682,9 @@ packages:
resolution: {integrity: sha512-kjEBm+pvD+6eAwzJL2Bi+02/9LFLal1Gs61+QB7HvTfQQ0aXwC5LGT8PEt1gS0CWKktKe6ysPTAy3cBC5MeiIg==}
- resolution: {integrity: sha512-0q8cfZHMu9nuYP/b5Shb7Y7Sh1B7Nnl5GqNr1U+n2p6+mybvRtayrQ+0042Z5byvTA8ihjlP8Odo8/VnHbZu4Q==}
-
resolution: {integrity: sha512-P+Vu1qXfzediirmHOC3xKGAYeZtPcV9g76X+xg2FD4tYgR71ewMA35Y3sCz3zhiN/dwefRpJX0yBcgwi1fXNQA==}
- resolution: {integrity: sha512-krn67M3FpPwElg4FsZrOQd0U26o7UDH/QOkK8RNaiCCrr052f6YJPBUfNKnPo/s/xRzNPtv1Mldlxsg8Tb46BQ==}
- engines: {node: '>=16.x', pnpm: '>=7.x'}
- peerDependencies:
- tailwindcss: '*'
-
resolution: {integrity: sha512-bl6mpH3T7I3UFxuvDEXLxy/VuFxBk5bbzplh7tXI68mwMokNYd1t9qPBHlnyTwfa4JGC4zP516I1hYYtQ/vspA==}
peerDependencies:
@@ -15395,26 +15321,12 @@ snapshots:
'@floating-ui/core': 1.7.3
'@floating-ui/utils': 0.2.10
- dependencies:
- '@floating-ui/dom': 1.7.4
- react: 19.2.3
- react-dom: 19.2.3([email protected])
-
dependencies:
'@floating-ui/dom': 1.7.4
react: 19.2.3
react-dom: 19.2.3([email protected])
- dependencies:
- '@floating-ui/react-dom': 1.3.0([email protected]([email protected]))([email protected])
- aria-hidden: 1.2.6
- react: 19.2.3
- react-dom: 19.2.3([email protected])
- tabbable: 6.2.0
-
dependencies:
'@floating-ui/react-dom': 2.1.6([email protected]([email protected]))([email protected])
@@ -15473,15 +15385,6 @@ snapshots:
protobufjs: 7.4.0
yargs: 17.7.2
- dependencies:
- '@floating-ui/react': 0.26.24([email protected]([email protected]))([email protected])
- '@react-aria/focus': 3.18.3([email protected])
- '@react-aria/interactions': 3.22.3([email protected])
- '@tanstack/react-virtual': 3.13.12([email protected]([email protected]))([email protected])
- react: 19.2.3
- react-dom: 19.2.3([email protected])
-
dependencies:
'@floating-ui/react': 0.26.24([email protected]([email protected]))([email protected])
@@ -17915,15 +17818,6 @@ snapshots:
'@radix-ui/[email protected]': {}
- dependencies:
- '@react-aria/interactions': 3.22.3([email protected])
- '@react-aria/utils': 3.25.3([email protected])
- '@react-types/shared': 3.25.0([email protected])
- '@swc/helpers': 0.5.17
- clsx: 2.1.1
- react: 19.2.3
-
dependencies:
'@react-aria/interactions': 3.25.5([email protected]([email protected]))([email protected])
@@ -17934,14 +17828,6 @@ snapshots:
react: 19.2.3
react-dom: 19.2.3([email protected])
- dependencies:
- '@react-aria/ssr': 3.9.6([email protected])
- '@react-aria/utils': 3.25.3([email protected])
- '@react-types/shared': 3.25.0([email protected])
- '@swc/helpers': 0.5.17
- react: 19.2.3
-
dependencies:
'@react-aria/ssr': 3.9.10([email protected])
@@ -17957,20 +17843,6 @@ snapshots:
'@swc/helpers': 0.5.17
react: 19.2.3
- dependencies:
- '@swc/helpers': 0.5.17
- react: 19.2.3
-
- dependencies:
- '@react-aria/ssr': 3.9.6([email protected])
- '@react-stately/utils': 3.10.4([email protected])
- '@react-types/shared': 3.25.0([email protected])
- '@swc/helpers': 0.5.17
- clsx: 2.1.1
- react: 19.2.3
-
dependencies:
'@react-aria/ssr': 3.9.10([email protected])
@@ -18098,20 +17970,11 @@ snapshots:
dependencies:
'@swc/helpers': 0.5.17
- dependencies:
- '@swc/helpers': 0.5.17
- react: 19.2.3
-
dependencies:
'@swc/helpers': 0.5.17
react: 19.2.3
- dependencies:
- react: 19.2.3
-
dependencies:
react: 19.2.3
@@ -19481,20 +19344,6 @@ snapshots:
'@tootallnate/[email protected]': {}
- dependencies:
- '@floating-ui/react': 0.19.2([email protected]([email protected]))([email protected])
- date-fns: 3.6.0
- react: 19.2.3
- react-day-picker: 8.10.1([email protected])([email protected])
- react-dom: 19.2.3([email protected])
- tailwind-merge: 2.6.0
- transitivePeerDependencies:
- - tailwindcss
-
dependencies:
'@trpc/server': 11.8.0([email protected])
@@ -25421,11 +25270,6 @@ snapshots:
defu: 6.1.4
destr: 2.0.5
- dependencies:
- date-fns: 3.6.0
- react: 19.2.3
-
dependencies:
'@date-fns/tz': 1.4.1
@@ -26489,15 +26333,8 @@ snapshots:
-
- dependencies:
- tailwind-merge: 2.5.4
-
dependencies:
diff --git a/web/package.json b/web/package.json
index 23623d15c1..ab2d5895cb 100644
--- a/web/package.json
+++ b/web/package.json
@@ -97,7 +97,6 @@
"@tanstack/react-table": "^8.20.5",
"@tanstack/react-virtual": "^3.13.12",
"@team-plain/typescript-sdk": "^5.10.3",
- "@tremor/react": "4.0.0-beta-tremor-v4.4",
"@trpc/client": "^11.8.0",
"@trpc/next": "^11.8.0",
"@trpc/react-query": "^11.8.0",
diff --git a/web/src/features/dashboard/components/BaseTimeSeriesChart.tsx b/web/src/features/dashboard/components/BaseTimeSeriesChart.tsx
deleted file mode 100644
index d92270efa7..0000000000
--- a/web/src/features/dashboard/components/BaseTimeSeriesChart.tsx
+++ /dev/null
@@ -1,120 +0,0 @@
-import { getColorsForCategories } from "@/src/features/dashboard/utils/getColorsForCategories";
-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 {
- dashboardDateRangeAggregationSettings,
- type DashboardDateRangeAggregationOption,
-} from "@/src/utils/date-range-utils";
-import { useMemo } from "react";
-
-export type TimeSeriesChartDataPoint = {
- ts: number;
- values: { label: string; value?: number }[];
-};
-
-export function BaseTimeSeriesChart(props: {
- className?: string;
- agg: DashboardDateRangeAggregationOption;
- data: TimeSeriesChartDataPoint[];
- showLegend?: boolean;
- connectNulls?: boolean;
- valueFormatter?: (value: number) => string;
- chartType?: "line" | "area";
-}) {
- const labels = new Set(
- props.data.flatMap((d) => d.values.map((v) => v.label)),
- );
-
- type ChartInput = { timestamp: string } & {
- [key: string]: number | undefined;
- };
-
- function transformArray(array: TimeSeriesChartDataPoint[]): ChartInput[] {
- return array.map((item) => {
- const outputObject: ChartInput = {
- timestamp: convertDate(item.ts, props.agg),
- } as ChartInput;
-
- item.values.forEach((valueObject) => {
- outputObject[valueObject.label] = valueObject.value;
- });
-
- return outputObject;
- });
- }
-
- const convertDate = (
- date: number,
- agg: DashboardDateRangeAggregationOption,
- ) => {
- 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",
- });
- };
-
- const ChartComponent = props.chartType === "area" ? AreaChart : LineChart;
- const TooltipComponent = (tooltipProps: CustomTooltipProps) => (
- <Tooltip
- {...tooltipProps}
- formatter={props.valueFormatter ?? compactNumberFormatter}
- />
- );
- const colors = getColorsForCategories(Array.from(labels));
-
- // Calculate dynamic maxValue based on the maximum value in the data plus 10%
- const dynamicMaxValue = useMemo(() => {
- if (props.data.length === 0) return undefined;
-
- const maxValue = Math.max(
- ...props.data.flatMap((point) => point.values.map((v) => v.value ?? 0)),
- );
-
- if (maxValue <= 0) return undefined;
-
- // Add 10% buffer
- const bufferedValue = maxValue * 1.1;
-
- // Get order of magnitude and rounding goal
- const magnitude = Math.floor(Math.log10(bufferedValue));
- const roundTo = Math.max(1, Math.pow(10, magnitude) / 5);
-
- // Round up to the next multiple of roundTo
- return Math.ceil(bufferedValue / roundTo) * roundTo;
- }, [props.data]);
-
- return (
- <ChartComponent
- className={cn("mt-4", props.className)}
- data={transformArray(props.data)}
- index="timestamp"
- categories={Array.from(labels)}
- connectNulls={props.connectNulls}
- colors={colors}
- valueFormatter={props.valueFormatter ?? compactNumberFormatter}
- noDataText="No data"
- showLegend={props.showLegend}
- showAnimation={true}
- onValueChange={() => {}}
- enableLegendSlider={true}
- customTooltip={TooltipComponent}
- maxValue={dynamicMaxValue}
- />
- );
-}
diff --git a/web/src/features/dashboard/components/ChartScores.tsx b/web/src/features/dashboard/components/ChartScores.tsx
index 91e13d5b4b..ec62c34a9d 100644
--- a/web/src/features/dashboard/components/ChartScores.tsx
+++ b/web/src/features/dashboard/components/ChartScores.tsx
@@ -1,6 +1,5 @@
import { api } from "@/src/utils/api";
-import { BaseTimeSeriesChart } from "@/src/features/dashboard/components/BaseTimeSeriesChart";
import { DashboardCard } from "@/src/features/dashboard/components/cards/DashboardCard";
import { type ScoreDataTypeType, type FilterState } from "@langfuse/shared";
import {
@@ -20,7 +19,7 @@ import {
} 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";
+import { timeSeriesToDataPoints } from "@/src/features/dashboard/lib/chart-data-adapters";
export function ChartScores(props: {
className?: string;
@@ -30,7 +29,6 @@ export function ChartScores(props: {
toTimestamp: Date;
projectId: string;
isLoading?: boolean;
- isDashboardChartsBeta?: boolean;
}) {
const scoresQuery: QueryType = {
view: "scores-numeric",
@@ -94,28 +92,19 @@ export function ChartScores(props: {
isLoading={props.isLoading || scores.isPending}
>
{!isEmptyTimeSeries({ data: extractedScores }) ? (
- 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
+ <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>
) : (
<NoDataOrLoading
isLoading={props.isLoading || scores.isPending}
diff --git a/web/src/features/dashboard/components/LatencyChart.tsx b/web/src/features/dashboard/components/LatencyChart.tsx
index 172433e174..31e440b25d 100644
--- a/web/src/features/dashboard/components/LatencyChart.tsx
+++ b/web/src/features/dashboard/components/LatencyChart.tsx
@@ -6,7 +6,6 @@ import {
isEmptyTimeSeries,
} from "@/src/features/dashboard/components/hooks";
import { DashboardCard } from "@/src/features/dashboard/components/cards/DashboardCard";
-import { BaseTimeSeriesChart } from "@/src/features/dashboard/components/BaseTimeSeriesChart";
import { TabComponent } from "@/src/features/dashboard/components/TabsComponent";
import { latencyFormatter } from "@/src/utils/numbers";
import {
@@ -24,7 +23,7 @@ import {
} 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";
+import { timeSeriesToDataPoints } from "@/src/features/dashboard/lib/chart-data-adapters";
export const GenerationLatencyChart = ({
className,
@@ -34,7 +33,6 @@ export const GenerationLatencyChart = ({
fromTimestamp,
toTimestamp,
isLoading = false,
- isDashboardChartsBeta = false,
}: {
className?: string;
projectId: string;
@@ -43,7 +41,6 @@ export const GenerationLatencyChart = ({
fromTimestamp: Date;
toTimestamp: Date;
isLoading?: boolean;
- isDashboardChartsBeta?: boolean;
}) => {
const {
allModels,
@@ -177,29 +174,19 @@ export const GenerationLatencyChart = ({
content: (
<>
{!isEmptyTimeSeries({ data: item.data }) ? (
- 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}
+ <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>
) : (
<NoDataOrLoading
isLoading={isLoading || latencies.isPending}
diff --git a/web/src/features/dashboard/components/ModelUsageChart.tsx b/web/src/features/dashboard/components/ModelUsageChart.tsx
index 11d6adbbdf..24deb55234 100644
--- a/web/src/features/dashboard/components/ModelUsageChart.tsx
+++ b/web/src/features/dashboard/components/ModelUsageChart.tsx
@@ -1,5 +1,4 @@
import { NoDataOrLoading } from "@/src/components/NoDataOrLoading";
-import { BaseTimeSeriesChart } from "@/src/features/dashboard/components/BaseTimeSeriesChart";
import { DashboardCard } from "@/src/features/dashboard/components/cards/DashboardCard";
import {
extractTimeSeriesData,
@@ -26,7 +25,7 @@ import {
} 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";
+import { timeSeriesToDataPoints } from "@/src/features/dashboard/lib/chart-data-adapters";
export const ModelUsageChart = ({
className,
@@ -37,7 +36,6 @@ export const ModelUsageChart = ({
toTimestamp,
userAndEnvFilterState,
isLoading = false,
- isDashboardChartsBeta = false,
}: {
className?: string;
projectId: string;
@@ -47,7 +45,6 @@ export const ModelUsageChart = ({
toTimestamp: Date;
userAndEnvFilterState: FilterState;
isLoading?: boolean;
- isDashboardChartsBeta?: boolean;
}) => {
const {
allModels,
@@ -283,26 +280,20 @@ export const ModelUsageChart = ({
0,
);
- // had to add this function as tremor under the hodd adds more variables
- // to the function call which would break usdFormatter.
- const oneValueUsdFormatter = (value: number) => {
- return totalCostDashboardFormatted(value);
- };
-
const data = [
{
tabTitle: "Cost by model",
data: costByModel,
totalMetric: totalCostDashboardFormatted(totalCost),
metricDescription: `Cost`,
- formatter: oneValueUsdFormatter,
+ formatter: totalCostDashboardFormatted,
},
{
tabTitle: "Cost by type",
data: costByType,
totalMetric: totalCostDashboardFormatted(totalCost),
metricDescription: `Cost`,
- formatter: oneValueUsdFormatter,
+ formatter: totalCostDashboardFormatted,
},
{
tabTitle: "Usage by model",
@@ -359,30 +350,20 @@ export const ModelUsageChart = ({
<NoDataOrLoading
isLoading={isLoading || queryResult.isPending}
/>
- ) : isDashboardChartsBeta ? (
+ ) : (
<div className="h-80 w-full shrink-0">
<Chart
- chartType="AREA_TIME_SERIES"
+ chartType="LINE_TIME_SERIES"
data={timeSeriesToDataPoints(item.data, agg)}
rowLimit={100}
chartConfig={{
- type: "AREA_TIME_SERIES",
+ type: "LINE_TIME_SERIES",
show_data_point_dots: false,
- subtle_fill: true,
}}
valueFormatter={item.formatter}
legendPosition="above"
/>
</div>
- ) : (
- <BaseTimeSeriesChart
- className="[&_text]:fill-muted-foreground [&_tspan]:fill-muted-foreground"
- agg={agg}
- data={item.data}
- showLegend={true}
- connectNulls={true}
- valueFormatter={item.formatter}
- />
)}
</>
),
diff --git a/web/src/features/dashboard/components/Tooltip.tsx b/web/src/features/dashboard/components/Tooltip.tsx
deleted file mode 100644
index 0f780e0f29..0000000000
--- a/web/src/features/dashboard/components/Tooltip.tsx
+++ /dev/null
@@ -1,48 +0,0 @@
-import { cn } from "@/src/utils/tailwind";
-import { type CustomTooltipProps } from "@tremor/react";
-import { getRandomColor } from "@/src/features/dashboard/utils/getColorsForCategories";
-
-export const Tooltip = ({
- payload,
- active,
- label,
- formatter,
-}: CustomTooltipProps & { formatter: (value: number) => string }) => {
- if (!active || !payload) return null;
-
- // Filter out duplicates and sort by value in descending order
- const uniquePayload = Array.from(
- new Map(payload.map((category) => [category.name, category])).values(),
- );
-
- const sortedPayload = uniquePayload.sort(
- (a, b) => (Number(b.value) ?? 0) - (Number(a.value) ?? 0),
- );
-
- return (
- <div className="rounded-md border border-border bg-background opacity-100 shadow-lg">
- <div className={cn("border-b border-border px-3 py-1.5")}>
- <p className={cn("text-sm font-medium text-muted-foreground")}>
- {label}
- </p>
- </div>
-
- <div className={cn("space-y-1 px-3 py-1.5")}>
- {sortedPayload.map(({ name, value, color }, index) => (
- <div key={`${index}`} className="flex items-center gap-2">
- <div
- className="h-3 w-3 flex-shrink-0 rounded-sm"
- style={{ backgroundColor: color ?? getRandomColor() }}
- />
- <span className="flex-1 text-sm text-muted-foreground">
- {name?.toString() ?? ""}
- </span>
- <span className="text-sm font-medium text-muted-foreground">
- {formatter(Number(value))}
- </span>
- </div>
- ))}
- </div>
- </div>
- );
-};
diff --git a/web/src/features/dashboard/components/TracesBarListChart.tsx b/web/src/features/dashboard/components/TracesBarListChart.tsx
index a3f256f7da..10b1a53a45 100644
--- a/web/src/features/dashboard/components/TracesBarListChart.tsx
+++ b/web/src/features/dashboard/components/TracesBarListChart.tsx
@@ -4,7 +4,6 @@ import { ExpandListButton } from "@/src/features/dashboard/components/cards/Chev
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, numberFormatter } from "@/src/utils/numbers";
import { NoDataOrLoading } from "@/src/components/NoDataOrLoading";
import {
@@ -12,7 +11,7 @@ import {
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";
+import { barListToDataPoints } from "@/src/features/dashboard/lib/chart-data-adapters";
export const TracesBarListChart = ({
className,
@@ -21,7 +20,6 @@ export const TracesBarListChart = ({
fromTimestamp,
toTimestamp,
isLoading = false,
- isDashboardChartsBeta = false,
}: {
className?: string;
projectId: string;
@@ -29,7 +27,6 @@ export const TracesBarListChart = ({
fromTimestamp: Date;
toTimestamp: Date;
isLoading?: boolean;
- isDashboardChartsBeta?: boolean;
}) => {
const [isExpanded, setIsExpanded] = useState(false);
@@ -123,41 +120,29 @@ export const TracesBarListChart = ({
description={"Total traces tracked"}
/>
{adjustedData.length > 0 ? (
- <>
- {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"}
- />
- )}
- </>
+ <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>
) : (
<NoDataOrLoading
isLoading={isLoading || traces.isPending || totalTraces.isPending}
diff --git a/web/src/features/dashboard/components/TracesTimeSeriesChart.tsx b/web/src/features/dashboard/components/TracesTimeSeriesChart.tsx
index 78faca1bff..73fbf51bb4 100644
--- a/web/src/features/dashboard/components/TracesTimeSeriesChart.tsx
+++ b/web/src/features/dashboard/components/TracesTimeSeriesChart.tsx
@@ -1,7 +1,6 @@
import { api } from "@/src/utils/api";
import { type FilterState } from "@langfuse/shared";
import { DashboardCard } from "@/src/features/dashboard/components/cards/DashboardCard";
-import { BaseTimeSeriesChart } from "@/src/features/dashboard/components/BaseTimeSeriesChart";
import { TotalMetric } from "@/src/features/dashboard/components/TotalMetric";
import { compactNumberFormatter } from "@/src/utils/numbers";
import { isEmptyTimeSeries } from "@/src/features/dashboard/components/hooks";
@@ -16,7 +15,7 @@ import {
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";
+import { timeSeriesToDataPoints } from "@/src/features/dashboard/lib/chart-data-adapters";
export const TracesAndObservationsTimeSeriesChart = ({
className,
@@ -26,7 +25,6 @@ export const TracesAndObservationsTimeSeriesChart = ({
toTimestamp,
agg,
isLoading = false,
- isDashboardChartsBeta = false,
}: {
className?: string;
projectId: string;
@@ -35,7 +33,6 @@ export const TracesAndObservationsTimeSeriesChart = ({
toTimestamp: Date;
agg: DashboardDateRangeAggregationOption;
isLoading?: boolean;
- isDashboardChartsBeta?: boolean;
}) => {
const tracesQuery: QueryType = {
view: "traces",
@@ -182,31 +179,18 @@ export const TracesAndObservationsTimeSeriesChart = ({
}
/>
{!isEmptyTimeSeries({ data: item.data }) ? (
- 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>
- )
+ <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,
+ }}
+ legendPosition="above"
+ />
+ </div>
) : (
<NoDataOrLoading
isLoading={isLoading || traces.isPending}
diff --git a/web/src/features/dashboard/components/UserChart.tsx b/web/src/features/dashboard/components/UserChart.tsx
index 8fb7d3349b..0cd4f30d2f 100644
--- a/web/src/features/dashboard/components/UserChart.tsx
+++ b/web/src/features/dashboard/components/UserChart.tsx
@@ -3,7 +3,6 @@ import { type FilterState, getGenerationLikeTypes } from "@langfuse/shared";
import { DashboardCard } from "@/src/features/dashboard/components/cards/DashboardCard";
import { compactNumberFormatter } from "@/src/utils/numbers";
import { TabComponent } from "@/src/features/dashboard/components/TabsComponent";
-import { BarList } from "@tremor/react";
import { TotalMetric } from "@/src/features/dashboard/components/TotalMetric";
import { ExpandListButton } from "@/src/features/dashboard/components/cards/ChevronButton";
import { useState } from "react";
@@ -14,7 +13,7 @@ import {
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";
+import { barListToDataPoints } from "@/src/features/dashboard/lib/chart-data-adapters";
type BarChartDataPoint = {
name: string;
@@ -28,7 +27,6 @@ export const UserChart = ({
fromTimestamp,
toTimestamp,
isLoading = false,
- isDashboardChartsBeta = false,
}: {
className?: string;
projectId: string;
@@ -36,7 +34,6 @@ export const UserChart = ({
fromTimestamp: Date;
toTimestamp: Date;
isLoading?: boolean;
- isDashboardChartsBeta?: boolean;
}) => {
const [isExpanded, setIsExpanded] = useState(false);
const userCostQuery: QueryType = {
@@ -182,42 +179,30 @@ export const UserChart = ({
metric={item.totalMetric}
description={item.metricDescription}
/>
- {isDashboardChartsBeta ? (
- <div
- className="mt-4 w-full"
- style={{
- minHeight: 200,
- height: Math.max(
- 200,
- item.data.length * BAR_ROW_HEIGHT +
- CHART_AXIS_PADDING,
- ),
+ <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,
}}
- >
- <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>
- )}
+ valueFormatter={item.formatter}
+ />
+ </div>
</div>
) : (
<NoDataOrLoading
diff --git a/web/src/features/dashboard/components/hooks.ts b/web/src/features/dashboard/components/hooks.ts
index f8886854a6..0a1f2998a5 100644
--- a/web/src/features/dashboard/components/hooks.ts
+++ b/web/src/features/dashboard/components/hooks.ts
@@ -1,5 +1,9 @@
-import { type TimeSeriesChartDataPoint } from "@/src/features/dashboard/components/BaseTimeSeriesChart";
import { type FilterState, getGenerationLikeTypes } from "@langfuse/shared";
+
+export type TimeSeriesChartDataPoint = {
+ ts: number;
+ values: { label: string; value?: number }[];
+};
import { type DatabaseRow } from "@/src/server/api/services/sqlInterface";
import { api } from "@/src/utils/api";
import { mapLegacyUiTableFilterToView } from "@/src/features/query";
diff --git a/web/src/features/dashboard/components/score-analytics/CategoricalScoreChart.tsx b/web/src/features/dashboard/components/score-analytics/CategoricalScoreChart.tsx
index f3d2265988..d4e61c899e 100644
--- a/web/src/features/dashboard/components/score-analytics/CategoricalScoreChart.tsx
+++ b/web/src/features/dashboard/components/score-analytics/CategoricalScoreChart.tsx
@@ -8,14 +8,13 @@ import {
import React, { useMemo } from "react";
import { DashboardCategoricalScoreAdapter } from "@/src/features/scores/adapters";
import { type ScoreData } from "@/src/features/scores/types";
-import { CategoricalChart } from "@/src/features/scores/components/ScoreChart";
import {
type QueryType,
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 { scoreChartDataToDataPoints } from "@/src/features/dashboard/lib/chart-data-adapters";
import { isEmptyChart } from "@/src/features/dashboard/lib/score-analytics-utils";
import { NoDataOrLoading } from "@/src/components/NoDataOrLoading";
@@ -26,7 +25,6 @@ export function CategoricalScoreChart(props: {
fromTimestamp: Date;
toTimestamp: Date;
agg?: DashboardDateRangeAggregationOption;
- isDashboardChartsBeta?: boolean;
}) {
const scoresQuery: QueryType = {
view: "scores-categorical",
@@ -96,38 +94,26 @@ 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"
- />
- );
- }
+ if (isEmptyChart({ data: chartData })) {
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>
+ <NoDataOrLoading
+ isLoading={scores.isLoading}
+ className="min-h-[9rem] flex-1"
+ />
);
}
-
return (
- <CategoricalChart
- chartData={chartData}
- chartLabels={chartLabels}
- isLoading={scores.isLoading}
- className="min-h-[9rem] flex-1"
- stack={!!props.agg}
- />
+ <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>
);
}
diff --git a/web/src/features/dashboard/components/score-analytics/NumericScoreHistogram.tsx b/web/src/features/dashboard/components/score-analytics/NumericScoreHistogram.tsx
index fa10d2c477..3ea4ae1c91 100644
--- a/web/src/features/dashboard/components/score-analytics/NumericScoreHistogram.tsx
+++ b/web/src/features/dashboard/components/score-analytics/NumericScoreHistogram.tsx
@@ -6,15 +6,9 @@ import {
} from "@langfuse/shared";
import { createTracesTimeFilter } from "@/src/features/dashboard/lib/dashboard-utils";
import React from "react";
-import { BarChart, type CustomTooltipProps } from "@tremor/react";
-import { Card } from "@/src/components/ui/card";
-import { getColorsForCategories } from "@/src/features/dashboard/utils/getColorsForCategories";
-import { 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";
+import { scoreHistogramToDataPoints } from "@/src/features/dashboard/lib/chart-data-adapters";
export function NumericScoreHistogram(props: {
projectId: string;
@@ -22,7 +16,6 @@ export function NumericScoreHistogram(props: {
source: ScoreSourceType;
dataType: Extract<ScoreDataTypeType, "NUMERIC" | "BOOLEAN">;
globalFilterState: FilterState;
- isDashboardChartsBeta?: boolean;
}) {
const histogram = api.dashboard.scoreHistogram.useQuery(
{
@@ -65,19 +58,9 @@ export function NumericScoreHistogram(props: {
? histogram.data
: { chartData: [], chartLabels: [] };
- const colors = getColorsForCategories(chartLabels);
- const paddedChartData = padChartData(chartData);
-
- const TooltipComponent = (tooltipProps: CustomTooltipProps) => (
- <Tooltip
- {...tooltipProps}
- 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"
@@ -86,19 +69,5 @@ export function NumericScoreHistogram(props: {
chartConfig={{ type: "HISTOGRAM", subtle_fill: true }}
/>
</div>
- ) : (
- <Card className="min-h-[9rem] w-full flex-1 rounded-md border">
- <BarChart
- className="mt-4 [&_text]:fill-muted-foreground [&_tspan]:fill-muted-foreground"
- data={paddedChartData}
- index="binLabel"
- categories={chartLabels}
- colors={colors}
- valueFormatter={(number: number) => numberFormatter(number, 0)}
- yAxisWidth={48}
- barCategoryGap={"0%"}
- customTooltip={TooltipComponent}
- />
- </Card>
);
}
diff --git a/web/src/features/dashboard/components/score-analytics/NumericScoreTimeSeriesChart.tsx b/web/src/features/dashboard/components/score-analytics/NumericScoreTimeSeriesChart.tsx
index 0456802b15..7a208157bc 100644
--- a/web/src/features/dashboard/components/score-analytics/NumericScoreTimeSeriesChart.tsx
+++ b/web/src/features/dashboard/components/score-analytics/NumericScoreTimeSeriesChart.tsx
@@ -1,7 +1,5 @@
import { api } from "@/src/utils/api";
-import { BaseTimeSeriesChart } from "@/src/features/dashboard/components/BaseTimeSeriesChart";
-import { Card } from "@/src/components/ui/card";
import {
type ScoreSourceType,
type FilterState,
@@ -25,7 +23,7 @@ import {
} 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";
+import { timeSeriesToDataPoints } from "@/src/features/dashboard/lib/chart-data-adapters";
export function NumericScoreTimeSeriesChart(props: {
projectId: string;
@@ -36,7 +34,6 @@ export function NumericScoreTimeSeriesChart(props: {
globalFilterState: FilterState;
fromTimestamp: Date;
toTimestamp: Date;
- isDashboardChartsBeta?: boolean;
}) {
const scoresQuery: QueryType = {
view: "scores-numeric",
@@ -110,30 +107,19 @@ export function NumericScoreTimeSeriesChart(props: {
data: extractedScores,
isNullValueAllowed: true,
}) ? (
- 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>
- )
+ <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>
) : (
<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.tsx
index d465ccd11d..a98c40a1d3 100644
--- a/web/src/features/dashboard/components/score-analytics/ScoreAnalytics.tsx
+++ b/web/src/features/dashboard/components/score-analytics/ScoreAnalytics.tsx
@@ -29,7 +29,6 @@ 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 scoreAnalyticsOptions
const [selectedDashboardScoreKeys, setSelectedDashboardScoreKeys] =
@@ -123,7 +122,6 @@ export function ScoreAnalytics(props: {
globalFilterState={props.globalFilterState}
fromTimestamp={props.fromTimestamp}
toTimestamp={props.toTimestamp}
- isDashboardChartsBeta={props.isDashboardChartsBeta}
/>
)}
{(isNumericDataType(dataType) ||
@@ -139,7 +137,6 @@ export function ScoreAnalytics(props: {
>
}
globalFilterState={props.globalFilterState}
- isDashboardChartsBeta={props.isDashboardChartsBeta}
/>
)}
</div>
@@ -158,7 +155,6 @@ export function ScoreAnalytics(props: {
globalFilterState={props.globalFilterState}
fromTimestamp={props.fromTimestamp}
toTimestamp={props.toTimestamp}
- isDashboardChartsBeta={props.isDashboardChartsBeta}
/>
)}
{(isNumericDataType(dataType) ||
@@ -177,7 +173,6 @@ export function ScoreAnalytics(props: {
globalFilterState={props.globalFilterState}
fromTimestamp={props.fromTimestamp}
toTimestamp={props.toTimestamp}
- isDashboardChartsBeta={props.isDashboardChartsBeta}
/>
)}
</div>
diff --git a/web/src/features/dashboard/hooks/useDashboardChartsBeta.ts b/web/src/features/dashboard/hooks/useDashboardChartsBeta.ts
deleted file mode 100644
index a360ed6b09..0000000000
--- a/web/src/features/dashboard/hooks/useDashboardChartsBeta.ts
+++ /dev/null
@@ -1,35 +0,0 @@
-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/chart-data-adapters.ts
similarity index 95%
rename from web/src/features/dashboard/lib/tremorv4-recharts-chart-adapters.ts
rename to web/src/features/dashboard/lib/chart-data-adapters.ts
index 50259a8467..203afe54e4 100644
--- a/web/src/features/dashboard/lib/tremorv4-recharts-chart-adapters.ts
+++ b/web/src/features/dashboard/lib/chart-data-adapters.ts
@@ -1,10 +1,9 @@
/**
* 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.
+ * This can be removed once we have 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 { TimeSeriesChartDataPoint } from "@/src/features/dashboard/components/hooks";
import type { ChartBin } from "@/src/features/scores/types";
import {
dashboardDateRangeAggregationSettings,
diff --git a/web/src/features/datasets/components/DatasetRunsTable.tsx b/web/src/features/datasets/components/DatasetRunsTable.tsx
index d680f1e9d0..a4af92144c 100644
--- a/web/src/features/datasets/components/DatasetRunsTable.tsx
+++ b/web/src/features/datasets/components/DatasetRunsTable.tsx
@@ -40,12 +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 { compareViewChartDataToDataPoints } from "@/src/features/dashboard/lib/chart-data-adapters";
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";
import { usePostHogClientCapture } from "@/src/features/posthog-analytics/usePostHogClientCapture";
import { LocalIsoDate } from "@/src/components/LocalIsoDate";
import {
@@ -191,7 +188,6 @@ 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),
@@ -334,7 +330,7 @@ export function DatasetRunsTable(props: {
);
}, [runsMetrics.data, scoreIdToName]);
- const { scoreAnalyticsOptions, scoreKeyToData } = useMemo(
+ const { scoreAnalyticsOptions } = useMemo(
() =>
convertScoreColumnsToAnalyticsData(scoreKeysAndProps.data?.scoreColumns),
[scoreKeysAndProps.data?.scoreColumns],
@@ -636,7 +632,10 @@ export function DatasetRunsTable(props: {
<span className="shrink-0 text-sm font-medium">
{title}
</span>
- <NoDataOrLoading isLoading={true} />
+ <NoDataOrLoading
+ isLoading={runsMetrics.isPending}
+ className="min-h-[200px]"
+ />
</div>
);
}
@@ -647,7 +646,6 @@ export function DatasetRunsTable(props: {
);
const { chartData, chartLabels } = adapter.toChartData();
- const scoreData = scoreKeyToData.get(key);
const valueFormatter =
key === "latency"
? latencyFormatter
@@ -655,22 +653,23 @@ export function DatasetRunsTable(props: {
? 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";
+ 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";
+
+ if (dataPoints.length === 0) {
return (
<div
key={key}
@@ -679,51 +678,35 @@ export function DatasetRunsTable(props: {
<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>
+ <NoDataOrLoading
+ isLoading={runsMetrics.isPending}
+ description="No chart data available for the selected runs."
+ className="min-h-[200px]"
+ />
</div>
);
}
- if (!scoreData)
- return (
- <div key={key} className="h-full min-w-80 max-w-full">
- <TimeseriesChart
- chartData={chartData}
- chartLabels={chartLabels}
- title={title}
- type="numeric"
- maxFractionDigits={
- RESOURCE_METRICS.find(
- (metric) => metric.key === key,
- )?.maxFractionDigits
+ 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-[200px] min-w-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>
- );
-
- return (
- <div key={key} className="h-full min-w-80 max-w-full">
- <TimeseriesChart
- chartData={chartData}
- chartLabels={chartLabels}
- title={title}
- type={
- isNumericDataType(scoreData.dataType)
- ? "numeric"
- : "categorical"
- }
- />
</div>
);
})}
@@ -751,6 +734,7 @@ export function DatasetRunsTable(props: {
runs.data?.runs.map((run) => run.id).includes(runId),
).length > 0 ? (
<DatasetRunTableMultiSelectAction
+ key="multi-select-action"
// Exclude items that are not in the current page
selectedRunIds={Object.keys(selectedRows).filter((runId) =>
runs.data?.runs.map((run) => run.id).includes(runId),
diff --git a/web/src/features/scores/components/ScoreChart.tsx b/web/src/features/scores/components/ScoreChart.tsx
deleted file mode 100644
index 8f3828e75a..0000000000
--- a/web/src/features/scores/components/ScoreChart.tsx
+++ /dev/null
@@ -1,110 +0,0 @@
-import { compactNumberFormatter } from "@/src/utils/numbers";
-import { getColorsForCategories } from "@/src/features/dashboard/utils/getColorsForCategories";
-import { isEmptyChart } from "@/src/features/dashboard/lib/score-analytics-utils";
-import { BarChart, LineChart, type CustomTooltipProps } from "@tremor/react";
-import { NoDataOrLoading } from "@/src/components/NoDataOrLoading";
-import { Card } from "@/src/components/ui/card";
-import { type ChartBin } from "@/src/features/scores/types";
-import { cn } from "@/src/utils/tailwind";
-import { Tooltip } from "@/src/features/dashboard/components/Tooltip";
-
-export function CategoricalChart(props: {
- chartData: ChartBin[];
- chartLabels: string[];
- isLoading?: boolean;
- stack?: boolean;
- showXAxis?: boolean;
- className?: string;
- chartClass?: string;
-}) {
- const barCategoryGap = (chartLength: number): string => {
- if (chartLength > 7) return "10%";
- if (chartLength > 5) return "20%";
- if (chartLength > 3) return "30%";
- else return "40%";
- };
- const colors = getColorsForCategories(props.chartLabels);
-
- const TooltipComponent = (tooltipProps: CustomTooltipProps) => (
- <Tooltip
- {...tooltipProps}
- formatter={(value) => Intl.NumberFormat("en-US").format(value).toString()}
- />
- );
-
- return isEmptyChart({ data: props.chartData }) ? (
- <NoDataOrLoading
- isLoading={props.isLoading ?? false}
- className={props.chartClass}
- />
- ) : (
- <Card
- className={cn(
- "max-h-full min-h-0 min-w-0 max-w-full flex-1 rounded-md border",
- props.className,
- )}
- >
- <BarChart
- className={cn(
- "max-h-full min-h-0 min-w-0 max-w-full [&_text]:fill-muted-foreground [&_tspan]:fill-muted-foreground",
- props.chartClass,
- )}
- data={props.chartData}
- index="binLabel"
- categories={props.chartLabels}
- colors={colors}
- valueFormatter={(number: number) =>
- Intl.NumberFormat("en-US").format(number).toString()
- }
- yAxisWidth={48}
- barCategoryGap={barCategoryGap(props.chartData.length)}
- stack={props.stack ?? true}
- showXAxis={props.showXAxis ?? true}
- customTooltip={TooltipComponent}
- />
- </Card>
- );
-}
-
-export function NumericChart(props: {
- chartData: ChartBin[];
- chartLabels: string[];
- index: string;
- maxFractionDigits?: number;
-}) {
- const colors = getColorsForCategories(props.chartLabels);
-
- const TooltipComponent = (tooltipProps: CustomTooltipProps) => (
- <div className="max-w-56">
- <Tooltip
- {...tooltipProps}
- formatter={(value) =>
- compactNumberFormatter(value, props.maxFractionDigits)
- }
- />
- </div>
- );
-
- 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-md border">
- <LineChart
- className="max-h-full min-h-0 min-w-0 max-w-full [&_text]:fill-muted-foreground [&_tspan]:fill-muted-foreground"
- data={props.chartData}
- index={props.index}
- categories={props.chartLabels}
- colors={colors}
- valueFormatter={(value) => {
- return compactNumberFormatter(value, props.maxFractionDigits);
- }}
- noDataText="No data"
- showAnimation={true}
- onValueChange={() => {}}
- enableLegendSlider={true}
- showXAxis={false}
- customTooltip={TooltipComponent}
- />
- </Card>
- );
-}
diff --git a/web/src/features/scores/components/TimeseriesChart.tsx b/web/src/features/scores/components/TimeseriesChart.tsx
deleted file mode 100644
index cf15e085f9..0000000000
--- a/web/src/features/scores/components/TimeseriesChart.tsx
+++ /dev/null
@@ -1,46 +0,0 @@
-import {
- CategoricalChart,
- NumericChart,
-} from "@/src/features/scores/components/ScoreChart";
-import { type TimeseriesChartProps } from "@/src/features/scores/types";
-
-function ChartWrapper(props: { title: string; children: React.ReactNode }) {
- return (
- <div className="mb-2 flex max-h-full min-h-0 min-w-0 max-w-full flex-none flex-col overflow-hidden">
- <div className="shrink-0 text-sm font-medium">{props.title}</div>
- {props.children}
- </div>
- );
-}
-
-export function TimeseriesChart({
- chartData,
- chartLabels,
- title,
- type,
- index,
- maxFractionDigits,
-}: TimeseriesChartProps) {
- const chartIndex = index ?? "binLabel";
-
- return (
- <ChartWrapper title={title}>
- <div className="mt-2 flex max-h-full min-h-0 min-w-0 max-w-full">
- {type === "categorical" ? (
- <CategoricalChart
- chartLabels={chartLabels}
- chartData={chartData}
- showXAxis={chartData.length < 3}
- />
- ) : (
- <NumericChart
- chartLabels={chartLabels}
- chartData={chartData}
- index={chartIndex}
- maxFractionDigits={maxFractionDigits}
- />
- )}
- </div>
- </ChartWrapper>
- );
-}
diff --git a/web/src/pages/project/[projectId]/datasets/[datasetId]/compare/charts.tsx b/web/src/pages/project/[projectId]/datasets/[datasetId]/compare/charts.tsx
index 4fe480c151..f98f993ce8 100644
--- a/web/src/pages/project/[projectId]/datasets/[datasetId]/compare/charts.tsx
+++ b/web/src/pages/project/[projectId]/datasets/[datasetId]/compare/charts.tsx
@@ -12,10 +12,18 @@ import {
import { CreateExperimentsForm } from "@/src/features/experiments/components/CreateExperimentsForm";
import { useHasProjectAccess } from "@/src/features/rbac/utils/checkProjectAccess";
import { DatasetAnalytics } from "@/src/features/datasets/components/DatasetAnalytics";
-import { TimeseriesChart } from "@/src/features/scores/components/TimeseriesChart";
-import { isNumericDataType } from "@/src/features/scores/lib/helpers";
import { CompareViewAdapter } from "@/src/features/scores/adapters";
-import { RESOURCE_METRICS } from "@/src/features/dashboard/lib/score-analytics-utils";
+import {
+ RESOURCE_METRICS,
+ isEmptyChart,
+} from "@/src/features/dashboard/lib/score-analytics-utils";
+import { compareViewChartDataToDataPoints } from "@/src/features/dashboard/lib/chart-data-adapters";
+import { Chart } from "@/src/features/widgets/chart-library/Chart";
+import {
+ compactNumberFormatter,
+ latencyFormatter,
+ usdFormatter,
+} from "@/src/utils/numbers";
import { usePostHogClientCapture } from "@/src/features/posthog-analytics/usePostHogClientCapture";
import Page from "@/src/components/layouts/page";
import { SubHeaderLabel } from "@/src/components/layouts/header";
@@ -34,6 +42,7 @@ import {
DATASET_RUN_COMPARE_TABS,
getDatasetRunCompareTabs,
} from "@/src/features/navigation/utils/dataset-run-compare-tabs";
+import { NoDataOrLoading } from "@/src/components/NoDataOrLoading";
export default function DatasetCompare() {
const router = useRouter();
@@ -188,47 +197,76 @@ export default function DatasetCompare() {
const { chartData, chartLabels } = adapter.toChartData();
const scoreData = scoreKeyToData.get(key);
- if (!scoreData)
+ const title = scoreData
+ ? `${getScoreDataTypeIcon(scoreData.dataType)} ${scoreData.name} (${scoreData.source.toLowerCase()})`
+ : (RESOURCE_METRICS.find((metric) => metric.key === key)
+ ?.label ?? key);
+
+ const valueFormatter =
+ key === "latency"
+ ? latencyFormatter
+ : key === "cost"
+ ? usdFormatter
+ : (v: number) =>
+ compactNumberFormatter(
+ v,
+ RESOURCE_METRICS.find((m) => m.key === key)
+ ?.maxFractionDigits,
+ );
+
+ if (isEmptyChart({ data: chartData })) {
return (
<div
key={key}
- className="max-h-52 min-h-0 min-w-0 max-w-full"
+ className="flex min-h-[200px] min-w-0 max-w-full flex-col gap-2"
>
- <TimeseriesChart
- key={key}
- chartData={chartData}
- chartLabels={chartLabels}
- title={
- RESOURCE_METRICS.find(
- (metric) => metric.key === key,
- )?.label ?? key
- }
- type="numeric"
- maxFractionDigits={
- RESOURCE_METRICS.find(
- (metric) => metric.key === key,
- )?.maxFractionDigits
- }
+ <span className="shrink-0 text-sm font-medium">
+ {title}
+ </span>
+ <NoDataOrLoading
+ isLoading={false}
+ className="min-h-32 flex-1"
/>
</div>
);
+ }
+
+ 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="max-h-52 min-h-0 min-w-0 max-w-full"
+ className="flex min-h-[200px] min-w-0 max-w-full flex-col gap-2"
>
- <TimeseriesChart
- key={key}
- chartData={chartData}
- chartLabels={chartLabels}
- title={`${getScoreDataTypeIcon(scoreData.dataType)} ${scoreData.name} (${scoreData.source.toLowerCase()})`}
- type={
- isNumericDataType(scoreData.dataType)
- ? "numeric"
- : "categorical"
- }
- />
+ <span className="shrink-0 text-sm font-medium">
+ {title}
+ </span>
+ <div className="min-h-[200px] min-w-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>
);
})}
diff --git a/web/src/pages/project/[projectId]/index.tsx b/web/src/pages/project/[projectId]/index.tsx
index 027aca9269..8659311240 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 { useEffect, useMemo, useRef } from "react";
+import { useMemo } from "react";
import {
findClosestDashboardInterval,
DASHBOARD_AGGREGATION_OPTIONS,
@@ -36,40 +36,10 @@ 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),
@@ -216,30 +186,6 @@ export default function Dashboard() {
scrollable
headerProps={{
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
@@ -311,7 +257,6 @@ export default function Dashboard() {
fromTimestamp={fromTimestamp}
toTimestamp={toTimestamp}
isLoading={environmentFilterOptions.isPending}
- isDashboardChartsBeta={isDashboardChartsBeta}
/>
<ModelCostTable
className="col-span-1 xl:col-span-2"
@@ -335,7 +280,6 @@ export default function Dashboard() {
toTimestamp={toTimestamp}
agg={agg}
isLoading={environmentFilterOptions.isPending}
- isDashboardChartsBeta={isDashboardChartsBeta}
/>
<ModelUsageChart
className="col-span-1 min-h-24 xl:col-span-3"
@@ -346,7 +290,6 @@ export default function Dashboard() {
userAndEnvFilterState={[...userFilterState, ...environmentFilter]}
agg={agg}
isLoading={environmentFilterOptions.isPending}
- isDashboardChartsBeta={isDashboardChartsBeta}
/>
<UserChart
className="col-span-1 xl:col-span-3"
@@ -355,7 +298,6 @@ export default function Dashboard() {
fromTimestamp={fromTimestamp}
toTimestamp={toTimestamp}
isLoading={environmentFilterOptions.isPending}
- isDashboardChartsBeta={isDashboardChartsBeta}
/>
<ChartScores
className="col-span-1 xl:col-span-3"
@@ -365,7 +307,6 @@ export default function Dashboard() {
fromTimestamp={fromTimestamp}
toTimestamp={toTimestamp}
isLoading={environmentFilterOptions.isPending}
- isDashboardChartsBeta={isDashboardChartsBeta}
/>
<LatencyTables
projectId={projectId}
@@ -382,7 +323,6 @@ export default function Dashboard() {
fromTimestamp={fromTimestamp}
toTimestamp={toTimestamp}
isLoading={environmentFilterOptions.isPending}
- isDashboardChartsBeta={isDashboardChartsBeta}
/>
<ScoreAnalytics
className="col-span-1 flex-auto justify-between lg:col-span-full"
@@ -392,7 +332,6 @@ export default function Dashboard() {
fromTimestamp={fromTimestamp}
toTimestamp={toTimestamp}
isLoading={environmentFilterOptions.isPending}
- isDashboardChartsBeta={isDashboardChartsBeta}
/>
</div>
</Page>
diff --git a/web/tailwind.config.ts b/web/tailwind.config.ts
index 07a06a97fe..a2849f0507 100644
--- a/web/tailwind.config.ts
+++ b/web/tailwind.config.ts
@@ -1,5 +1,3 @@
-const colors = require("tailwindcss/colors");
-
/** @type {import('tailwindcss').Config} */
module.exports = {
darkMode: ["class"],
@@ -8,7 +6,6 @@ module.exports = {
"./components/**/*.{ts,tsx,jsx,tsx}",
"./app/**/*.{ts,tsx,jsx,tsx}",
"./src/**/*.{js,ts,jsx,tsx}",
- "./node_modules/@tremor/**/*.{js,ts,jsx,tsx}",
"./node_modules/@ferrucc-io/emoji-picker/dist/**/*.{js,jsx,ts,tsx}",
],
theme: {
@@ -54,65 +51,6 @@ module.exports = {
"accent-light-blue": "hsl(var(--accent-light-blue))",
"accent-dark-blue": "hsl(var(--accent-dark-blue))",
- tremor: {
- brand: {
- faint: colors.blue[50],
- muted: colors.blue[200],
- subtle: colors.blue[400],
- DEFAULT: colors.blue[500],
- emphasis: colors.blue[700],
- inverted: colors.white,
- },
- background: {
- muted: colors.gray[50],
- subtle: colors.gray[100],
- DEFAULT: colors.white,
- emphasis: colors.gray[700],
- },
- border: {
- DEFAULT: colors.gray[200],
- },
- ring: {
- DEFAULT: colors.gray[200],
- },
- content: {
- subtle: colors.gray[400],
- DEFAULT: colors.gray[500],
- emphasis: colors.gray[700],
- strong: "hsl(var(--foreground))",
- inverted: colors.white,
- },
- },
- // dark mode
- "dark-tremor": {
- brand: {
- faint: "#0B1229",
- muted: colors.blue[950],
- subtle: colors.blue[800],
- DEFAULT: colors.blue[500],
- emphasis: colors.blue[400],
- inverted: colors.blue[950],
- },
- background: {
- muted: "#131A2B",
- subtle: colors.gray[800],
- DEFAULT: colors.gray[900],
- emphasis: colors.gray[300],
- },
- border: {
- DEFAULT: colors.gray[800],
- },
- ring: {
- DEFAULT: colors.gray[800],
- },
- content: {
- subtle: colors.gray[600],
- DEFAULT: colors.gray[500],
- emphasis: colors.gray[200],
- strong: "hsl(var(--foreground))",
- inverted: colors.gray[950],
- },
- },
border: "hsl(var(--border))",
input: "hsl(var(--input))",
ring: "hsl(var(--ring))",
@@ -165,22 +103,7 @@ module.exports = {
ring: "hsl(var(--sidebar-ring))",
},
},
- boxShadow: {
- "tremor-input": "0 1px 2px 0 rgb(0 0 0 / 0.05)",
- "tremor-card":
- "0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1)",
- "tremor-dropdown":
- "0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1)",
- "dark-tremor-input": "0 1px 2px 0 rgb(0 0 0 / 0.05)",
- "dark-tremor-card":
- "0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1)",
- "dark-tremor-dropdown":
- "0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1)",
- },
borderRadius: {
- "tremor-small": "0.375rem",
- "tremor-default": "0.5rem",
- "tremor-full": "9999px",
lg: "var(--radius)",
md: "calc(var(--radius) - 2px)",
sm: "calc(var(--radius) - 4px)",
@@ -193,10 +116,6 @@ module.exports = {
xl: "1.2rem",
"2xl": "1.3rem",
"3xl": "1.5rem",
- "tremor-label": ["0.7rem", { lineHeight: "1rem" }],
- "tremor-default": ["0.825rem", { lineHeight: "1.25rem" }],
- "tremor-title": ["0.9rem", { lineHeight: "1.75rem" }],
- "tremor-metric": ["1.5rem", { lineHeight: "2.25rem" }],
},
keyframes: {
"accordion-down": {