-
Notifications
You must be signed in to change notification settings - Fork 594
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
Unable to filter out null objects if referenced by encoding #3441
Comments
Should be addressed as part of #3369 |
@LucidObscurity to work around, use compiled Vega panel at the bottom, copy/paste the Vega code into the editor, and move your filtering transform to the top of the list. |
Or add a calculate transform and flatten your data. |
@domoritz i think the input parsing happens before all of the transforms... Do you have an example? |
Vega-Lite will not generate a parse expression if you use a calculate. |
This works fine if you have an empty object. I don't know whether it is worth adding a lot of special code to support this case. It's pretty tricky to get right with selections and so on. {
"$schema": "https://vega.github.io/schema/vega-lite/v2.json",
"description": "Unable to truly filter data",
"data": {
"values":[
{
"date": "2000-01-01",
"options": {
}
},
{
"date": "2000-02-01",
"options": {
"price": 16
}
},
{
"date": "2000-03-01",
"options": {
"price": 17
}
}
]
},
"transform": [{"filter": "datum.options != null"}],
"mark": "line",
"encoding": {
"x": {"field": "date", "type": "temporal", "axis": {"format": "%Y"}},
"y": {"field": "options.price", "type": "quantitative"}
}
} |
However, maybe it's enough to get it working in format parse so that you can flatten your data afterwards. |
Thanks for the follow up. I switched to the full Vega schema and the issue was resolved. I also resolved the reason why there were nulls in the first place, by building an API in between Kibana and Elasticsearch to generate my own statistics and add them to the JSON, but that issue exists in another repo. ;) Thanks again, hopefully your follow up will help others. |
I have a fix in #3676 |
Nice. I do love the simplicity of Vega-Lite for most scenarios. |
* master: docs: fix "example gallery" link in layering docs Update versions Bump to 2.4.2 Allow making line uses original order in the data Upgrade deps Never automatically set scale `zero` to true when custom domain is provided Add oz to list of libs in docs (#3690) Update and simplify CO2 example Rebuild examples Add example with missing subobject. Add more tests to formatparse. Always access flattened fields after transforms. leave -> leaf Only add parse for non-nested fields. Always flatten nested fields. Restructure Gallery (#3679) Fix typo Update details about value vs mark properties Remove mocha scripts from CONTRIBUTING.md and add test:inspect script (#3674) Resolve conflict between scale.domain and bin.extent (#3675) Add datum to access path. Fixes #3441 Flatten nested fields. Fixes #3369 # Conflicts: # _data/examples.json
This will throw "ERROR TypeError: Cannot read property 'price' of undefined" in the console.
I'm not sure why "options.price" would ever try to be evaluated for the record which was supposed to be filtered out.
The text was updated successfully, but these errors were encountered: