如何设置存储在数据字段中的线条颜色?在Vega中,我做到了:
marks :[
{
encode: {
enter: {
...
stroke: {field: "color"}
}
}
}
]Vega-Lite中有类似的方式吗?
发布于 2018-08-23 10:17:35
您可以使用带有line标记的color编码。在vega-lite网站上有几个例子;一个相关的例子是Multi Series Line Chart
{
"$schema": "https://vega.github.io/schema/vega-lite/v2.json",
"description": "Stock prices of 5 Tech Companies over Time.",
"data": {"url": "data/stocks.csv"},
"mark": "line",
"encoding": {
"x": {"field": "date", "type": "temporal"},
"y": {"field": "price", "type": "quantitative"},
"color": {"field": "symbol", "type": "nominal"}
}
}

https://stackoverflow.com/questions/51971606
复制相似问题