Skip to content

Commit eb65df0

Browse files
TheRillJonclaude
andcommitted
fix: combo chart time chip placement and bar chart comparison passthrough
- Combo charts now place x-axis fields in rows initially, matching the standard chart behavior: time chips stay in rows when no dimensions are present, and move to columns when dimension chips exist in rows. - Bar chart types (bar_chart, stacked_bar, stacked_bar_normalized) no longer force showTimeComparison to false, allowing the global comparison time range to pass through to the explore URL. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 1e74e19 commit eb65df0

2 files changed

Lines changed: 21 additions & 3 deletions

File tree

web-common/src/features/canvas/components/charts/BaseChart.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,10 +129,17 @@ export abstract class BaseChart<
129129
const timeGrain = get(this.timeAndFilterStore)?.timeGrain;
130130
const tddLink = getLinkStateForTimeDimensionDetail(spec, this.type);
131131

132+
const comparisonChartTypes = [
133+
"bar_chart",
134+
"stacked_bar",
135+
"stacked_bar_normalized",
136+
];
137+
const passComparison = comparisonChartTypes.includes(this.type);
138+
132139
return {
133140
whereFilter: dimensionFilters,
134141
dimensionThresholdFilters,
135-
showTimeComparison: false,
142+
...(passComparison ? {} : { showTimeComparison: false }),
136143
activePage: tddLink.canLink
137144
? DashboardState_ActivePage.TIME_DIMENSIONAL_DETAIL
138145
: DashboardState_ActivePage.PIVOT,

web-common/src/features/canvas/components/charts/variants/ComboChart.ts

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -285,13 +285,13 @@ export class ComboChartComponent extends BaseChart<ComboCanvasChartSpec> {
285285

286286
if (spec.x?.field) {
287287
if (spec.x.type === "temporal") {
288-
columns.push({
288+
rows.push({
289289
id: timeGrain || V1TimeGrain.TIME_GRAIN_DAY,
290290
title: spec.x.field,
291291
type: PivotChipType.Time,
292292
});
293293
} else {
294-
columns.push({
294+
rows.push({
295295
id: spec.x.field,
296296
title: spec.x.field,
297297
type: PivotChipType.Dimension,
@@ -315,6 +315,17 @@ export class ComboChartComponent extends BaseChart<ComboCanvasChartSpec> {
315315
});
316316
}
317317

318+
const hasDimensionRows = rows.some(
319+
(r) => r.type === PivotChipType.Dimension,
320+
);
321+
if (hasDimensionRows) {
322+
const timeChips = rows.filter((r) => r.type === PivotChipType.Time);
323+
const nonTimeRows = rows.filter((r) => r.type !== PivotChipType.Time);
324+
columns.push(...timeChips);
325+
rows.length = 0;
326+
rows.push(...nonTimeRows);
327+
}
328+
318329
const pivot: PivotState = {
319330
columns,
320331
rows,

0 commit comments

Comments
 (0)