我在使用rule
vega 中的标记创建跨越绘图的整个宽度或高度的线条时遇到问题。
的文档rule
有点稀疏。我将下面的示例基于此 google groups post。
{
"width": 250,
"height": 250,
"padding": "auto",
"scales": [
{"name": "xscale", "type": "linear", "range": "width", "domain": [0, 10]},
{"name": "yscale", "type": "linear", "range": "height", "domain": [0, 10]}
],
"axes": [
{"type": "x", "scale": "xscale"},
{"type": "y", "scale": "yscale"}
],
"marks": [
{
"type": "rule",
"properties": {
"enter": {
"x": {"scale": "xscale", "value": 0},
"x2": {"scale": "xscale", "group": "width"},
"y": {"scale": "yscale", "value": 5.5},
"stroke": {"value": "green"}
}
}
}
]
}
看起来很直截了当,但我在vega 编辑器中得到了一个空的情节