[英]How do I create a Progress Bar in vega-lite?
Could someone please show me how to create a simple Progress Bar in vega-lite using the following data?有人可以告诉我如何使用以下数据在 vega-lite 中创建一个简单的进度条吗? Thanks in advance.
提前致谢。
SEGMENT![]() |
ACHIEVED![]() |
REMAINING![]() |
---|---|---|
Enterprise![]() |
73.1% ![]() |
26.9% ![]() |
If I'm understanding your question correctly, you can do something like this ( view in editor ):如果我正确理解你的问题,你可以这样做( 在编辑器中查看):
{
"data": {
"values": [{"segment": "Enterprise", "achieved": 0.731, "remaining": 0.269}]
},
"transform": [
{"fold": ["achieved", "remaining"], "as": ["label", "percentage"]}
],
"mark": "bar",
"encoding": {
"y": {"field": "segment", "type": "nominal"},
"x": {
"field": "percentage",
"type": "quantitative",
"axis": {"format": ".0%"}
},
"color": {"field": "label", "type": "nominal"}
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.