首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在Vega/ Vega-lite中绘制漏斗图

在Vega/ Vega-lite中绘制漏斗图
EN

Stack Overflow用户
提问于 2020-02-28 10:04:20
回答 1查看 697关注 0票数 2

我正在使用kibana中的vega来可视化数据。现在我想画一个漏斗图,但它没有任何这样的例子。

谢谢你的帮助

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2020-02-28 15:04:33

您可以使用stack: "center"的条形图在Vega-Lite中创建漏斗图。例如(vega editor):

代码语言:javascript
复制
{
  "data": {
    "values": [
      {"Pipeline": "Consultation", "Count": 140000},
      {"Pipeline": "Prospect", "Count": 120000},
      {"Pipeline": "Qualified", "Count": 100000},
      {"Pipeline": "Negotiation", "Count": 80000},
      {"Pipeline": "Prototype", "Count": 60000},
      {"Pipeline": "Closing", "Count": 40000},
      {"Pipeline": "Won", "Count": 20000},
      {"Pipeline": "Finalized", "Count": 10000}
    ]
  },
  "encoding": {"y": {"field": "Pipeline", "type": "nominal", "sort": null}},
  "layer": [
    {
      "mark": "bar",
      "encoding": {
        "color": {"field": "Pipeline", "type": "nominal", "legend": null},
        "x": {"field": "Count", "type": "quantitative", "stack": "center"}
      }
    },
    {
      "mark": "text",
      "encoding": {"text": {"field": "Count", "type": "quantitative"}}
    }
  ],
  "width": 500
}

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/60444288

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档