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(data-viz): give each sql breakdown series its own color (#115995)

Sam Pennington678437477f40
diff --git a/frontend/src/queries/nodes/DataVisualization/Components/seriesBreakdownLogic.test.ts b/frontend/src/queries/nodes/DataVisualization/Components/seriesBreakdownLogic.test.ts
index e22d83e71e70..d9c3856367a3 100644
--- a/frontend/src/queries/nodes/DataVisualization/Components/seriesBreakdownLogic.test.ts
+++ b/frontend/src/queries/nodes/DataVisualization/Components/seriesBreakdownLogic.test.ts
@@ -280,10 +280,19 @@ describe('seriesBreakdownLogic', () => {
builtDataVizLogic.actions.clearAxis()
builtDataVizLogic.actions.updateXSeries('event')
- builtDataVizLogic.actions.addYSeries('total_count')
+ // The y-axis settings form saves a color by default; breakdown series must not inherit it.
+ builtDataVizLogic.actions.addYSeries('total_count', {
+ formatting: { prefix: '', suffix: '' },
+ display: { color: '#1d4aff' },
+ })
logic.actions.addSeriesBreakdown('browser')
+ expect(logic.values.seriesBreakdownData.seriesData.map((series) => series.settings?.display?.color)).toEqual([
+ undefined,
+ undefined,
+ undefined,
+ ])
await expectLogic(logic).toMatchValues({
breakdownColumnValues: ['Safari', 'Firefox', 'Chrome'],
seriesBreakdownData: {
diff --git a/frontend/src/queries/nodes/DataVisualization/Components/seriesBreakdownLogic.ts b/frontend/src/queries/nodes/DataVisualization/Components/seriesBreakdownLogic.ts
index c5f5f46a3a3d..c3502b9664fe 100644
--- a/frontend/src/queries/nodes/DataVisualization/Components/seriesBreakdownLogic.ts
+++ b/frontend/src/queries/nodes/DataVisualization/Components/seriesBreakdownLogic.ts
@@ -375,15 +375,14 @@ export const seriesBreakdownLogic = kea<seriesBreakdownLogicType>([
data: dataset,
// we copy supported settings over from the selected
// y-axis since we don't support setting these on the
- // breakdown series at the moment. The per-breakdown
- // color customization (if any) wins over the inherited
- // y-axis color.
+ // breakdown series at the moment. The y-axis color is not
+ // copied, so each breakdown value gets its own palette color.
settings: getBISeriesSettings(query, {
formatting: selectedYAxis.settings.formatting,
display: {
yAxisPosition: selectedYAxis.settings?.display?.yAxisPosition,
displayType: selectedYAxis.settings?.display?.displayType,
- color: customColor ?? selectedYAxis.settings?.display?.color,
+ color: customColor,
},
}),
}