Skip to content

Commit 8b1c3d4

Browse files
committed
WIP: check if we can remove polar checks
1 parent 2ebd1b1 commit 8b1c3d4

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/stack.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import {array, hasOwnProperty, isBoolean} from 'vega-util';
22
import {Aggregate, SUM_OPS} from './aggregate.js';
3-
import {getSecondaryRangeChannel, NonPositionChannel, NONPOSITION_CHANNELS, isPolarPositionChannel} from './channel.js';
3+
import {getSecondaryRangeChannel, NonPositionChannel, NONPOSITION_CHANNELS} from './channel.js';
44
import {
55
channelDefType,
66
FieldName,
@@ -178,11 +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-
// For polar coordinates, do not set a groupBy when working with quantitative fields.
182-
const isPolar = isPolarPositionChannel(fieldChannel) || isPolarPositionChannel(dimensionChannel);
183-
const shouldAddPolarGroupBy = !isUnbinnedQuantitative(dimensionDef);
181+
// Do not set a groupBy when working with unbinned quantitative fields
182+
// This applies to both polar and cartesian coordinates
183+
const shouldAddGroupBy = !isUnbinnedQuantitative(dimensionDef);
184184

185-
if (isPolar ? shouldAddPolarGroupBy : !hasSameDimensionAndStackedField) {
185+
// If it's binned, we don't need to group by the dimension field, because we will filter out the offset in the end anyway
186+
if (shouldAddGroupBy && !hasSameDimensionAndStackedField) {
186187
// avoid grouping by the stacked field
187188
groupbyChannels.push(dimensionChannel);
188189
groupbyFields.add(dimensionField);

0 commit comments

Comments
 (0)