簡體   English   中英

VEGA Kibana-多視圖圖表FLATTEN Transformation

[英]VEGA Kibana - multi view chart FLATTEN Transformation

我很難弄清楚如何使用匯總/嵌套在Vega中構建多視圖圖表。

我認為這與我嘗試轉換數據以在Vega多視圖圖表中使用的方式有關。 誰能幫我理解這一點?

我知道扁平化轉換正在按調試顯示

圖片

但是我得到的是

捕獲10

這就是我想要實現的

捕獲

這是我建立圖表的架構

{
  "$schema": "https://vega.github.io/schema/vega/v3.json",
  "width": 400,
  "height": 200,
  "padding": 5,
  "data": [
    {
      "name": "source",
      "values": {
        "aggregations": {
          "order_labels": {
            "buckets": [
              {
                "key": "USD/CAD",
                "doc_count": 1,
                "orders": {
                  "doc_count": 40,
                  "orders_id": {
                    "buckets": [
                      {
                        "key": 5241,
                        "doc_count": 1,
                        "orders_price": {"value": 0.01991}
                      },
                      {
                        "key": 5242,
                        "doc_count": 1,
                        "orders_price": {"value": 0.02021}
                      }
                    ]
                  }
                }
              },
              {
                "key": "CAD/COD",
                "doc_count": 1,
                "orders": {
                  "doc_count": 40,
                  "orders_id": {
                    "buckets": [
                      {
                        "key": 5041,
                        "doc_count": 1,
                        "orders_price": {"value": 0.00002953}
                      },
                      {
                        "key": 5042,
                        "doc_count": 1,
                        "orders_price": {"value": 0.00002971}
                      }
                    ]
                  }
                }
              }
            ]
          }
        }
      },
    "format": {"property": "aggregations.order_labels.buckets"},
    "transform": [
      {
        "type": "flatten",
        "fields": ["orders.orders_id.buckets"],
        "as": ["orders"]
      }
    ]
  }
  ],
  "mark": "bar",
  "encoding": {
    "row": {
      "field": "orders.key",
      "type": "ordinal"
    },
    "x": {
      "aggregate": "sum",
      "field": "orders.orders_price.value",
      "type": "quantitative",
      "scale": { "zero": false }
    },
    "y": {
      "field": "key",
      "type": "ordinal",
      "scale": { "rangeStep": 12 }
    }
  }
}

我做了很多事情,但是不明白這是怎么回事

Kibana 6.4肯定支持扁平化變換。 我認為它在6.3中也受支持。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM