Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

fix(insights): round horizontal bar end caps in trends bar value charts (#68480)

Sam Pennington2d0a74f252b6
diff --git a/frontend/src/scenes/insights/EmptyStates/SampleDataState.tsx b/frontend/src/scenes/insights/EmptyStates/SampleDataState.tsx
index 7a82829aeae8..94f7acd0333c 100644
--- a/frontend/src/scenes/insights/EmptyStates/SampleDataState.tsx
+++ b/frontend/src/scenes/insights/EmptyStates/SampleDataState.tsx
@@ -43,7 +43,7 @@ const TABLE_ROWS = [
const SAMPLE_NUMBERS = [1284, 1327, 1291, 1362, 1408, 1373]
const LINE_CONFIG: LineChartConfig = { showGrid: true, showCrosshair: true }
-const BAR_CONFIG: BarChartConfig = { bars: { cornerRadius: 2 } }
+const BAR_CONFIG: BarChartConfig = { barCornerRadius: 2 }
function SampleNumber({ animate }: { animate: boolean }): JSX.Element {
const [valueIndex, setValueIndex] = useState(0)
diff --git a/frontend/src/scenes/surveys/components/question-visualizations/MultipleChoiceBarChart.tsx b/frontend/src/scenes/surveys/components/question-visualizations/MultipleChoiceBarChart.tsx
index 455ad1f138c0..46b91c54d28e 100644
--- a/frontend/src/scenes/surveys/components/question-visualizations/MultipleChoiceBarChart.tsx
+++ b/frontend/src/scenes/surveys/components/question-visualizations/MultipleChoiceBarChart.tsx
@@ -68,8 +68,8 @@ export function MultipleChoiceBarChart({
maxCategoryLabelWidth: CATEGORY_LABEL_WIDTH,
xTickFormatter: (_label, index) => chartData[index]?.label ?? '',
margins: { top: 4, right: 20, bottom: 4 },
+ barCornerRadius: 3,
bars: {
- cornerRadius: 3,
minBandSize: 32,
valueDomain: [0, 100],
},
diff --git a/packages/quill/packages/charts/AGENTS.md b/packages/quill/packages/charts/AGENTS.md
index d9fbba9e6e50..373dafda6c0a 100644
--- a/packages/quill/packages/charts/AGENTS.md
+++ b/packages/quill/packages/charts/AGENTS.md
@@ -7,7 +7,7 @@ Quick-reference for AI agents using `@posthog/quill-charts`. Canvas-rendered cha
| Chart | Use when |
| -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| LineChart | Categorical x-axis trends; area fills, fill-between (confidence ribbons) |
-| BarChart | Categorical comparisons — `barLayout: 'stacked' \| 'grouped' \| 'percent'`, `axisOrientation: 'horizontal'` for horizontal bars |
+| BarChart | Categorical comparisons — `barLayout: 'stacked' \| 'grouped' \| 'percent'`, `axisOrientation: 'horizontal'` for horizontal bars; end-cap rounding via top-level `barCornerRadius` (the same key across the time-series/combo configs) |
| ComboChart | Mixed bar/line/area series on one band x-axis — set `Series.type`; vertical-only, `barLayout: 'stacked' \| 'grouped' \| 'percent'` (percent stacks bar series to 100%; a line/area series needs its own `yAxisId: 'right'` axis — one sharing the bars' axis can't plot raw values against their [0,1] scale) |
| TimeSeriesLineChart | Time-indexed labels (ISO strings) with timezone/interval-aware x-axis |
| TimeSeriesBarChart | Same x-axis handling, bar rendering; supports per-series `yAxisId` axes |
diff --git a/packages/quill/packages/charts/src/charts/BarChart/BarChart.stories.tsx b/packages/quill/packages/charts/src/charts/BarChart/BarChart.stories.tsx
index 4890c0ec8d67..749a9ebbb989 100644
--- a/packages/quill/packages/charts/src/charts/BarChart/BarChart.stories.tsx
+++ b/packages/quill/packages/charts/src/charts/BarChart/BarChart.stories.tsx
@@ -50,7 +50,7 @@ export const Grouped: Story = {
export const WithBarTrack: Story = {
render: () => {
const theme = useReactiveTheme()
- const config: BarChartConfig = { barLayout: 'grouped', showGrid: true, bars: { track: true, cornerRadius: 6 } }
+ const config: BarChartConfig = { barLayout: 'grouped', showGrid: true, barCornerRadius: 6, bars: { track: true } }
return (
<Stage>
<BarChart series={THREE_SERIES} labels={DAYS} config={config} theme={theme} />
@@ -72,7 +72,8 @@ export const WithBarTrackCeiling: Story = {
const config: BarChartConfig = {
barLayout: 'grouped',
showGrid: true,
- bars: { track: true, cornerRadius: 6, valueDomain: [0, 100] },
+ barCornerRadius: 6,
+ bars: { track: true, valueDomain: [0, 100] },
}
return (
<Stage>
@@ -97,7 +98,8 @@ export const StackedWithTrackCeiling: Story = {
barLayout: 'stacked',
axisOrientation: 'horizontal',
showGrid: true,
- bars: { cornerRadius: 6, valueDomain: [0, 100] },
+ barCornerRadius: 6,
+ bars: { valueDomain: [0, 100] },
}
return (
<Stage height={120}>
@@ -168,7 +170,8 @@ export const HorizontalWideValueLabels: Story = {
axisOrientation: 'horizontal',
showGrid: true,
yTickFormatter: (v) => v.toLocaleString('en-US'),
- bars: { cornerRadius: 4, fitToHeight: true },
+ barCornerRadius: 4,
+ bars: { fitToHeight: true },
}
const labels = ['/pricing', '/signup', '/product', '/docs', '/blog']
const series: Series[] = [
@@ -316,7 +319,7 @@ export const LargeDataset: Story = {
export const CustomCornerRadius: Story = {
render: () => {
const theme = useReactiveTheme()
- const config: BarChartConfig = { barLayout: 'grouped', showGrid: true, bars: { cornerRadius: 12 } }
+ const config: BarChartConfig = { barLayout: 'grouped', showGrid: true, barCornerRadius: 12 }
return (
<Stage>
<BarChart series={TWO_SERIES} labels={DAYS} config={config} theme={theme} />
@@ -344,7 +347,8 @@ function FillStyleColumn({ title, fillStyle }: { title: string; fillStyle: BarFi
barLayout: 'grouped',
showGrid: true,
axisOrientation: 'horizontal',
- bars: { cornerRadius: 4, fillStyle },
+ barCornerRadius: 4,
+ bars: { fillStyle },
}
return (
// eslint-disable-next-line react/forbid-dom-props
diff --git a/packages/quill/packages/charts/src/charts/BarChart/BarChart.tsx b/packages/quill/packages/charts/src/charts/BarChart/BarChart.tsx
index bd46f9f20ae7..d6880a4ced6c 100644
--- a/packages/quill/packages/charts/src/charts/BarChart/BarChart.tsx
+++ b/packages/quill/packages/charts/src/charts/BarChart/BarChart.tsx
@@ -80,12 +80,12 @@ function BarChartInner<Meta = unknown>({
barLayout = 'stacked',
axisOrientation = 'vertical',
xTickFormatter,
+ barCornerRadius = 0,
yAxes: configYAxes,
} = config ?? {}
const { x: xAxisLine, y: yAxisLine } = resolveAxisLines(showAxisLines)
const axisLines = useMemo(() => ({ x: xAxisLine, y: yAxisLine }), [xAxisLine, yAxisLine])
const {
- cornerRadius: barCornerRadius = 0,
track: trackConfig = false,
shadow: barShadow,
divergingStack = false,
diff --git a/packages/quill/packages/charts/src/charts/TimeSeriesBarChart/TimeSeriesBarChart.tsx b/packages/quill/packages/charts/src/charts/TimeSeriesBarChart/TimeSeriesBarChart.tsx
index faf66633f345..f95797a4be90 100644
--- a/packages/quill/packages/charts/src/charts/TimeSeriesBarChart/TimeSeriesBarChart.tsx
+++ b/packages/quill/packages/charts/src/charts/TimeSeriesBarChart/TimeSeriesBarChart.tsx
@@ -137,8 +137,8 @@ export function TimeSeriesBarChart<Meta = unknown>({
tooltip: timeSeriesTooltipConfig,
animateHover,
yAxes,
+ barCornerRadius,
bars: {
- cornerRadius: barCornerRadius,
divergingStack,
valueDomain,
fillStyle,
diff --git a/packages/quill/packages/charts/src/core/types.ts b/packages/quill/packages/charts/src/core/types.ts
index ea48e5e001ce..2f99adee876e 100644
--- a/packages/quill/packages/charts/src/core/types.ts
+++ b/packages/quill/packages/charts/src/core/types.ts
@@ -384,9 +384,6 @@ export type ValueDomain =
export type BarFillStyle = 'flat' | 'gradient' | 'gloss'
export interface BarsConfig {
- /** Corner radius in px for the rounded end(s) of a bar. Stacked bars only round the topmost
- * segment. Defaults to 0 (square). */
- cornerRadius?: number
/** Draw a faint hatched track behind each bar, spanning the full plot height — for
* funnel-style charts where every bar is a share of a whole. Only honored when
* `barLayout: 'grouped'`; ignored for stacked/percent (the "share of a whole"
@@ -427,7 +424,7 @@ export interface BarsConfig {
/** Stacked layouts only — round both *outer* ends of the whole stack so it reads as one pill,
* rather than only the topmost segment's cap. Implemented by clipping the bar layer to a
* rounded rect spanning each band's full extent and drawing the segments square, so the outer
- * corners round at the full `cornerRadius` even when the edge segment is a thin sliver (e.g.
+ * corners round at the full `barCornerRadius` even when the edge segment is a thin sliver (e.g.
* the last breakdown of a near-100% funnel step) — which per-segment rounding can't, as it
* clamps the radius to the sliver's half-width. Defaults to `false`. */
roundStackEnds?: boolean
@@ -436,8 +433,13 @@ export interface BarsConfig {
export interface BarChartConfig extends ChartConfig {
/** Defaults to `stacked`. */
barLayout?: 'stacked' | 'grouped' | 'percent'
- /** Bar appearance + band-layout details (corner rounding, track, shadow, padding…). */
+ /** Bar appearance + band-layout details (track, shadow, padding, fill style…). */
bars?: BarsConfig
+ /** Corner radius in px for the rounded end(s) of a bar. Stacked bars only round the topmost
+ * segment (or the whole stack with {@link BarsConfig.roundStackEnds}). Defaults to 0 (square).
+ * Same top-level key as the time-series/combo configs, so one config shape rounds every bar
+ * chart and shared config defaults can target them all. */
+ barCornerRadius?: number
/** Built-in legend with click-to-toggle series visibility. Hidden by default. */
legend?: ChartLegendConfig
}
diff --git a/products/mcp_analytics/frontend/dashboard/ToolErrorRateChart.tsx b/products/mcp_analytics/frontend/dashboard/ToolErrorRateChart.tsx
index 39b6dbd4699c..7347eb766b92 100644
--- a/products/mcp_analytics/frontend/dashboard/ToolErrorRateChart.tsx
+++ b/products/mcp_analytics/frontend/dashboard/ToolErrorRateChart.tsx
@@ -62,7 +62,8 @@ export function ToolErrorRateChart({
yTickFormatter: (value: number) => formatPercentage(value, { compact: true }),
tooltip: { placement: 'cursor' },
margins: { top: 4, right: 20, bottom: 22 },
- bars: { cornerRadius: 4, minBandSize: 30, valueDomain: [0, axisMax] },
+ barCornerRadius: 4,
+ bars: { minBandSize: 30, valueDomain: [0, axisMax] },
}
}, [sorted])
const byTool = useMemo(() => new Map(sorted.map((r) => [r.tool, r])), [sorted])
diff --git a/products/product_analytics/frontend/insights/funnels/FunnelBarHorizontalChart/SingleStepBar.tsx b/products/product_analytics/frontend/insights/funnels/FunnelBarHorizontalChart/SingleStepBar.tsx
index 29b564d93cad..fa722558ad75 100644
--- a/products/product_analytics/frontend/insights/funnels/FunnelBarHorizontalChart/SingleStepBar.tsx
+++ b/products/product_analytics/frontend/insights/funnels/FunnelBarHorizontalChart/SingleStepBar.tsx
@@ -37,8 +37,8 @@ const CHART_CONFIG: BarChartConfig = {
animateHover: true,
margins: { top: 0, right: 0, bottom: 0, left: 0 },
tooltip: { placement: 'cursor' },
+ barCornerRadius: BAR_CORNER_RADIUS,
bars: {
- cornerRadius: BAR_CORNER_RADIUS,
bandPadding: 0,
minBandSize: 0,
valueDomain: FUNNEL_BAR_HORIZONTAL_VALUE_DOMAIN,
diff --git a/products/product_analytics/frontend/insights/funnels/FunnelHistogramChart/FunnelHistogramChart.tsx b/products/product_analytics/frontend/insights/funnels/FunnelHistogramChart/FunnelHistogramChart.tsx
index 553529cdfa9e..72d173e22594 100644
--- a/products/product_analytics/frontend/insights/funnels/FunnelHistogramChart/FunnelHistogramChart.tsx
+++ b/products/product_analytics/frontend/insights/funnels/FunnelHistogramChart/FunnelHistogramChart.tsx
@@ -16,7 +16,7 @@ import { buildFunnelHistogramData } from './funnelHistogramTransforms'
const CHART_CONFIG: BarChartConfig = {
showGrid: true,
- bars: { cornerRadius: 4 },
+ barCornerRadius: 4,
yTickFormatter: (value) => humanFriendlyNumber(value),
// Value labels already show bucket counts; tooltip would just duplicate them.
tooltip: { enabled: false },
diff --git a/products/product_analytics/frontend/insights/funnels/shared/funnelStepsBarShared.ts b/products/product_analytics/frontend/insights/funnels/shared/funnelStepsBarShared.ts
index c202fcca2792..e56f14db379a 100644
--- a/products/product_analytics/frontend/insights/funnels/shared/funnelStepsBarShared.ts
+++ b/products/product_analytics/frontend/insights/funnels/shared/funnelStepsBarShared.ts
@@ -37,8 +37,8 @@ export function buildFunnelStepsBarConfig(options: FunnelStepsBarConfigOptions =
margins: options.margins,
yTickFormatter: (value) => `${Math.round(value)}%`,
tooltip: { placement: options.tooltipPlacement ?? 'top' },
+ barCornerRadius: 10,
bars: {
- cornerRadius: 10,
track: true,
shadow: { color: 'rgba(0,0,0,0.15)', blur: 6, offsetY: -2 },
bandPadding: FUNNEL_STEPS_BAND_PADDING,
diff --git a/products/product_analytics/frontend/insights/trends/TrendsBarValueChart/trendsBarValueChartTransforms.ts b/products/product_analytics/frontend/insights/trends/TrendsBarValueChart/trendsBarValueChartTransforms.ts
index 40cf812216f1..e1157f75d5c8 100644
--- a/products/product_analytics/frontend/insights/trends/TrendsBarValueChart/trendsBarValueChartTransforms.ts
+++ b/products/product_analytics/frontend/insights/trends/TrendsBarValueChart/trendsBarValueChartTransforms.ts
@@ -28,6 +28,7 @@ export function buildTrendsBarValueConfig(): BarChartConfig {
return {
axisOrientation: 'horizontal',
showGrid: true,
- bars: { cornerRadius: 4, fitToHeight: true },
+ barCornerRadius: 4,
+ bars: { fitToHeight: true },
}
}