Vega

funnel: ریزش یک پایپ‌لاین داده

یک قیف که با میله‌های وسط‌چین ساخته شده: calculate مقادیر -volume/2 و +volume/2 رو توی x/x2 می‌سازه و یک لایهٔ text حجم رو وسط هر طبقه نشون میده.

کاربرد

نشون‌دادن اینکه چندتا رویداد از هر مرحله رد میشن: dedup، اعتبارسنجی، غنی‌سازی، serving.

پیش‌نیازها

Vega-Lite v5

Vega-Lite
{
  "$schema": "https://vega.github.io/schema/vega-lite/v5.json",
  "data": {
    "values": [
      { "etape": "Événements bruts", "volume": 120000, "ordre": 0 },
      { "etape": "Dédupliqués", "volume": 98000, "ordre": 1 },
      { "etape": "Validés", "volume": 86000, "ordre": 2 },
      { "etape": "Enrichis", "volume": 74000, "ordre": 3 },
      { "etape": "Agrégés", "volume": 52000, "ordre": 4 },
      { "etape": "Servis (API)", "volume": 31000, "ordre": 5 }
    ]
  },
  "transform": [
    { "calculate": "-datum.volume / 2", "as": "x0" },
    { "calculate": "datum.volume / 2", "as": "x1" }
  ],
  "encoding": {
    "y": { "field": "etape", "type": "nominal", "sort": { "field": "ordre", "op": "min" }, "title": null }
  },
  "layer": [
    {
      "mark": { "type": "bar", "height": 28, "cornerRadius": 4, "tooltip": true },
      "encoding": {
        "x": { "field": "x0", "type": "quantitative", "axis": null },
        "x2": { "field": "x1" },
        "color": { "field": "volume", "type": "quantitative", "scale": { "scheme": "teals" }, "legend": null },
        "tooltip": [
          { "field": "etape", "title": "Étape" },
          { "field": "volume", "format": ",.0f", "title": "Volume" }
        ]
      }
    },
    {
      "mark": { "type": "text", "color": "#e6edf3", "fontWeight": "bold" },
      "encoding": {
        "x": { "datum": 0 },
        "text": { "field": "volume", "type": "quantitative", "format": ",.0f" }
      }
    }
  ]
}
Vega-LiteFunnelcalculateData engineering

اسنیپت‌های مرتبط

بازگشت به آزمایشگاه داده