-
Notifications
You must be signed in to change notification settings - Fork 621
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
Layer #1241
Conversation
My test spec {
"data": {
"values": [
{"a": "A","b": "B","c": 28,"d": "a"}, {"a": "B","b": "C","c": 55,"d": "a"},
{"a": "C","b": "D","c": 43,"d": "a"}, {"a": "D","b": "E","c": 91,"d": "a"},
{"a": "E","b": "F","c": 81,"d": "a"}, {"a": "F","b": "G","c": 53,"d": "b"},
{"a": "G","b": "H","c": 19,"d": "b"}, {"a": "H","b": "I","c": 87,"d": "c"},
{"a": "I","b": "A","c": 52,"d": "c"}
]
},
"layers": [
{
"mark": "bar",
"encoding": {
"x": {"field": "a","type": "ordinal"},
"y": {"field": "c","type": "quantitative"},
"color": {"field": "d", "type": "nominal"}
}
}, {
"mark": "line",
"encoding": {
"x": {"field": "b","type": "ordinal"},
"y": {"field": "c","type": "quantitative"},
"color": {"value": "purple"}
}
}, {
"mark": "rule",
"encoding": {
"y": {"field": "c", "type": "quantitative", "aggregate": "mean"},
"color": {"field": "d", "type": "nominal"},
"size": {"field": "c", "type": "quantitative", "aggregate": "max"}
}
}
]
} |
Fixing sizing, config order
* Function to rename the dataset name using the name map. Used in the assemble step. | ||
*/ | ||
public dataRename(name: string): string { | ||
return this._dataNameMap.get(name); |
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 is get
, not rename
. I also have the renameData
method right above on line 226.
@@ -287,13 +298,11 @@ export namespace formatParse { | |||
// if there is no parse needed | |||
model.forEach(function(fieldDef: FieldDef) { | |||
if (fieldDef.type === TEMPORAL) { | |||
parseComponent = parseComponent || {}; |
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.
Have you thoroughly tested that removing this doesn't cause problem?
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 you look above, you see that there is a let parseComponent: Dict<string> = {};
so this is fine.
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.
Yep. But before this PR, a part of source
assemble code assumes that formatParse
component either contains something or is null. I'm not saying that this is worse, but need to make sure that this doesn't break those parts.
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.
I fixed that part
…ecause now the value can be either `true` or `false`. This way, we can distinguish between when we only care about the key or when we care about the value too. (Although the underlying type of `StringSet` is also `Dict<Boolean>`) cc: @domoritz
@@ -479,12 +506,13 @@ export namespace nullFilter { | |||
} | |||
|
|||
export function parseLayer(model: LayerModel) { | |||
// note that we run this before source.parseLayer | |||
let nullFilterComponent = parse(model); |
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.
We might not even need to call parse
here because layers doesn't have its own field. This is always an empty object.
let nullFilterComponent = parse(model); | ||
|
||
model.children().forEach((child) => { | ||
const childDataComponent = child.component.data; | ||
if (!childDataComponent.source && childDataComponent.nullFilter) { | ||
extend(nullFilterComponent || {}, childDataComponent.nullFilter); | ||
if (model.compatibleSource(child) && !differ(childDataComponent.nullFilter, nullFilterComponent)) { |
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 two children of the layer have the same nullFilterComponent
they still don't get merge here.
Because each of the child won't be equal to the layer's initial nullFilterComponent
which is simply {}
.
note to self: timeUnit should not be executed before source in data.ts |
mergeMeasures(summaries[key].measures, summary.measures); | ||
} else { | ||
// give the summary a new name | ||
summary.name = model.dataName(SUMMARY) + '_' + keys(summaries).length; |
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.
keys(summaries).length
Should we name it by the dimensions included instead of a summary counter?
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.
Good point. I changed the way summaries are generated and now it would make more sense to use the fields (+the source name?). But I don't want to worry about all the edge cases (explicit values, ...)
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.
Ups, our key may be wrong in that case...
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.
Not sure what "explicit values" mean in this case?
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.
Ups, our key may be wrong in that case...
?? Can you elaborate?
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.
summary_bin_distance_start_bin_distance_mid_bin_distance_end_bin_distance_range
nope nope nope
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.
Ok let's use number for now although a semantically meaningful mean could just be summary_bin_distance
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.
maybe. I don't quite know what happens if we reference different datasets. I think we should forbid different datasets somehow!
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.
I think forbidding simplify things for now, but not sure if we should forbid this in long run.
export function parseLayer(model: LayerModel) { | ||
// note that we run this before source.parseLayer | ||
|
||
// FIXME: null filters are not properly propagated right now |
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.
It's not only "not properly propagated". The merge logic below is still incorrect. I'll add this to #1254.
Need to get these working: