|
1 | 1 | import {array, hasOwnProperty, isBoolean} from 'vega-util'; |
2 | 2 | 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'; |
4 | 4 | import { |
5 | 5 | channelDefType, |
6 | 6 | FieldName, |
@@ -178,11 +178,12 @@ export function stack(m: Mark | MarkDef, encoding: Encoding<string>): StackPrope |
178 | 178 | const dimensionField = isFieldDef(dimensionDef) ? vgField(dimensionDef, {}) : undefined; |
179 | 179 | const hasSameDimensionAndStackedField = dimensionField && dimensionField === stackedField; |
180 | 180 |
|
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); |
184 | 184 |
|
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) { |
186 | 187 | // avoid grouping by the stacked field |
187 | 188 | groupbyChannels.push(dimensionChannel); |
188 | 189 | groupbyFields.add(dimensionField); |
|
0 commit comments