reference data by url as signal in compiled vega
See original GitHub issueAs was concluded in this issue: https://github.com/vega/vega/issues/2597.
In a VL spec where the data is referenced by values
such as:
"data": {
"name": "SOURCE",
"values": {
"nested": [
{"key": "alpha", "foo": [1, 2], "bar": ["A", "B"]},
{"key": "beta", "foo": [3, 4, 5], "bar": ["C", "D"]}
]
},
"format": {"property": "nested"}
}
Is compiled into Vega as such (stripped):
{
"data": [
{
"name": "SOURCE",
"values": {
"nested": [
{"key": "alpha", "foo": [1, 2], "bar": ["A", "B"]},
{"key": "beta", "foo": [3, 4, 5], "bar": ["C", "D"]}
]
},
"format": {"property": "nested"}
},
{
"name": "data_0",
"source": "SOURCE",
"transform": [
{"type": "flatten", "fields": ["foo", "bar"], "as": ["foo", "bar"]}
]
}
]
}
In a VL spec where the same data is referenced by url
such as:
"data": {
"name": "SOURCE",
"url": "https://tsws.hkvservices.nl/mangrove.ws/data.ashx?function=dataportal.db.getdata¶meters={database:%27vega%27,key:%27nested_data%27}&contentType=application/json",
"format": {"property": "nested"}
}
The Vega is compiled as such (stripped):
{
"data": [
{
"name": "SOURCE",
"url": "https://tsws.hkvservices.nl/mangrove.ws/data.ashx?function=dataportal.db.getdata¶meters={database:%27vega%27,key:%27nested_data%27}&contentType=application/json",
"format": {"property": "nested", "type": "json"},
"transform": [
{"type": "flatten", "fields": ["foo", "bar"], "as": ["foo", "bar"]}
]
}
]
}
In the latter the transform
is applied in the same data source. This misalignment leads to confusing behaviour when removing datasets from the chart, as was discussed in above mentioned issue.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:7 (7 by maintainers)
Top Results From Across the Web
View API | Vega
View API Reference. View Construction; View Configuration; Dataflow and Rendering; Signals; Event Handling; Image Export; Data and Scales ...
Read more >Easing into Vega from Vega-Lite / IAT355 - Observable
In most cases, one simply needs to reference a named data set defined in the top-level data property. If no from property is...
Read more >Get clicked mark data using react-vega and vega-lite
Switch to vega by compiling my vega-lite spec into vega spec and then adding the signals block worked.
Read more >Vega | Kibana Guide [master] - Elastic
Vega and Vega-Lite panels can display one or more data sources, including Elasticsearch, Elastic Map Service, URL, or static data, and support Kibana ......
Read more >vegawidget: 'Htmlwidget' for 'Vega' and 'Vega-Lite'
URL https://vegawidget.github.io/vegawidget/ ... signal-handler and data-handler arguments: name, value. • event-handler arguments: event, ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
That super useful context! Let’s try to create signals for data URLs then. I bumped the priority up.
For companies that work with multiple people with different skills-set, such as:
a
b
c
combines all together within an app or web application.Data is improved all the time and Vega(-Lite) specifications mature over time as well. Being able to reference data by URL dynamically is a real pain reliever.
For that reason the applications we develop are roughly 75% referenced by URL (through signal) and 25% referenced by values.
It’s not that we don’t reference by values, but adopting the URL-signal route comes naturally as it is:
c
(an improved json-spec can be updated by merely a copy+paste in the front-end) andb
can develop/improve/debug instantaneously in Vega-editor.Especially with a growing Altair/Vega-Lite community it would be great that these people can directly integrate their visuals within bigger frameworks as is possible with Vega specifications.