🪢 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
fix(web): calmer chart palette with separate line and fill colours (#18692)
Trang Nguyencd4571da0c75
diff --git a/web/.storybook/docs/ThemeTokens/Charts.tsx b/web/.storybook/docs/ThemeTokens/Charts.tsxindex b8979b3084..aa97a8cbc6 100644--- a/web/.storybook/docs/ThemeTokens/Charts.tsx+++ b/web/.storybook/docs/ThemeTokens/Charts.tsx@@ -25,6 +25,13 @@ const seriesEntries = rootEntriesNumber(/\d+/.exec(a.name)?.[0] ?? 0) -Number(/\d+/.exec(b.name)?.[0] ?? 0),);+const fillEntries = rootEntries+ .filter((entry) => /^--chart-fill-\d+$/.test(entry.name))+ .sort(+ (a, b) =>+ Number(/\d+/.exec(a.name)?.[0] ?? 0) -+ Number(/\d+/.exec(b.name)?.[0] ?? 0),+ );const gridEntry = rootEntries.find((entry) => entry.name === "--chart-grid");const scaleEntries = rootEntries.filter((entry) => /^--color-\d+$/.test(entry.name))@@ -59,7 +66,7 @@ function PaletteStrip({);}-/** One grouped bar chart painting every categorical series token. */+/** One grouped bar chart painting every categorical fill token. */function SeriesBarsSample({ ctx }: { ctx: TokenContext }) {const heights = [0.85, 0.6, 0.72, 0.45, 0.65, 0.35, 0.55, 0.25];return (@@ -70,7 +77,7 @@ function SeriesBarsSample({ ctx }: { ctx: TokenContext }) {borderBottomColor: ctx.color("--chart-grid"),}}>- {seriesEntries.map((entry, index) => (+ {fillEntries.map((entry, index) => (<divkey={entry.name}className="flex-1 rounded-t-sm"@@ -84,7 +91,27 @@ function SeriesBarsSample({ ctx }: { ctx: TokenContext }) {);}-/** Per-token mini bars for the series rows. */+/** Per-token mini line for the line rows. */+function ChartLineSample({ ctx, name }: { ctx: TokenContext; name: string }) {+ return (+ <div+ className="flex h-10 items-center rounded-md border px-2.5"+ style={{ background: ctx.color("--background") }}+ >+ <svg viewBox="0 0 64 24" className="h-6 w-16" aria-hidden="true">+ <polyline+ points="0,18 14,10 28,14 42,5 64,9"+ fill="none"+ stroke={ctx.color(name)}+ strokeWidth="2"+ strokeLinejoin="round"+ />+ </svg>+ </div>+ );+}++/** Per-token mini bars for the fill rows. */function ChartBarSample({ ctx, name }: { ctx: TokenContext; name: string }) {const index = Number(/\d+/.exec(name)?.[0] ?? 1);return (@@ -139,31 +166,48 @@ export function Charts() {title="Charts"lede={<>- Two palettes: categorical series colors, and per-score base- colors. Parsed at build time from{" "}+ Categorical series colors (a line set and a matching fill set),+ and per-score base colors. Parsed at build time from{" "}<code className="font-mono">src/styles/globals.css</code>.</>}meta={<>- {seriesEntries.length} series colors · {scaleEntries.length} score- base colors · 1 grid color+ {seriesEntries.length} line colors · {fillEntries.length} fill+ colors · {scaleEntries.length} score base colors · 1 grid color</>}/><TokenSection- title="Categorical series"- blurb="One color per nominal series (trace name, model, level); more series than colors cycle with modulo."+ title="Categorical series: lines"+ blurb="Lines and points, one color per nominal series (trace name, model, level); more series than colors cycle with modulo."count={seriesEntries.length}+ sectionSample={<PaletteStrip ctx={ctx} entries={seriesEntries} />}+ >+ {seriesEntries.map((entry) => (+ <TokenRow+ key={entry.name}+ name={entry.name}+ entry={entry}+ {...rowProps}+ sample={<ChartLineSample ctx={ctx} name={entry.name} />}+ />+ ))}+ </TokenSection>++ <TokenSection+ title="Categorical series: fills"+ blurb="Bars, stacked and grouped bars, histograms and pies. Same slot order as the lines; lighter in light mode, darker in dark mode, and less saturated, because filled marks read heavier than lines."+ count={fillEntries.length}sectionSample={<div className="flex flex-col gap-3">- <PaletteStrip ctx={ctx} entries={seriesEntries} />+ <PaletteStrip ctx={ctx} entries={fillEntries} /><SeriesBarsSample ctx={ctx} /></div>}>- {seriesEntries.map((entry) => (+ {fillEntries.map((entry) => (<TokenRowkey={entry.name}name={entry.name}diff --git a/web/.storybook/docs/ThemeTokens/shared.tsx b/web/.storybook/docs/ThemeTokens/shared.tsxindex 21ebae92c8..b701fe62d1 100644--- a/web/.storybook/docs/ThemeTokens/shared.tsx+++ b/web/.storybook/docs/ThemeTokens/shared.tsx@@ -133,7 +133,8 @@ const PAGE_TOKEN_MATCHERS: Array<{}> = [{page: "charts",- test: (n) => /^--(?:chart-\d+|chart-grid|color-\d+)$/.test(n),+ test: (n) =>+ /^--(?:chart-\d+|chart-fill-\d+|chart-grid|color-\d+)$/.test(n),},{ page: "typography", test: (n) => /^--(?:font-|text-)/.test(n) },{diff --git a/web/src/components/design-system/charts/AreaChart/AreaChart.stories.tsx b/web/src/components/design-system/charts/AreaChart/AreaChart.stories.tsxindex 88c81b5538..fdf7796d68 100644--- a/web/src/components/design-system/charts/AreaChart/AreaChart.stories.tsx+++ b/web/src/components/design-system/charts/AreaChart/AreaChart.stories.tsx@@ -3,12 +3,23 @@ import preview from "../../../../../.storybook/preview";import { expect, fireEvent, userEvent, waitFor, within } from "storybook/test";import { AreaChart } from "./AreaChart";import { type LineChartLegend } from "../LineChart/LineChart";+import { chartColors, chartFillColors } from "../constants";import { AreaChartTimeSeries } from "@/src/features/widgets/chart-library/AreaChartTimeSeries";import { LineChartTimeSeries } from "@/src/features/widgets/chart-library/LineChartTimeSeries";const series = [- { id: "api", label: "API", color: "#3a3dee" },- { id: "worker", label: "Worker", color: "#07b9d5" },+ {+ id: "api",+ label: "API",+ color: chartColors[0],+ fillColor: chartFillColors[0],+ },+ {+ id: "worker",+ label: "Worker",+ color: chartColors[1],+ fillColor: chartFillColors[1],+ },];const data = Array.from({ length: 14 }, (_, index) => ({@@ -293,11 +304,11 @@ export const OverlappingAreas = meta.story({await expect(stops).toHaveLength(4);await expect(stops[0]).toHaveAttribute("stop-color",- "color-mix(in srgb, #3a3dee 75%, hsl(var(--background)))",+ `color-mix(in srgb, ${chartFillColors[0]} 75%, hsl(var(--background)))`,);await expect(stops[2]).toHaveAttribute("stop-color",- "color-mix(in srgb, #07b9d5 75%, hsl(var(--background)))",+ `color-mix(in srgb, ${chartFillColors[1]} 75%, hsl(var(--background)))`,);for (const fill of fills) {await expect(fill).not.toHaveAttribute("fill-opacity");@@ -310,14 +321,14 @@ export const OverlappingAreas = meta.story({await userEvent.hover(hoverArea);await expect(stops[0]).toHaveAttribute("stop-color",- "color-mix(in srgb, #3a3dee 75%, hsl(var(--background)))",+ `color-mix(in srgb, ${chartFillColors[0]} 75%, hsl(var(--background)))`,);await expect(stops[2]).toHaveAttribute("stop-color",- "color-mix(in srgb, #07b9d5 75%, hsl(var(--background)))",+ `color-mix(in srgb, ${chartFillColors[1]} 75%, hsl(var(--background)))`,);for (const stroke of canvasElement.querySelectorAll('path[stroke^="#"]')) {- await expect(stroke).toHaveAttribute("stroke-width", "2.5");+ await expect(stroke).toHaveAttribute("stroke-width", "2");}},});@@ -401,11 +412,15 @@ export const WithLegend = meta.story({canvas.getByRole("button", { name: "Show API" }),).toHaveAttribute("aria-pressed", "false");await expect(- canvasElement.querySelector('linearGradient stop[stop-color*="#3a3dee"]'),+ canvasElement.querySelector(+ `linearGradient stop[stop-color*="${chartFillColors[0]}"]`,+ ),).not.toBeInTheDocument();await userEvent.click(canvas.getByRole("button", { name: "Show API" }));await expect(- canvasElement.querySelector('linearGradient stop[stop-color*="#3a3dee"]'),+ canvasElement.querySelector(+ `linearGradient stop[stop-color*="${chartFillColors[0]}"]`,+ ),).toBeInTheDocument();},});@@ -429,10 +444,12 @@ export const HighlightLegend = meta.story({canvas.getByRole("button", { name: "Show all series" }),).toHaveAttribute("aria-pressed", "true");await expect(- canvasElement.querySelector('linearGradient stop[stop-color*="#07b9d5"]'),+ canvasElement.querySelector(+ `linearGradient stop[stop-color*="${chartFillColors[1]}"]`,+ ),).toHaveAttribute("stop-color",- "color-mix(in srgb, #07b9d5 15%, hsl(var(--background)))",+ `color-mix(in srgb, ${chartFillColors[1]} 15%, hsl(var(--background)))`,);},});diff --git a/web/src/components/design-system/charts/BarChart/BarChart.stories.tsx b/web/src/components/design-system/charts/BarChart/BarChart.stories.tsxindex 6dbb9c0c66..dd5fc76de0 100644--- a/web/src/components/design-system/charts/BarChart/BarChart.stories.tsx+++ b/web/src/components/design-system/charts/BarChart/BarChart.stories.tsx@@ -1,7 +1,7 @@import preview from "../../../../../.storybook/preview";import { expect, spyOn, userEvent, waitFor, within } from "storybook/test";-import { chartColors } from "../constants";+import { chartFillColors } from "../constants";import { BarChart } from "./BarChart";const data = [@@ -111,13 +111,13 @@ export const CategoryColors = meta.story({args: {data: data.map((item, index) => ({...item,- color: chartColors[index],+ color: chartFillColors[index],})),legend: {items: data.map((item, index) => ({id: item.label,label: item.label,- color: chartColors[index] ?? "",+ color: chartFillColors[index] ?? "",})),},},@@ -128,7 +128,7 @@ export const CategoryColorTooltip = meta.story({args: {data: data.map((item, index) => ({...item,- color: chartColors[index],+ color: chartFillColors[index],})),},play: async ({ canvasElement }) => {@@ -139,7 +139,7 @@ export const CategoryColorTooltip = meta.story({);await expect(tooltip.querySelector("svg rect")).toHaveAttribute("fill",- chartColors[0],+ chartFillColors[0],);},});@@ -148,7 +148,7 @@ export const CategoryColorsWithoutLegend = meta.story({args: {data: data.map((item, index) => ({...item,- color: chartColors[index],+ color: chartFillColors[index],})),},});@@ -160,13 +160,13 @@ export const CompactLegend = meta.story({data: data.map((item, index) => ({...item,label: `production-evaluation-run-${item.label}-with-a-long-name`,- color: chartColors[index],+ color: chartFillColors[index],})),legend: {items: data.map((item, index) => ({id: item.label,label: `production-evaluation-run-${item.label}-with-a-long-name`,- color: ["#3a3dee", "#07b9d5", "#f18a42"][index] ?? "",+ color: chartFillColors[index] ?? "",})),},},diff --git a/web/src/components/design-system/charts/ChartTooltip.stories.tsx b/web/src/components/design-system/charts/ChartTooltip.stories.tsxindex 188d594c62..8859f65fee 100644--- a/web/src/components/design-system/charts/ChartTooltip.stories.tsx+++ b/web/src/components/design-system/charts/ChartTooltip.stories.tsx@@ -3,6 +3,7 @@ import preview from "../../../../.storybook/preview";import { expect, spyOn, userEvent, within } from "storybook/test";import { ChartTooltip } from "../internal/charts/ChartTooltip";+import { chartColors, chartFillColors } from "./constants";type ChartTooltipController = Parameters<ComponentProps<typeof ChartTooltip>["children"]@@ -27,7 +28,9 @@ function ChartTooltipDemo({ data }: ChartTooltipDemoProps) {width="240"height="120"rx="12"- fill={activeIndex === data.index ? "#6366f1" : "#a5b4fc"}+ fill={+ activeIndex === data.index ? chartColors[0] : chartFillColors[0]+ }className="outline-hidden focus-visible:outline-2 focus-visible:outline-offset-2"role="graphics-symbol"tabIndex={0}@@ -51,8 +54,8 @@ const itemsData: ChartTooltipDemoProps["data"] = {index: 0,anchor: { type: "element" },items: [- { id: "api", label: "API", value: "$18.42", color: "#6366f1" },- { id: "worker", label: "Worker", value: "$12.08", color: "#06b6d4" },+ { id: "api", label: "API", value: "$18.42", color: chartColors[0] },+ { id: "worker", label: "Worker", value: "$12.08", color: chartColors[1] },],};@@ -108,8 +111,8 @@ export const WithHeading = meta.story({anchor: { type: "element" },heading: "September 22, 2026",items: [- { id: "api", label: "API", value: "1,240", color: "#6366f1" },- { id: "worker", label: "Worker", value: "830", color: "#06b6d4" },+ { id: "api", label: "API", value: "1,240", color: chartColors[0] },+ { id: "worker", label: "Worker", value: "830", color: chartColors[1] },],},},@@ -132,19 +135,19 @@ export const Emphasis = meta.story({id: "emphasized",label: "Emphasized",value: "82",- color: "#6366f1",+ color: chartColors[0],},{id: "dimmed-a",label: "Dimmed",value: "12",- color: "#f59e0b",+ color: chartColors[1],},{id: "dimmed-b",label: "Also dimmed",value: "8",- color: "#06b6d4",+ color: chartColors[2],},],},@@ -166,7 +169,7 @@ export const Primary = meta.story({anchor: { type: "element" },label: "Claude Sonnet",value: "31 (31%)",- color: "#6366f1",+ color: chartColors[0],},},play: async ({ canvasElement }) => {@@ -189,7 +192,7 @@ export const PrimaryWithDetails = meta.story({heading: "Other",label: "Combined slices",value: "8 (8%)",- color: "#6366f1",+ color: chartColors[0],details: [{ label: "Small model", value: "5 (5%)" },{ label: "Legacy model", value: "3 (3%)" },@@ -265,7 +268,7 @@ export const LongContent = meta.story({id: "long-model",label: "A model name that is intentionally long enough to truncate",value: "$1,234,567.890123",- color: "#6366f1",+ color: chartColors[0],},],},diff --git a/web/src/components/design-system/charts/GroupedBarChart/GroupedBarChart.stories.tsx b/web/src/components/design-system/charts/GroupedBarChart/GroupedBarChart.stories.tsxindex 61a3ee783a..c3211fae1c 100644--- a/web/src/components/design-system/charts/GroupedBarChart/GroupedBarChart.stories.tsx+++ b/web/src/components/design-system/charts/GroupedBarChart/GroupedBarChart.stories.tsx@@ -11,8 +11,8 @@ const meta = preview.meta({{ key: "True", values: { first: 18, second: 10 } },],series: [- { id: "first", label: "First", color: "hsl(var(--chart-1))" },- { id: "second", label: "Second", color: "hsl(var(--chart-2))" },+ { id: "first", label: "First", color: "hsl(var(--chart-fill-1))" },+ { id: "second", label: "Second", color: "hsl(var(--chart-fill-2))" },],},decorators: [diff --git a/web/src/components/design-system/charts/HorizontalBarChart/HorizontalBarChart.stories.tsx b/web/src/components/design-system/charts/HorizontalBarChart/HorizontalBarChart.stories.tsxindex d533569bed..00dfc11cab 100644--- a/web/src/components/design-system/charts/HorizontalBarChart/HorizontalBarChart.stories.tsx+++ b/web/src/components/design-system/charts/HorizontalBarChart/HorizontalBarChart.stories.tsx@@ -2,6 +2,7 @@ import preview from "../../../../../.storybook/preview";import { expect, spyOn, userEvent, waitFor, within } from "storybook/test";import { HorizontalBarChart } from "./HorizontalBarChart";+import { chartFillColors } from "../constants";const meta = preview.meta({component: HorizontalBarChart,@@ -138,8 +139,8 @@ export const CategoryColors = meta.story({name: "(Test) Category Colors",args: {data: [- { label: "Alpha", value: 12, color: "#3a3dee" },- { label: "Beta", value: 24, color: "#07b9d5" },+ { label: "Alpha", value: 12, color: chartFillColors[0] },+ { label: "Beta", value: 24, color: chartFillColors[1] },],},play: async ({ canvasElement }) => {@@ -151,7 +152,7 @@ export const CategoryColors = meta.story({);await expect(tooltip.querySelector("svg rect")).toHaveAttribute("fill",- "#07b9d5",+ chartFillColors[1],);},});diff --git a/web/src/components/design-system/charts/HorizontalBarChart/HorizontalBarChart.tsx b/web/src/components/design-system/charts/HorizontalBarChart/HorizontalBarChart.tsxindex a5f1ec32df..ee116923f4 100644--- a/web/src/components/design-system/charts/HorizontalBarChart/HorizontalBarChart.tsx+++ b/web/src/components/design-system/charts/HorizontalBarChart/HorizontalBarChart.tsx@@ -18,7 +18,7 @@ const MAX_GRIDLINE_TO_VALUE_GAP = 24;export function HorizontalBarChart({data,valueFormatter = (value) => value.toLocaleString(),- color = "hsl(var(--chart-1))",+ color = "hsl(var(--chart-fill-1))",}: {data: BarChartDatum[];valueFormatter?: (value: number) => string;@@ -163,6 +163,12 @@ export function HorizontalBarChart({const inactiveTextColor = inactive? "color-mix(in srgb, hsl(var(--foreground)) 40%, hsl(var(--background)))": "hsl(var(--foreground))";+ const valueTextColor = inactive+ ? "color-mix(in srgb, hsl(var(--muted-foreground)) 40%, hsl(var(--background)))"+ : "hsl(var(--muted-foreground))";+ let labelTextColor: string | undefined;+ if (labelOutside) labelTextColor = valueTextColor;+ else if (inactive) labelTextColor = inactiveTextColor;const tooltipData = {type: "primary" as const,anchor: { type: "element" as const },@@ -264,11 +270,7 @@ export function HorizontalBarChart({y={y + rowHeight / 2}dominantBaseline="central"fontSize={12}- fill={- labelOutside || inactive- ? inactiveTextColor- : undefined- }+ fill={labelTextColor}className={labelOutside || inactive? "pointer-events-none"@@ -293,7 +295,7 @@ export function HorizontalBarChart({textAnchor="end"dominantBaseline="central"fontSize={12}- fill={inactiveTextColor}+ fill={valueTextColor}{...referenceProps}>{formattedValue}diff --git a/web/src/components/design-system/charts/LineChart/LineChart.stories.tsx b/web/src/components/design-system/charts/LineChart/LineChart.stories.tsxindex d57ab50b16..c5e2545c87 100644--- a/web/src/components/design-system/charts/LineChart/LineChart.stories.tsx+++ b/web/src/components/design-system/charts/LineChart/LineChart.stories.tsx@@ -7,6 +7,7 @@ import {type LineChartSeries,type LineChartThreshold,} from "./LineChart";+import { chartColors } from "../constants";type LineChartStoryProps = {legend?: LineChartLegend;@@ -76,8 +77,8 @@ const LineChartDemo = (props: LineChartStoryProps) => {};const series = [- { id: "api", label: "API", color: "#3a3dee" },- { id: "worker", label: "Worker", color: "#07b9d5" },+ { id: "api", label: "API", color: chartColors[0] },+ { id: "worker", label: "Worker", color: chartColors[1] },];const data = Array.from({ length: 14 }, (_, index) => ({@@ -124,7 +125,7 @@ const manyLinesSeries: LineChartSeries[] = Array.from((_, index) => ({id: `series-${index + 1}`,label: `Series ${index + 1}`,- color: `hsl(${Math.round((index / 24) * 360)} 70% 50%)`,+ color: chartColors[index % chartColors.length],}),);@@ -152,7 +153,7 @@ const shortCategoryData = Array.from({ length: 6 }, (_, index) => ({}));const categorySeries: LineChartSeries[] = [- { id: "cost", label: "Cost", color: "#3a3dee" },+ { id: "cost", label: "Cost", color: chartColors[0] },];const meta = preview.meta({@@ -239,7 +240,7 @@ export const BoundaryPoints = meta.story({args: { variant: "boundary-points" },play: async ({ canvasElement }) => {const points = canvasElement.querySelectorAll<SVGCircleElement>(- 'circle[fill="#3a3dee"][r="4"]',+ `circle[fill="${chartColors[0]}"][r="3"]`,);await expect(points).toHaveLength(2);for (const point of points) {diff --git a/web/src/components/design-system/charts/PieChart/PieChart.stories.tsx b/web/src/components/design-system/charts/PieChart/PieChart.stories.tsxindex 0cd8f41cd1..3a6e950273 100644--- a/web/src/components/design-system/charts/PieChart/PieChart.stories.tsx+++ b/web/src/components/design-system/charts/PieChart/PieChart.stories.tsx@@ -1,6 +1,6 @@import preview from "../../../../../.storybook/preview";import { expect, spyOn, userEvent, waitFor, within } from "storybook/test";-import { chartColors } from "../constants";+import { chartFillColors } from "../constants";import { PieChart } from "./PieChart";const data = [@@ -46,7 +46,7 @@ export const HoverColors = meta.story({);await userEvent.unhover(first);- await expect(second).toHaveAttribute("fill", chartColors[1]);+ await expect(second).toHaveAttribute("fill", chartFillColors[1]);},});diff --git a/web/src/components/design-system/charts/PieChart/PieChart.tsx b/web/src/components/design-system/charts/PieChart/PieChart.tsxindex e0bf5f9138..2f0c54d90a 100644--- a/web/src/components/design-system/charts/PieChart/PieChart.tsx+++ b/web/src/components/design-system/charts/PieChart/PieChart.tsx@@ -9,7 +9,7 @@ import { ChartContainer } from "@/src/components/design-system/internal/charts/Cimport { ChartTooltip } from "@/src/components/design-system/internal/charts/ChartTooltip";import { useElementSize } from "@/src/hooks/useElementSize";import {- chartColors,+ chartFillColors,INACTIVE_CHART_COLOR_STRENGTH,CHART_TRANSITION_DURATION,} from "@/src/components/design-system/charts/constants";@@ -115,7 +115,7 @@ function PieChartContent({2 * Math.PI - slicesNeedingMinimumAngle.length * MIN_SLICE_ANGLE;const colorScale = scaleOrdinal(chartData.map((datum) => datum.id),- chartColors,+ chartFillColors,);return pie<(typeof chartData)[number]>()diff --git a/web/src/components/design-system/charts/StackedBarChart/StackedBarChart.stories.tsx b/web/src/components/design-system/charts/StackedBarChart/StackedBarChart.stories.tsxindex 6e3b4c8586..3c8673f07d 100644--- a/web/src/components/design-system/charts/StackedBarChart/StackedBarChart.stories.tsx+++ b/web/src/components/design-system/charts/StackedBarChart/StackedBarChart.stories.tsx@@ -13,8 +13,8 @@ const meta = preview.meta({{ key: "Wednesday", values: { api: 10, worker: 15 } },],series: [- { id: "api", label: "API", color: "hsl(var(--chart-1))" },- { id: "worker", label: "Worker", color: "hsl(var(--chart-2))" },+ { id: "api", label: "API", color: "hsl(var(--chart-fill-1))" },+ { id: "worker", label: "Worker", color: "hsl(var(--chart-fill-2))" },],},decorators: [@@ -130,7 +130,7 @@ export const LegendHighlight = meta.story({);await expect(api).toHaveAttribute("fill",- "color-mix(in srgb, hsl(var(--chart-1)) 20%, hsl(var(--background)))",+ "color-mix(in srgb, hsl(var(--chart-fill-1)) 20%, hsl(var(--background)))",);await userEvent.click(canvas.getByRole("button", { name: "Show all series" }),@@ -145,7 +145,7 @@ export const Empty = meta.story({export const SingleSeriesAutoLegend = meta.story({name: "(Test) Single Series Auto Legend",args: {- series: [{ id: "api", label: "API", color: "hsl(var(--chart-1))" }],+ series: [{ id: "api", label: "API", color: "hsl(var(--chart-fill-1))" }],legend: { visibility: "auto", interaction: "highlight", summary: "none" },},play: async ({ canvasElement }) => {@@ -160,7 +160,7 @@ export const SingleSeriesAutoLegend = meta.story({export const SingleSeriesInitiallyHidden = meta.story({name: "(Test) Single Series Initially Hidden",args: {- series: [{ id: "api", label: "API", color: "hsl(var(--chart-1))" }],+ series: [{ id: "api", label: "API", color: "hsl(var(--chart-fill-1))" }],legend: {visibility: "auto",interaction: "toggle",diff --git a/web/src/components/design-system/charts/constants.ts b/web/src/components/design-system/charts/constants.tsindex 57210e2007..4639823298 100644--- a/web/src/components/design-system/charts/constants.ts+++ b/web/src/components/design-system/charts/constants.ts@@ -1,12 +1,24 @@export const chartColors = [- "#5f62f1",- "#058194",- "#76767f",- "#9f41f6",- "#917503",- "#eb1414",- "#53810e",- "#e2187d",+ "#6066d7",+ "#cf6100",+ "#00937d",+ "#8e55c4",+ "#b97500",+ "#3084e8",+ "#298d20",+ "#b7438c",+] as const;++/** Bars, areas and pies read heavier than lines, so they use the calmer fill set. */+export const chartFillColors = [+ "hsl(var(--chart-fill-1))",+ "hsl(var(--chart-fill-2))",+ "hsl(var(--chart-fill-3))",+ "hsl(var(--chart-fill-4))",+ "hsl(var(--chart-fill-5))",+ "hsl(var(--chart-fill-6))",+ "hsl(var(--chart-fill-7))",+ "hsl(var(--chart-fill-8))",] as const;export const INACTIVE_CHART_COLOR_STRENGTH = 20;diff --git a/web/src/components/design-system/internal/charts/BarChartCore.tsx b/web/src/components/design-system/internal/charts/BarChartCore.tsxindex 7dc8bd4e66..8ce9a6cc6c 100644--- a/web/src/components/design-system/internal/charts/BarChartCore.tsx+++ b/web/src/components/design-system/internal/charts/BarChartCore.tsx@@ -68,7 +68,7 @@ export function BarChartCore(function SingleBarChart({data,valueFormatter = (value) => value.toLocaleString(),- color = "hsl(var(--chart-1))",+ color = "hsl(var(--chart-fill-1))",hideXAxisLabels = false,zeroBaseline = true,ariaLabel = "Bar chart",diff --git a/web/src/components/design-system/internal/charts/SeriesChartCore.tsx b/web/src/components/design-system/internal/charts/SeriesChartCore.tsxindex 6afe7d9fe7..90e70f7b44 100644--- a/web/src/components/design-system/internal/charts/SeriesChartCore.tsx+++ b/web/src/components/design-system/internal/charts/SeriesChartCore.tsx@@ -22,6 +22,8 @@ export type LineChartSeries = {id: string;label: string;color: string;+ /** Area fill; falls back to `color`. */+ fillColor?: string;};type ConfiguredLineChartSeries = LineChartSeries & {@@ -87,7 +89,7 @@ type NormalizedDatum = LineChartValues & {const CATEGORY_TICK_GAP = 16;const SERIES_HOVER_DISTANCE = 10;-const MAX_VISIBLE_POINT_RADIUS = 5;+const MAX_VISIBLE_POINT_RADIUS = 4;const defaultValueFormatter = (value: number) => value.toLocaleString();const getSeriesSummaries = (@@ -342,7 +344,9 @@ export function SeriesChartCore(return {id: item.id,label: item.label,- color: item.color,+ color: props.areaVariant+ ? (item.fillColor ?? item.color)+ : item.color,value:legend.summary === "sum" && summaries.get(item.id) !== null? {@@ -847,11 +851,11 @@ function LineChartContent(><stopoffset="0"- stopColor={`color-mix(in srgb, ${item.color} ${dimmed ? 15 : 75}%, hsl(var(--background)))`}+ stopColor={`color-mix(in srgb, ${item.fillColor ?? item.color} ${dimmed ? 15 : 75}%, hsl(var(--background)))`}/><stopoffset="1"- stopColor={`color-mix(in srgb, ${item.color} ${dimmed ? 5 : 25}%, hsl(var(--background)))`}+ stopColor={`color-mix(in srgb, ${item.fillColor ?? item.color} ${dimmed ? 5 : 25}%, hsl(var(--background)))`}/></linearGradient></defs>@@ -869,8 +873,8 @@ function LineChartContent(strokeOpacity={areaVariant && dimmed ? 0.2 : undefined}strokeWidth={item.emphasis === "emphasized" || proximityEmphasized- ? 3.5- : 2.5+ ? 3+ : 2}strokeLinejoin="round"strokeLinecap="round"@@ -894,7 +898,7 @@ function LineChartContent(data-active-data-point={activeForSeries ? "" : undefined}cx={getX(datum)}cy={yScale(value)}- r={activeForSeries ? 5 : 4}+ r={activeForSeries ? 4 : 3}fill={item.color}pointerEvents="none"/>@@ -922,11 +926,13 @@ function LineChartContent(.sort((left, right) => right.value - left.value);const first = values[0];const heading = formatXTooltip(datum);+ const swatchColor = (item: LineChartSeries) =>+ areaVariant ? (item.fillColor ?? item.color) : item.color;const tooltipItems = values.map(({ item, value }) => ({id: item.id,label: item.label,value: valueFormatter(value),- color: hasDistinctColors ? item.color : undefined,+ color: hasDistinctColors ? swatchColor(item) : undefined,}));const referenceProps = getReferenceProps(firstdiff --git a/web/src/features/widgets/chart-library/AllWidgetCharts.stories.tsx b/web/src/features/widgets/chart-library/AllWidgetCharts.stories.tsxnew file mode 100644index 0000000000..b796dd3c1c--- /dev/null+++ b/web/src/features/widgets/chart-library/AllWidgetCharts.stories.tsx@@ -0,0 +1,113 @@+import { type DashboardWidgetChartType } from "@langfuse/shared/src/db";+import preview from "../../../../.storybook/preview";+import { Chart } from "./Chart";+import { type DataPoint } from "./chart-props";++const models = [+ "claude-opus-5-5",+ "claude-sonnet-5-5",+ "gpt-5.4",+ "claude-haiku-4-5",+ "gpt-5.4-mini",+];++const timeSeries: DataPoint[] = Array.from({ length: 14 }, (_, day) => {+ const time_dimension = new Date(Date.UTC(2026, 8, 30 + day)).toISOString();+ return models.map((dimension, index) => ({+ time_dimension,+ dimension,+ metric: Math.round(+ (60 - index * 9) * (1 + 0.35 * Math.sin(day / 2 + index)) * 10,+ ),+ }));+}).flat();++const traceNames: DataPoint[] = [+ ["agent-turn", 3493],+ ["in-app-agent-conversation", 1677],+ ["search-bar-filter", 303],+ ["experiment-item-run", 202],+ ["natural-language-filter", 64],+ ["introspection-only", 12],+].map(([dimension, metric]) => ({+ time_dimension: undefined,+ dimension: dimension as string,+ metric: metric as number,+}));++const modelTotals: DataPoint[] = models.map((dimension, index) => ({+ time_dimension: undefined,+ dimension,+ metric: [910, 648, 320, 120, 40][index] ?? 0,+}));++const latencyBins: DataPoint[] = Array.from({ length: 12 }, (_, bin) => ({+ time_dimension: undefined,+ dimension: `${bin * 250}-${(bin + 1) * 250}ms`,+ metric: Math.round(400 * Math.exp(-((bin - 3) ** 2) / 8)),+}));++const widgets: {+ title: string;+ chartType: DashboardWidgetChartType;+ data: DataPoint[];+ colorBarsByCategory?: boolean;+}[] = [+ {+ title: "Line time series",+ chartType: "LINE_TIME_SERIES",+ data: timeSeries,+ },+ {+ title: "Area time series",+ chartType: "AREA_TIME_SERIES",+ data: timeSeries,+ },+ { title: "Bar time series", chartType: "BAR_TIME_SERIES", data: timeSeries },+ { title: "Vertical bar", chartType: "VERTICAL_BAR", data: traceNames },+ {+ title: "Vertical bar, colour by category",+ chartType: "VERTICAL_BAR",+ data: modelTotals,+ colorBarsByCategory: true,+ },+ { title: "Horizontal bar", chartType: "HORIZONTAL_BAR", data: traceNames },+ { title: "Pie", chartType: "PIE", data: modelTotals },+ { title: "Histogram", chartType: "HISTOGRAM", data: latencyBins },+ {+ title: "Number",+ chartType: "NUMBER",+ data: [{ time_dimension: undefined, dimension: undefined, metric: 38750 }],+ },+];++function AllWidgetCharts() {+ return (+ <div className="bg-background grid grid-cols-1 gap-4 p-4 md:grid-cols-2 xl:grid-cols-3">+ {widgets.map((widget) => (+ <div+ key={widget.title}+ className="bg-card flex h-80 flex-col rounded-lg border"+ >+ <div className="p-4 pb-2 text-sm font-bold">{widget.title}</div>+ <div className="flex min-h-0 flex-1 flex-col px-4 pb-4">+ <Chart+ chartType={widget.chartType}+ data={widget.data}+ rowLimit={20}+ legendPosition="auto"+ colorBarsByCategory={widget.colorBarsByCategory}+ />+ </div>+ </div>+ ))}+ </div>+ );+}++const meta = preview.meta({+ component: AllWidgetCharts,+ parameters: { layout: "fullscreen" },+});++export const Default = meta.story({});diff --git a/web/src/features/widgets/chart-library/AreaChartTimeSeries.tsx b/web/src/features/widgets/chart-library/AreaChartTimeSeries.tsxindex 535b272507..354fe83d47 100644--- a/web/src/features/widgets/chart-library/AreaChartTimeSeries.tsx+++ b/web/src/features/widgets/chart-library/AreaChartTimeSeries.tsx@@ -17,6 +17,7 @@ import {import { prepareVisibleSeries } from "@/src/features/widgets/chart-library/prepareVisibleSeries";import {seriesColor,+ seriesFillColor,SeriesOverflowNote,} from "@/src/features/widgets/chart-library/TimeSeriesLegend";import { getPlainTextFromReactNode } from "@/src/utils/react-node-plain-text";@@ -97,6 +98,7 @@ export function AreaChartTimeSeries({getPlainTextFromReactNode(config?.[dimension]?.label ?? dimension) ??dimension,color: seriesColor(index),+ fillColor: seriesFillColor(index),}));const chartLegend = useMemo<LineChartLegend>(() => {if (legendPosition === "none") return { visibility: "hidden" };diff --git a/web/src/features/widgets/chart-library/HistogramChart.tsx b/web/src/features/widgets/chart-library/HistogramChart.tsxindex e86bfad704..a85d0c15a6 100644--- a/web/src/features/widgets/chart-library/HistogramChart.tsx+++ b/web/src/features/widgets/chart-library/HistogramChart.tsx@@ -14,7 +14,7 @@ const HistogramChart = ({config = {count: {label: "Count",- color: "hsl(var(--chart-1))",+ color: "hsl(var(--chart-fill-1))",},},metricFormatter = (value, options) => formatMetric(value, options),@@ -58,7 +58,7 @@ const HistogramChart = ({return (<DesignSystemHistogramChartdata={histogramData}- color={config.count?.color ?? "hsl(var(--chart-1))"}+ color={config.count?.color ?? "hsl(var(--chart-fill-1))"}valueFormatter={(value) =>toFullMetricString(formatMetric(value, { style: "compact" }))}diff --git a/web/src/features/widgets/chart-library/TimeSeriesLegend.tsx b/web/src/features/widgets/chart-library/TimeSeriesLegend.tsxindex 00ca7ea125..0b9cbcf6df 100644--- a/web/src/features/widgets/chart-library/TimeSeriesLegend.tsx+++ b/web/src/features/widgets/chart-library/TimeSeriesLegend.tsx@@ -1,7 +1,11 @@-/** The 8-slot chart palette, cycled by series index (matches the series fills). */+/** The 8-slot chart line palette, cycled by series index. */export const seriesColor = (index: number): string =>`hsl(var(--chart-${(index % 8) + 1}))`;+/** The matching fill slot, for bars and areas. */+export const seriesFillColor = (index: number): string =>+ `hsl(var(--chart-fill-${(index % 8) + 1}))`;+/*** Honest "we didn't draw everything" caption for charts whose breakdown* overflowed the render cap (see {@link prepareVisibleSeries}). Rendered evendiff --git a/web/src/features/widgets/chart-library/TopListChart.tsx b/web/src/features/widgets/chart-library/TopListChart.tsxindex 9f8642e9a2..59d065707e 100644--- a/web/src/features/widgets/chart-library/TopListChart.tsx+++ b/web/src/features/widgets/chart-library/TopListChart.tsx@@ -20,7 +20,7 @@ export function TopListChart({valueFormatter={(value) =>toFullMetricString(metricFormatter(value, { style: "compact" }))}- color={config?.metric?.color ?? "hsl(var(--chart-1))"}+ color={config?.metric?.color ?? "hsl(var(--chart-fill-1))"}/>);}diff --git a/web/src/features/widgets/chart-library/VerticalBarChart.tsx b/web/src/features/widgets/chart-library/VerticalBarChart.tsxindex ed5b454e9e..4dc6b0efe5 100644--- a/web/src/features/widgets/chart-library/VerticalBarChart.tsx+++ b/web/src/features/widgets/chart-library/VerticalBarChart.tsx@@ -36,7 +36,7 @@ export function VerticalBarChart({return (<DesignSystemBarChartdata={chartData}- color={config?.metric?.color ?? "hsl(var(--chart-1))"}+ color={config?.metric?.color ?? "hsl(var(--chart-fill-1))"}valueFormatter={formatValue}hideXAxisLabels={hideXAxisLabels}zeroBaseline={zeroBaseline}diff --git a/web/src/features/widgets/chart-library/VerticalBarChartTimeSeries.tsx b/web/src/features/widgets/chart-library/VerticalBarChartTimeSeries.tsxindex e76713ef61..992ca9be14 100644--- a/web/src/features/widgets/chart-library/VerticalBarChartTimeSeries.tsx+++ b/web/src/features/widgets/chart-library/VerticalBarChartTimeSeries.tsx@@ -15,7 +15,7 @@ import {} from "@/src/features/widgets/chart-library/prepareTimeAxis";import { prepareVisibleSeries } from "@/src/features/widgets/chart-library/prepareVisibleSeries";import {- seriesColor,+ seriesFillColor,SeriesOverflowNote,} from "@/src/features/widgets/chart-library/TimeSeriesLegend";import { getPlainTextFromReactNode } from "@/src/utils/react-node-plain-text";@@ -73,7 +73,7 @@ export function VerticalBarChartTimeSeries({label:getPlainTextFromReactNode(config?.[dimension]?.label ?? dimension) ??dimension,- color: seriesColor(index),+ color: seriesFillColor(index),})),[visibleSeries, config],);diff --git a/web/src/features/widgets/chart-library/prepareCategoryBars.ts b/web/src/features/widgets/chart-library/prepareCategoryBars.tsindex 73254c20c8..1e24dc57d7 100644--- a/web/src/features/widgets/chart-library/prepareCategoryBars.ts+++ b/web/src/features/widgets/chart-library/prepareCategoryBars.ts@@ -1,9 +1,9 @@import { type DataPoint } from "@/src/features/widgets/chart-library/chart-props";-import { seriesColor } from "@/src/features/widgets/chart-library/TimeSeriesLegend";+import { seriesFillColor } from "@/src/features/widgets/chart-library/TimeSeriesLegend";/*** How many bars a colour can still IDENTIFY. The chart palette holds 8 slots and- * `seriesColor` cycles them, so from the ninth bar on two bars share a colour+ * `seriesFillColor` cycles them, so from the ninth bar on two bars share a colour* and a swatch names nothing — a legend built on it would be actively wrong* about which bar is which. Past the limit we colour every bar alike and leave* identity to the tooltip, rather than shipping a legend that lies.@@ -53,11 +53,11 @@ export function prepareCategoryBars(data: DataPoint[]): CategoryBars {rows: data.map((point) =>point.dimension === undefined? point- : { ...point, fill: seriesColor(order.get(point.dimension) ?? 0) },+ : { ...point, fill: seriesFillColor(order.get(point.dimension) ?? 0) },),legend: Array.from(order, ([category, index]) => ({category,- color: seriesColor(index),+ color: seriesFillColor(index),})),total,};diff --git a/web/src/styles/globals.css b/web/src/styles/globals.cssindex d6ee641265..8eb02869b7 100644--- a/web/src/styles/globals.css+++ b/web/src/styles/globals.css@@ -521,14 +521,22 @@--find-match-selected-background: 60 100% 50%;--find-match-selected-foreground: 0 0% 0%;- --chart-1: 239 84% 66%;- --chart-2: 188 94% 30%;- --chart-3: 240 4% 48%;- --chart-4: 271 91% 61%;- --chart-5: 48 96% 29%;- --chart-6: 0 84% 50%;- --chart-7: 84 81% 28%;- --chart-8: 330 81% 49%;+ --chart-1: 237 60% 61%; /* indigo */+ --chart-2: 28 100% 41%; /* orange */+ --chart-3: 171 100% 29%; /* teal */+ --chart-4: 271 48% 55%; /* violet */+ --chart-5: 38 100% 36%; /* amber */+ --chart-6: 213 80% 55%; /* blue */+ --chart-7: 115 63% 34%; /* green */+ --chart-8: 322 46% 49%; /* magenta */+ --chart-fill-1: 234 90% 77%;+ --chart-fill-2: 25 87% 64%;+ --chart-fill-3: 173 100% 37%;+ --chart-fill-4: 269 68% 73%;+ --chart-fill-5: 40 72% 54%;+ --chart-fill-6: 212 100% 72%;+ --chart-fill-7: 115 38% 56%;+ --chart-fill-8: 325 61% 68%;--chart-grid: var(--muted-gray);--color-1: oklch(66.2% 0.225 25.9);--color-2: oklch(60.4% 0.26 302);@@ -742,14 +750,22 @@--find-match-selected-background: 60 100% 50%;--find-match-selected-foreground: 0 0% 0%;- --chart-1: 239 96% 69%;- --chart-2: 188 94% 30%;- --chart-3: 240 4% 48%;- --chart-4: 271 91% 61%;- --chart-5: 48 96% 29%;- --chart-6: 0 84% 50%;- --chart-7: 84 81% 28%;- --chart-8: 330 81% 49%;+ --chart-1: 236 75% 68%; /* indigo */+ --chart-2: 30 100% 43%; /* orange */+ --chart-3: 172 100% 32%; /* teal */+ --chart-4: 270 59% 62%; /* violet */+ --chart-5: 39 100% 39%; /* amber */+ --chart-6: 213 90% 60%; /* blue */+ --chart-7: 115 50% 41%; /* green */+ --chart-8: 323 53% 56%; /* magenta */+ --chart-fill-1: 235 44% 56%;+ --chart-fill-2: 30 97% 36%;+ --chart-fill-3: 172 100% 27%;+ --chart-fill-4: 269 37% 52%;+ --chart-fill-5: 40 100% 32%;+ --chart-fill-6: 213 57% 50%;+ --chart-fill-7: 115 46% 35%;+ --chart-fill-8: 323 39% 47%;--chart-grid: var(--muted-gray);--color-1: oklch(66.2% 0.225 25.9);--color-2: oklch(60.4% 0.26 302);