1

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

我通过以下链接 https://vega.github.io/vega-lite/docs/concat.html

任何人帮助给出示例?谢谢

4

1 回答 1

1

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

在此处输入图像描述

{
"$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}
    }
    }
}]
}
于 2017-08-16T18:02:54.043 回答