如何设置存储在数据字段中的线条颜色?在织女我做了:
marks :[
{
encode: {
enter: {
...
stroke: {field: "color"}
}
}
}
]
Vega-Lite 有类似的方法吗?
如何设置存储在数据字段中的线条颜色?在织女我做了:
marks :[
{
encode: {
enter: {
...
stroke: {field: "color"}
}
}
}
]
Vega-Lite 有类似的方法吗?
您可以使用带有标记的color
编码。line
vega-lite 网站上有几个例子;一个相关的是多系列折线图:
{
"$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"}
}
}