Skip to content

Commit

Permalink
test(stack): limit radius of change to polar coordinate graphs
Browse files Browse the repository at this point in the history
  • Loading branch information
hydrosquall committed Jan 20, 2025
1 parent 511f85d commit e41db6c
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/stack.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {array, hasOwnProperty, isBoolean} from 'vega-util';
import {Aggregate, SUM_OPS} from './aggregate';
import {getSecondaryRangeChannel, NonPositionChannel, NONPOSITION_CHANNELS} from './channel';
import {getSecondaryRangeChannel, NonPositionChannel, NONPOSITION_CHANNELS, isPolarPositionChannel} from './channel';
import {
channelDefType,
FieldName,
Expand Down Expand Up @@ -85,7 +85,7 @@ function potentialStackedChannel(
x: 'x' | 'theta',
{orient, type: mark}: MarkDef
): 'x' | 'y' | 'theta' | 'radius' | undefined {
const y = x === 'x' ? 'y' : 'radius';
const y = x === 'x' ? 'y' : 'radius'; // TKTK: what if we stack along theta?

const isCartesianBarOrArea = x === 'x' && ['bar', 'area'].includes(mark);

Expand Down Expand Up @@ -177,12 +177,13 @@ export function stack(m: Mark | MarkDef, encoding: Encoding<string>): StackPrope
const dimensionDef = encoding[dimensionChannel];
const dimensionField = isFieldDef(dimensionDef) ? vgField(dimensionDef, {}) : undefined;
const hasSameDimensionAndStackedField = dimensionField && dimensionField === stackedField;
// This change breaks existing cartesian tests, just pushing it up to start the discussion.
const hasSameDimensionAndStackedChannel = dimensionChannel === fieldChannel;

if (!hasSameDimensionAndStackedField && hasSameDimensionAndStackedChannel) {
// This change breaks cartesian tests, just pushing to start the discussion. When dev'ing locally, try removing this condition.
const isPolar = isPolarPositionChannel(fieldChannel) || isPolarPositionChannel(dimensionChannel);

if (!hasSameDimensionAndStackedField && (isPolar ? dimensionChannel === fieldChannel : true)) {
// avoid grouping by the stacked field
// TKTK: find ot why
// TKTK: find out why
groupbyChannels.push(dimensionChannel);
groupbyFields.add(dimensionField); // Iinvestigate meee
}
Expand Down

0 comments on commit e41db6c

Please sign in to comment.