从这个concrete example开始,这里有2个图在其水平轴上链接而在其垂直轴上自由,有没有办法将鼠标悬停在特定轴上?
实际设置的缩放比例在两个轴上都是相同的。
答案 0 :(得分:0)
如果要在每个面板中独立滚动,则需要做两件事:
resolve.scale.x
和resolve.scale.y
设置为"independent"
,这样就不会链接比例尺。例如(vega editor):
{
"$schema": "https://vega.github.io/schema/vega-lite/v4.json",
"data": {"url": "data/stocks.csv"},
"vconcat": [
{
"transform": [{"filter": "datum.symbol==='IBM'"}],
"mark": "line",
"encoding": {
"x": {"field": "date", "type": "temporal"},
"y": {"field": "price", "type": "quantitative"}
},
"selection": {"scroll_1": {"type": "interval", "bind": "scales"}}
},
{
"transform": [{"filter": "datum.symbol==='GOOG'"}],
"mark": "line",
"encoding": {
"x": {"field": "date", "type": "temporal"},
"y": {"field": "price", "type": "quantitative"}
},
"selection": {"scroll_2": {"type": "interval", "bind": "scales"}}
}
],
"resolve": {"scale": {"x": "independent", "y": "independent"}}
}