-
Notifications
You must be signed in to change notification settings - Fork 627
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add explicit option to control how densities are resolved, change how densities are resolved by default #9172
Changes from 16 commits
0a9c26f
160873b
996a4c4
bd567d9
caa87ea
aee5bb8
5dfabea
c820639
28932dd
ef1afcf
65a9e57
0fe94c1
e3f4505
4a99089
050f1b0
af88c77
c09cfe4
73c741f
70f721b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,6 +41,7 @@ describe('compile/data/fold', () => { | |
expect(density.assemble()).toEqual({ | ||
type: 'kde', | ||
field: 'v', | ||
resolve: 'shared', | ||
as: ['value', 'density'] | ||
}); | ||
}); | ||
|
@@ -54,14 +55,16 @@ describe('compile/data/fold', () => { | |
expect(density.assemble()).toEqual({ | ||
type: 'kde', | ||
field: 'v', | ||
resolve: 'shared', | ||
as: ['A', 'density'] | ||
}); | ||
}); | ||
|
||
it('should add resolve shared if we group', () => { | ||
it('should only add resolve "shared" if we set it explicitly', () => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To test this, we would need a case that doesn't set There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Won't |
||
const transform: Transform = { | ||
density: 'v', | ||
groupby: ['a'] | ||
groupby: ['a'], | ||
resolve: 'shared' | ||
}; | ||
const density = new DensityTransformNode(null, transform); | ||
expect(density.assemble()).toEqual({ | ||
|
@@ -119,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"}'); | ||
expect(density.hash()).toBe('DensityTransform {"as":["A","B"],"density":"v","resolve":"shared"}'); | ||
}); | ||
}); | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This used to be
independent
. https://vega.github.io/vega/docs/transforms/kde/Why should this be shared for non-stacked transforms? Maybe a reasonable default is to have it only shared if there is stacking?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I remember correctly from our discussion, we said it would be difficult to set the default value of the transform based on whether the encoding channel is stacked or not. I believe the main reason was that it would be hard to detect which encoding channel the density values are plotted on.
Leaving "shared" as the default would work in most situations, including most of the common ones, and if there are situations where the "independent" is needed, it would be easy to switch. To avoid that densities stack by default, we said we would turn off stacking as part of a
mark_density
, but leave the default stacking behavior for the area mark as it is now to be consistent with other marks.