You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
Great project and very useful. Unfortunately, I have hit a road block. I can't seem to get summarize transforms to work. I have experimented with all manner of formats for the specification to make sure it isn't a simple user error (or try to convince myself of that anyway). The final spec (listed below) doesn't throw any errors, but doesn't work either.
I am basically trying to find the earliest time in each feature of a geojson file, then offset the other time fields using the feature's base time (converting to minutes also). Using a fixed value for base_time works to compute all the fields works fine ({"as": "base_time", "calculate": "1483228800000"}), so I am sure the subsequent calculations are encoded correctly. But when I try to use the summarize transform, all my other fields break, including fields that don't refer to base_time. The specification I have is below (leaving out the data, as it is very large).
Thanks in advance for your help.
-Ashley
{
"data": {...},
"transform": [
{
"filter": "datum.time > 0"
},
{
"filter": "datum.eta > 0"
},
{
"filter": "datum.sta > 0"
},
{
"summarize": [
{
"aggregate": "min",
"field": "time",
"as": "base_time"
}
],
"groupby": [
"feature_id"
]
},
{
"as": "time_offset_min",
"calculate": "(datum.time - datum.base_time) / 60000"
},
{
"as": "eta_offset_min",
"calculate": "(datum.eta - datum.base_time) / 60000"
},
{
"as": "sta_offset_min",
"calculate": "(datum.sta - datum.base_time) / 60000"
},
{
"as": "delay_min",
"calculate": "datum.eta_offset_min - datum.sta_offset_min"
}
],
"mark": {
"type": "circle",
"filled": true
},
"width": 300,
"height": 225,
"encoding": {
"color": {
"value": "#202c40"
},
"x": {
"field": "time_offset_min",
"type": "quantitative",
"scale": {
"zero": false,
"type": "linear"
}
},
"y": {
"field": "eta_offset_min",
"type": "quantitative",
"scale": {
"zero": false,
"type": "linear"
}
}
}
}
Probably not useful, but I'm proud of what I'm building, so here is a screenshot of it.
The text was updated successfully, but these errors were encountered:
Thanks for reporting. Summarize transform actually generates a new data table (akin to an aggregate query in SQL).
What you want to do here is augmenting existing data table new a new summary column.
This could be done using the window transform in Vega, but we have not implemented it in Vega-Lite yet. (See #2488.)
As we're still revising the documentation for the 2.0 release, I'll note to make sure we make this clearer in the docs (#2279).
Thanks for your quick response. So, if I am reading it correctly, I can't do what I need directly in VL; I have to add the summary data to my dataset before using it to create the chart. Sorry if that is obvious. I just want to be sure before creating the pre-processing workaround.
Thanks again!
-Ashley
Hi,

Great project and very useful. Unfortunately, I have hit a road block. I can't seem to get summarize transforms to work. I have experimented with all manner of formats for the specification to make sure it isn't a simple user error (or try to convince myself of that anyway). The final spec (listed below) doesn't throw any errors, but doesn't work either.
I am basically trying to find the earliest time in each feature of a geojson file, then offset the other time fields using the feature's base time (converting to minutes also). Using a fixed value for base_time works to compute all the fields works fine ({"as": "base_time", "calculate": "1483228800000"}), so I am sure the subsequent calculations are encoded correctly. But when I try to use the summarize transform, all my other fields break, including fields that don't refer to base_time. The specification I have is below (leaving out the data, as it is very large).
Thanks in advance for your help.
-Ashley
{
"data": {...},
"transform": [
{
"filter": "datum.time > 0"
},
{
"filter": "datum.eta > 0"
},
{
"filter": "datum.sta > 0"
},
{
"summarize": [
{
"aggregate": "min",
"field": "time",
"as": "base_time"
}
],
"groupby": [
"feature_id"
]
},
{
"as": "time_offset_min",
"calculate": "(datum.time - datum.base_time) / 60000"
},
{
"as": "eta_offset_min",
"calculate": "(datum.eta - datum.base_time) / 60000"
},
{
"as": "sta_offset_min",
"calculate": "(datum.sta - datum.base_time) / 60000"
},
{
"as": "delay_min",
"calculate": "datum.eta_offset_min - datum.sta_offset_min"
}
],
"mark": {
"type": "circle",
"filled": true
},
"width": 300,
"height": 225,
"encoding": {
"color": {
"value": "#202c40"
},
"x": {
"field": "time_offset_min",
"type": "quantitative",
"scale": {
"zero": false,
"type": "linear"
}
},
"y": {
"field": "eta_offset_min",
"type": "quantitative",
"scale": {
"zero": false,
"type": "linear"
}
}
}
}
Probably not useful, but I'm proud of what I'm building, so here is a screenshot of it.
The text was updated successfully, but these errors were encountered: