如何在 vega-lite 中使用 2 个不同的数据源进行可视化

问题描述 投票:0回答:0

我想使用 elasticsearch 索引叠加从不同数据源创建的两个散点图。我可以使用“层”来使用 1 个数据源来创建两个不同的图,但不能使用两个数据源来创建两个不同的图。我得到的错误是“无法设置未定义的属性(设置‘格式’)”,我似乎无法弄清楚格式应该是什么。

我的代码如下所示。

{
      "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
        "layer": [
        {
            "data": {
            "url": {
                "index": "A",
                  "body": {
                    "size": 10000,
                    "_source": ["A_a", "A_b"],
                },
                "format": {"property": "hits.hits"}
              },
              "mark": "type": "circle"
              "encoding": {
              .
              .
              .
            }
          }
        },
        {
            "data": {
            "url": {
                "index": "B",
                  "body": {
                    "size": 10000,
                    "_source": ["B_a", "B_b"],
                },
                "format": {"property": "hits.hits"}
              },
              "mark": "type": "circle"
              "encoding": {
              .
              .
              .
            }
          }
        }
    ]
}

我努力改变

"format": {"property": "hits.hits"}

"format": {"property": "hits.hits._source"}

但这也没有解决任何问题。我还应该如何更改我的格式以适应两个数据源?

elasticsearch kibana visualization scatter-plot vega-lite
© www.soinside.com 2019 - 2024. All rights reserved.