vega-lite: 'Duplicate signal name' error for shared param across views
When using repeat to layer multiple fields, one is unable to use hover to implement any interaction. An error is shown Error: Duplicate signal name: "sel1_tuple"
See https://observablehq.com/@cjnygard/vega-lite-bug for implementation (you can play with the flags in the plot4() function to true different combinations of hover, repeat, and facet. It’s clearly related to the repeat, as shown in the below generated JSON (generated from the page above).
{
"facet": {
"column": {
"field": "name"
}
},
"spec": {
"repeat": {
"layer": [
// "y1", // Uncomment this to trigger bug
"y2"
]
},
"spec": {
"layer": [
{
"mark": {
"type": "line",
"interpolate": "monotone"
},
"encoding": {
"x": {
"field": "x",
"type": "quantitative"
},
"y": {
"field": {
"repeat": "layer"
},
"type": "quantitative"
},
"color": {
"datum": {
"repeat": "layer"
},
"legend": {
"title": "Legend"
}
}
}
},
{
"mark": {
"type": "circle"
},
"encoding": {
"x": {
"field": "x",
"type": "quantitative"
},
"y": {
"field": {
"repeat": "layer"
},
"type": "quantitative"
},
"color": {
"datum": {
"repeat": "layer"
},
"legend": {
"title": "Legend"
}
},
"opacity": {
"condition": {
"test": {
"selection": "sel1"
},
"value": 1
},
"value": 0
}
},
"selection": {
"sel1": {
"type": "single",
"encodings": [
"y"
],
"on": "mouseover",
"nearest": true,
"empty": "none"
}
}
}
],
"width": 350,
"height": 200
}
},
"data": {
"values": [
{
"name": "foo",
"x": 1,
"y1": 1,
"y2": 21
},
{
"name": "foo",
"x": 2,
"y1": 2,
"y2": 22
},
{
"name": "foo",
"x": 3,
"y1": 3,
"y2": 23
},
{
"name": "bar",
"x": 4,
"y1": 10,
"y2": 31
},
{
"name": "bar",
"x": 5,
"y1": 11,
"y2": 32
},
{
"name": "bar",
"x": 6,
"y1": 12,
"y2": 33
}
]
}
}
About this issue
- Original URL
- State: open
- Created 4 years ago
- Comments: 15 (7 by maintainers)
The reply from @kanitw with top-level defined params and a layered chart can be resolved using
viewswithinparamsin combination with anamedefinition on a single chart object within the layer: Open the Chart in the Vega EditorStatus of a chart with a:
repeatoperator ¶mswithin thespec: Open the Chart in the Vega Editorrepeatoperator ¶mstop-level: Open the Chart in the Vega Editorrepeatoperator ¶mstop-level using aviewsattribute andname: Open the Chart in the Vega Editorrepeatoperator on alayer¶mson the first object withinlayer: Open the Chart in the Vega Editor (slow!)repeatoperator on alayer¶mstop-level: Open the Chart in the Vega Editorrepeatoperator on alayer¶mstop-level using aviewsattribute &nameon the first object withinlayer: Open the Chart in the Vega Editor (slow!)The following issue is also related to the
repeatoperator on alayerwithparamstop-level using aviewsattribute &nameon the first object within layer: https://github.com/vega/vega-lite/issues/8348, but there is still another issue with brush not resolving properly.I’m able to replicate this when we add params to top-level for multi-view charts