Skip to content

Commit 369fa1e

Browse files
committed
fix: settle stacked arc marks with a check for field type
1 parent 6350cdb commit 369fa1e

File tree

1 file changed

+3
-10
lines changed

1 file changed

+3
-10
lines changed

src/stack.ts

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -178,19 +178,12 @@ export function stack(m: Mark | MarkDef, encoding: Encoding<string>): StackPrope
178178
const dimensionField = isFieldDef(dimensionDef) ? vgField(dimensionDef, {}) : undefined;
179179
const hasSameDimensionAndStackedField = dimensionField && dimensionField === stackedField;
180180

181-
// This change breaks cartesian tests, just pushing to start the discussion. When dev'ing locally, try removing this condition.
182-
// TBD: we should only enter this branch if there's also a "color" and maybe a group channel?
181+
// For polar coordinates, do not set a groupBy when working with quantitative fields.
183182
const isPolar = isPolarPositionChannel(fieldChannel) || isPolarPositionChannel(dimensionChannel);
183+
const shouldAddPolarGroupBy = !isUnbinnedQuantitative(dimensionDef);
184184

185-
// TODO: Figure out why groupBy is only sometimes necessary?
186-
// Unclear why the test case and the bug report differ in whether a groupBy should be supplied to vega or not
187-
// const shouldAddPolarGroupBy = dimensionField === 'dir' || (fieldChannel === dimensionChannel);
188-
const shouldAddPolarGroupBy = (fieldChannel === dimensionChannel);
189-
190-
// if (!hasSameDimensionAndStackedField) {
191-
if (!hasSameDimensionAndStackedField && (isPolar ? (shouldAddPolarGroupBy) : true)) {
185+
if (isPolar ? shouldAddPolarGroupBy : !hasSameDimensionAndStackedField) {
192186
// avoid grouping by the stacked field
193-
// TKTK: find out why
194187
groupbyChannels.push(dimensionChannel);
195188
groupbyFields.add(dimensionField);
196189
}

0 commit comments

Comments
 (0)