如何使用垂直或水平运算符连接Vega中的多视图?

时间:2017-08-12 06:29:27

标签: javascript vega vega-lite

我想使用垂直或水平运算符在Vega中连接多个视图? 我试图将一个规格放入" vconcat"数组,但是可视化并没有显示。我要为多视图做什么。

我浏览了以下链接 https://vega.github.io/vega-lite/docs/concat.html

任何人都可以提供示例示例吗? 感谢

1 个答案:

答案 0 :(得分:1)

https://vega.github.io/editor/#/examples/vega-lite/overview_detail使用concat。

enter image description here

{
"$schema": "https://vega.github.io/schema/vega-lite/v2.json",
"data": {"url": "data/sp500.csv"},
"vconcat": [{
    "width": 480,
    "mark": "area",
    "encoding": {
    "x": {
        "field": "date",
        "type": "temporal",
        "scale": {"domain": {"selection": "brush"}},
        "axis": {"title": "", "labelAngle": 0}
    },
    "y": {"field": "price","type": "quantitative"}
    }
}, {
    "width": 480,
    "height": 60,
    "mark": "area",
    "selection": {
    "brush": {"type": "interval", "encodings": ["x"]}
    },
    "encoding": {
    "x": {
        "field": "date",
        "type": "temporal",
        "axis": {"format": "%Y", "labelAngle": 0}
    },
    "y": {
        "field": "price",
        "type": "quantitative",
        "axis": {"tickCount": 3, "grid": false}
    }
    }
}]
}