admin管理员组文章数量:1317905
I have a line chart with an errorband. Is it possible to limit the x-range of the errorband? In my case I would like the errorband to start at x=8 and end at x=17. I have tried a lot of combinations of scale, domain, range without success.
Also, can the calculate for y be written better, e.g. in three different parts?
{
"params": [
{ "name": "band_max", "value": 2},
{ "name": "band_min", "value": -4}
],
"data": {
"sequence": {
"start": 2,
"stop": 20,
"step": 1,
"as": "x"
}
},
"transform": [
{
"calculate": "datum.x<=10?0.5*datum.x+14:datum.x<=15?0.2*datum.x+17:0.5*datum.x+12.5",
"as": "y"
},
{
"calculate": "band_max",
"as": "y_band_max"
},
{
"calculate": "band_min",
"as": "y_band_min"
}
],
"layer": [
{
"mark" : {
"type" : "line"
},
"encoding": {
"y": {
"field": "y",
"type": "quantitative",
"scale": {"domain": [8, 30]}
},
"x": {
"field": "x",
"type": "quantitative"
}
}
},
{
"mark": {
"type": "errorband"
},
"encoding": {
"y": {
"field": "y",
"type": "quantitative"
},
"yError": {"field": "y_band_max"},
"yError2": {"field": "y_band_min"},
"x": {
"field": "x",
"type": "quantitative"
}
}
}
]
}
本文标签: vega liteLimit range for errorbandStack Overflow
版权声明:本文标题:vega lite - Limit range for errorband - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742032185a2416652.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论