Skip to content

Commit

Permalink
Change the default for "resolve" to "shared"
Browse files Browse the repository at this point in the history
  • Loading branch information
joelostblom committed Dec 28, 2023
1 parent 0fe94c1 commit e3f4505
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion build/vega-lite-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -8144,7 +8144,7 @@
"type": "number"
},
"resolve": {
"description": "Indicates how parameters for multiple densities should be resolved. If `\"independent\"`, each density may have its own domain extent and dynamic number of curve sample steps. If `\"shared\"`, the KDE transform will ensure that all densities are defined over a shared domain and curve steps, enabling stacking.\n\n__Default value:__ `\"independent\"`",
"description": "Indicates how parameters for multiple densities should be resolved. If \"independent\", each density may have its own domain extent and dynamic number of curve sample steps. If \"shared\", the KDE transform will ensure that all densities are defined over a shared domain and curve steps, enabling stacking.\n\n__Default value:__ `\"shared\"`",
"enum": [
"independent",
"shared"
Expand Down
2 changes: 1 addition & 1 deletion examples/compiled/area_density.vg.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"field": "IMDB Rating",
"bandwidth": 0.3,
"as": ["value", "density"],
"resolve": "independent"
"resolve": "shared"
},
{
"type": "impute",
Expand Down
2 changes: 1 addition & 1 deletion examples/compiled/area_density_facet.vg.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"groupby": ["Species"],
"extent": [2500, 6500],
"as": ["value", "density"],
"resolve": "independent"
"resolve": "shared"
},
{
"type": "impute",
Expand Down
2 changes: 1 addition & 1 deletion examples/compiled/area_density_stacked.vg.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"groupby": ["Species"],
"extent": [2500, 6500],
"as": ["value", "density"],
"resolve": "independent"
"resolve": "shared"
},
{
"type": "impute",
Expand Down
2 changes: 1 addition & 1 deletion examples/compiled/area_density_stacked_fold.vg.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"counts": true,
"steps": 200,
"as": ["value", "density"],
"resolve": "independent"
"resolve": "shared"
},
{
"type": "impute",
Expand Down
2 changes: 1 addition & 1 deletion src/compile/data/density.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export class DensityTransformNode extends DataFlowNode {
this.transform = duplicate(transform); // duplicate to prevent side effects
const specifiedAs = this.transform.as ?? [undefined, undefined];
this.transform.as = [specifiedAs[0] ?? 'value', specifiedAs[1] ?? 'density'];
const resolve = this.transform.resolve ?? 'independent';
const resolve = this.transform.resolve ?? 'shared';
this.transform.resolve = resolve;
}

Expand Down
2 changes: 1 addition & 1 deletion src/transform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,7 @@ export interface DensityTransform {
* If `"independent"`, each density may have its own domain extent and dynamic number of curve sample steps.
* If `"shared"`, the KDE transform will ensure that all densities are defined over a shared domain and curve steps, enabling stacking.
*
* __Default value:__ `"independent"`
* __Default value:__ `"shared"`
*/
resolve?: 'independent' | 'shared';
}
Expand Down
8 changes: 4 additions & 4 deletions test/compile/data/density.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ describe('compile/data/fold', () => {
extent: [0, 10],
minsteps: 25,
maxsteps: 200,
resolve: 'independent',
resolve: 'shared',
as: ['x', 'y']
});
});
Expand All @@ -41,7 +41,7 @@ describe('compile/data/fold', () => {
expect(density.assemble()).toEqual({
type: 'kde',
field: 'v',
resolve: 'independent',
resolve: 'shared',
as: ['value', 'density']
});
});
Expand All @@ -55,7 +55,7 @@ describe('compile/data/fold', () => {
expect(density.assemble()).toEqual({
type: 'kde',
field: 'v',
resolve: 'independent',
resolve: 'shared',
as: ['A', 'density']
});
});
Expand Down Expand Up @@ -122,7 +122,7 @@ describe('compile/data/fold', () => {
as: ['A', 'B']
};
const density = new DensityTransformNode(null, transform);
expect(density.hash()).toBe('DensityTransform {"as":["A","B"],"density":"v","resolve":"independent"}');
expect(density.hash()).toBe('DensityTransform {"as":["A","B"],"density":"v","resolve":"shared"}');
});
});

Expand Down

0 comments on commit e3f4505

Please sign in to comment.