Cannot read properties of undefined (reading 'KPIs') Getting this error when trying to built dashboard using VEGA

Hello team,
I am getting the above mentioned error "Cannot read properties of undefined (reading 'KPIs')"
when I am trying to execute below code in VEGA

{
  "$schema": "https://vega.github.io/schema/vega/v4.17.json",
  "description": "A basic chart for the KPI monitoing",
  "padding": 20
  "signals": [
    {
      "name": "tooltip",
      "value": {},
      "on": [
        {"events": "rect:mouseover", "update": "datum"},
        {"events": "rect:mouseout", "update": "{}"}
      ]
    },
    {
      "name": "MinScaleVal",
      "value": 97,
      "bind": {"input": "range", "min": 90, "max": 99.9, "step": 0.1}
    }
  ],
  "data": [
    {
      "name": "esHIT",
      "url": {
      "%context%": true,
      "%timefield%": "@timestamp",
      "index": "lte_stats*",
      "body": {
  "track_total_hits": true,
  "size": 0,
  "aggs": {
    "KPIs": {
      "composite": {
        "size": 100,
        "sources": [
          {
            "SWversion": {
              "terms": {
                "field": "pw.lte_sw_version.keyword"
              }
            }
          }
        ]
      },
      "aggs": {
        "Erab Setup Success Rate All Success": {
          "sum": {
            "field": "pw.ERAB_EstabAddSuccNbr_QCI_Sum"
          }
        },
        "Erab Setup Success Rate All Attempt": {
          "sum": {
            "field": "pw.ERAB_EstabAddAttNbr_QCI_Sum"
          }
        },
        "LTE ERAB Setup SR": {
          "bucket_script": {
            "buckets_path": {
              "val": "Erab Setup Success Rate All Success",
              "denom": "Erab Setup Success Rate All Attempt"
            },
            "script": "Math.round(params.val/params.denom*10000.0)/100.0"
          }
        }
      }
    }
  }
}
    },
    "format": {"type": "json", "property": "aggregations.KPIs.buckets"},
      "transform": [
        {
          "type": "fold",
          "fields": [
            "LTE Availability",
            "LTE ERAB Setup SR"
          ],
          "as": ["keys", "values"]
        }
      ]
    },
  ],
  "scales": [
    {
      "name": "esX",
      "type": "band",
      "range": "width",
      "domain": {"data": "esHIT", "field": "key.SWversion"},
      "padding": 0.1
    },
    {
      "name": "esY",
      "type": "band",
      "range": "height",
      "domain": {"data": "esHIT", "field": "keys"},
      "padding": 0.1
    },
    {
      "name": "esColor",
      "type": "ordinal",
      "range": "category",
      "domain": {"data": "esHIT", "field": "values.value"}
    },
    {
      "name": "esColor1",
      "type": "linear",
      "range": {"scheme": "RedYellowGreen"},
      "domain": {"data": "esHIT", "field": "values.value"},
      "reverse": false,
      "zero": false,
      "nice": true
    },
    {
      "name": "color_Dynamic",
      "type": "quantize",
      "domain": {"data": "esHIT", "field": "values.value"},
      "range": {"scheme": "redyellowgreen", "count": 5},
      "zero": false,
      "reverse": false,
      "domainMin": {"signal": "MinScaleVal"}
    }
  ],
  "axes": [
    {"orient": "bottom", "scale": "esX", "zindex": 1, "labelFontSize":30, "labelColor": "black"},
    {"orient": "left", "scale": "esY", "zindex": 1, "labelFontSize":16, "labelColor": "black"}
  ],
  "legends": [
    {
      "fill": "color_Dynamic",
      "title": "KPI scale",
      "gradientLength": {"signal": "height - 28"}
    }
  ],
  "marks": [
    {
      "type": "rect",
      "from": {"data": "esHIT"},
      "encode": {
        "enter": {
          "x": {"scale": "esX", "field": "key.SWversion"},
          "width": {"scale": "esX", "band": 1},
          "y": {"scale": "esY", "field": "keys"},
          "height": {"scale": "esY", "band": 1},
          "fill": {"scale": "color_Dynamic", "field": "values.value"}
        },
        "update": {
          "fill": {"scale": "color_Dynamic", "field": "values.value"},
          "fillOpacity": {"value": 1},
          "stroke": {"value": null},
          "zindex": {"value": 0}
        },
        "hover": {
          "fillOpacity": {"value": 0.3},
          "stroke": {"value": "grey"},
          "strokeWidth": {"value": 5},
          "zindex": {"value": 1}
        }
      }
    },
    {
      "type": "text",
      "from": {"data": "esHIT"},
      "encode": {
        "enter": {
          "align": {"value": "center"},
          "baseline": {"value": "bottom"},
          "fill": {"value": "#333"}
        },
        "update": {
          "x": {"scale": "esX", "signal": "datum.key.SWversion", "band": 0.5},
          "y": {"scale": "esY", "signal": "datum.keys", "band": 0.7},
          "text": {"signal": "datum.values.value"},
          "fontSize": {"value": 12},
          "fillOpacity": [{"value": 1}]
        },
        "hover": {"fontSize": {"value": 25}}
      }
    }
  ]
}

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.