From e3f4505d06d0f8a6c7e8d1d0900e85c1fdfdb8d0 Mon Sep 17 00:00:00 2001 From: Joel Ostblom Date: Wed, 27 Dec 2023 16:14:57 -0800 Subject: [PATCH] Change the default for "resolve" to "shared" --- build/vega-lite-schema.json | 2 +- examples/compiled/area_density.vg.json | 2 +- examples/compiled/area_density_facet.vg.json | 2 +- examples/compiled/area_density_stacked.vg.json | 2 +- examples/compiled/area_density_stacked_fold.vg.json | 2 +- src/compile/data/density.ts | 2 +- src/transform.ts | 2 +- test/compile/data/density.test.ts | 8 ++++---- 8 files changed, 11 insertions(+), 11 deletions(-) diff --git a/build/vega-lite-schema.json b/build/vega-lite-schema.json index 7cda51b299..e7d8864248 100644 --- a/build/vega-lite-schema.json +++ b/build/vega-lite-schema.json @@ -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" diff --git a/examples/compiled/area_density.vg.json b/examples/compiled/area_density.vg.json index 1584b388c5..a34a2fc36d 100644 --- a/examples/compiled/area_density.vg.json +++ b/examples/compiled/area_density.vg.json @@ -16,7 +16,7 @@ "field": "IMDB Rating", "bandwidth": 0.3, "as": ["value", "density"], - "resolve": "independent" + "resolve": "shared" }, { "type": "impute", diff --git a/examples/compiled/area_density_facet.vg.json b/examples/compiled/area_density_facet.vg.json index 73b2f15bb6..dbc03d7ce6 100644 --- a/examples/compiled/area_density_facet.vg.json +++ b/examples/compiled/area_density_facet.vg.json @@ -15,7 +15,7 @@ "groupby": ["Species"], "extent": [2500, 6500], "as": ["value", "density"], - "resolve": "independent" + "resolve": "shared" }, { "type": "impute", diff --git a/examples/compiled/area_density_stacked.vg.json b/examples/compiled/area_density_stacked.vg.json index acc44e021e..b24ab6566d 100644 --- a/examples/compiled/area_density_stacked.vg.json +++ b/examples/compiled/area_density_stacked.vg.json @@ -18,7 +18,7 @@ "groupby": ["Species"], "extent": [2500, 6500], "as": ["value", "density"], - "resolve": "independent" + "resolve": "shared" }, { "type": "impute", diff --git a/examples/compiled/area_density_stacked_fold.vg.json b/examples/compiled/area_density_stacked_fold.vg.json index 50fec1cd62..40f47d7bf4 100644 --- a/examples/compiled/area_density_stacked_fold.vg.json +++ b/examples/compiled/area_density_stacked_fold.vg.json @@ -25,7 +25,7 @@ "counts": true, "steps": 200, "as": ["value", "density"], - "resolve": "independent" + "resolve": "shared" }, { "type": "impute", diff --git a/src/compile/data/density.ts b/src/compile/data/density.ts index 03fed21b6a..adbeb22682 100644 --- a/src/compile/data/density.ts +++ b/src/compile/data/density.ts @@ -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; } diff --git a/src/transform.ts b/src/transform.ts index 0e8093ebbf..5019088f76 100644 --- a/src/transform.ts +++ b/src/transform.ts @@ -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'; } diff --git a/test/compile/data/density.test.ts b/test/compile/data/density.test.ts index 0f408e4fed..83d25b8fdd 100644 --- a/test/compile/data/density.test.ts +++ b/test/compile/data/density.test.ts @@ -27,7 +27,7 @@ describe('compile/data/fold', () => { extent: [0, 10], minsteps: 25, maxsteps: 200, - resolve: 'independent', + resolve: 'shared', as: ['x', 'y'] }); }); @@ -41,7 +41,7 @@ describe('compile/data/fold', () => { expect(density.assemble()).toEqual({ type: 'kde', field: 'v', - resolve: 'independent', + resolve: 'shared', as: ['value', 'density'] }); }); @@ -55,7 +55,7 @@ describe('compile/data/fold', () => { expect(density.assemble()).toEqual({ type: 'kde', field: 'v', - resolve: 'independent', + resolve: 'shared', as: ['A', 'density'] }); }); @@ -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"}'); }); });