Skip to content

Commit

Permalink
test: check if allowing groupBy on arc marks is sometimes desirable t…
Browse files Browse the repository at this point in the history
…o avoid double stacking on radius
  • Loading branch information
hydrosquall committed Jan 25, 2025
1 parent c3b3b99 commit 71cf1df
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/stack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,12 @@ export function stack(m: Mark | MarkDef, encoding: Encoding<string>): StackPrope
// TBD: we should only enter this branch if there's also a "color" and maybe a group channel?
const isPolar = isPolarPositionChannel(fieldChannel) || isPolarPositionChannel(dimensionChannel);

if (!hasSameDimensionAndStackedField && (isPolar ? dimensionChannel === fieldChannel : true)) {
// TODO: Figure out why groupBy is only sometimes necessary?
// Unclear why the test case and the bug report differ in whether a groupBy should be supplied to vega or not
const shouldAddPolarGroupBy = dimensionField === 'dir' || (fieldChannel === dimensionChannel);

Check warning on line 187 in src/stack.ts

View workflow job for this annotation

GitHub Actions / Runtime, Linting, and Coverage

Replace `(fieldChannel·===·dimensionChannel)` with `fieldChannel·===·dimensionChannel`

// if (!hasSameDimensionAndStackedField) {
if (!hasSameDimensionAndStackedField && (isPolar ? (shouldAddPolarGroupBy) : true)) {

Check warning on line 190 in src/stack.ts

View workflow job for this annotation

GitHub Actions / Runtime, Linting, and Coverage

Replace `(shouldAddPolarGroupBy)` with `shouldAddPolarGroupBy`
// avoid grouping by the stacked field
// TKTK: find out why
groupbyChannels.push(dimensionChannel);
Expand Down Expand Up @@ -243,6 +248,7 @@ export function stack(m: Mark | MarkDef, encoding: Encoding<string>): StackPrope
if (!offset || !isStackOffset(offset)) {
return null;
}
// console.log('offset', offset);

if (isAggregate(encoding) && stackBy.length === 0) {
return null;
Expand Down

0 comments on commit 71cf1df

Please sign in to comment.