Use Vega Visualization with Dynamic Data (Index)

Hi All,

I am able to find the answer and posting it here.
{
"$schema": "https://vega.github.io/schema/vega-lite/v2.3.1.json",
"autosize":
{
"type": "pad",
"resize": false
},
"data":
{
"url": {
"%context%": true,
"index": "vizcheck"
"body":
{
"aggs" : {
"eqpt_buckets": {
"composite" : {
"size": 5000,
"sources" :
[
{
"EPID":
{"terms" :
{
"field": "EPID"
}
}
},
{
"DATE":
{"terms" :
{"field": "DATE"
}
}
},
{
"CC_E":
{"terms" :
{"field": "CC_E"
}
}
},
{
"NoObj":
{
"terms":
{"field": "NoObj"
}
}
}
]
}
}
}
}
}
"format": {property: "aggregations.eqpt_buckets.buckets"}

},
  "transform": 
    [
      {"calculate": "datum.key.EPID", 
        "as": "EPID"
      },
      {"calculate": "datum.key.DATE", 
        "as": "DATE"},
      {"calculate": "datum.key.CC_E", 
      "as": "CC_E"
      },
      {"calculate": "datum.key.NoObj",
      "as": "NoObj"
      }
    ],
"mark": "bar",
 "config": 
 {
    "size": 
    {
      "height": 200,
      "width": 200
    },
}
"encoding": 
{
  "x": 
    {
        "field": "DATE",
        "type": "temporal",

    },
  "y": 
    {
        "field":"NoObj", 
        "aggregate": "sum",
        "type": "quantitative"
    }
    ,
  "color": 
    {
      "field": "CC_E", 
      "type": "nominal"
    },
  "row":
    {
      "field": "EPID",
      "type": "nominal"
    }
}

}

Main problem with earlier code was we need data to be formatted in the way bar graph needs. So first in the data group we are writing query to get the data and then using the same in below part of the code to draw the chart.

Thanks & Regards
Suhas Gupta