# No Data from Vega Percentiles Histogram

**URL:** <https://discuss.elastic.co/t/no-data-from-vega-percentiles-histogram/267670>\
**Category:** Kibana\
**Created:** [March 18, 2021, 1:39pm UTC](https://discuss.elastic.co/t/no-data-from-vega-percentiles-histogram/267670 "2021-03-18T13:39:44Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![nickr](https://avatars.discourse-cdn.com/v4/letter/n/dc4da7/32.png) [@nickr](https://discuss.elastic.co/u/nickr)\
**Post date:** [March 18, 2021, 1:39pm UTC](https://discuss.elastic.co/t/no-data-from-vega-percentiles-histogram/267670/1 "2021-03-18T13:39:44Z")

</div>

1st Post from a newbie,

I'm trying to replicate something like the below graph using Vega. All I currently get is a labelled frame with no data.

 ![Elastic](https://us1.discourse-cdn.com/elastic/original/3X/f/b/fb490e9a46986c73dfcf421b0164b4c02a57608c.png)

The data is returned by Elasticsearch

```auto
     "aggregations" : {
        "cpu" : {
          "values" : {
            "1.0" : 0.004999999999999999,
            "5.0" : 0.006,
            "25.0" : 0.008,
            "50.0" : 0.03723989723277846,
            "75.0" : 0.06195735022948351,
            "95.0" : 0.39579361863807483,
            "99.0" : 0.7608407483968309
          }
        }
      }

```

```
My attempted Vega code

```

```auto
    {
      $schema: https://vega.github.io/schema/vega-lite/v2.json
      title: SLA percentile evaluation

      data: {
        url: {
          %context%: true
          %timefield%: @timestamp
          index: metricbeat-*
          body: {
            "size": 0,
            "_source": "system.cpu.total.norm.pct" ,
            "aggs":{
              "cpu":{
                "percentiles":{
                  "field":"system.cpu.total.norm.pct",
                  "percents":[1, 5, 25, 50, 75,90, 95, 99]
                }
              }
            }
          }
        }
        format: { property: "aggregations.cpu.values" }
      },
      "mark": {"type": "bar", "style": "box"},
      "encoding": {
        "y": {"field": "values", "type": "quantitative"},
        "x": {"field": "key", "type": "quantitative", axis: {title: "Percentiles", tickMinStep: 1}},
        "color": {"value": "steelblue"},
        "size": {"value": 11}
      }

    }

```

What am I missing ??

Many Thanks

---

<div class="post-metadata">

**Author:** ![nickr](https://avatars.discourse-cdn.com/v4/letter/n/dc4da7/32.png) [@nickr](https://discuss.elastic.co/u/nickr)\
**Post date:** [March 18, 2021, 2:56pm UTC](https://discuss.elastic.co/t/no-data-from-vega-percentiles-histogram/267670/2 "2021-03-18T14:56:50Z")

</div>

The debug in case it is useful

```auto
`"{"$schema":"https://vega.github.io/schema/vega-lite/v2.json","title":"SLA percentile evaluation","data":{"format":{"property":"aggregations.cpu.values"},"values":{"took":160,"timed_out":false,"_shards":{"total":26,"successful":26,"skipped":0,"failed":0},"hits":{"total":{"value":10000,"relation":"gte"},"max_score":null,"hits":[]},"aggregations":{"cpu":{"values":{"1.0":0.005,"5.0":0.006,"25.0":0.021,"50.0":0.036000000000000004,"75.0":0.06133333333333333,"90.0":0.1862999999999999,"95.0":0.6206,"99.0":0.7144400000000001}}}}},"mark":{"type":"bar","style":"box"},"encoding":{"y":{"field":"values","type":"quantitative"},"x":{"field":"key","type":"quantitative","axis":{"title":"Percentiles","tickMinStep":1}},"color":{"value":"steelblue"}},"config":{"range":{"category":{"scheme":"elastic"}},"mark":{"color":"#54B399"}},"autosize":{"type":"fit","contains":"padding"}}"`

```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [April 15, 2021, 2:56pm UTC](https://discuss.elastic.co/t/no-data-from-vega-percentiles-histogram/267670/3 "2021-04-15T14:56:54Z")

</div>

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