Skip to content

Commit

Permalink
Add explicit option to control how densities are resolved
Browse files Browse the repository at this point in the history
  • Loading branch information
joelostblom committed Nov 11, 2023
1 parent c229a32 commit 0a9c26f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
4 changes: 1 addition & 3 deletions src/compile/data/density.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,7 @@ export class DensityTransformNode extends DataFlowNode {
field: density,
...rest
};
if (this.transform.groupby) {
result.resolve = 'shared';
}
result.resolve = this.transform.resolve;
return result;
}
}
8 changes: 8 additions & 0 deletions src/transform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -496,6 +496,14 @@ export interface DensityTransform {
* __Default value:__ `["value", "density"]`
*/
as?: [FieldName, FieldName];
/**
* 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.
*
* __Default value:__ `"independent"`
*/
resolve?: 'independent' | 'shared';
}

export function isDensity(t: Transform): t is DensityTransform {
Expand Down

0 comments on commit 0a9c26f

Please sign in to comment.