# Sunburst Chart from aggregation

**URL:** <https://discuss.elastic.co/t/sunburst-chart-from-aggregation/234805>\
**Category:** Kibana\
**Tags:** vega\
**Created:** [May 28, 2020, 7:29pm UTC](https://discuss.elastic.co/t/sunburst-chart-from-aggregation/234805 "2020-05-28T19:29:04Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bernie](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bernie/32/45778_2.png) [@Bernie](https://discuss.elastic.co/u/Bernie)\
**Post date:** [May 28, 2020, 7:29pm UTC](https://discuss.elastic.co/t/sunburst-chart-from-aggregation/234805/1 "2020-05-28T19:29:04Z")

</div>

Hi,

I'm currently struggling a bit with Vega and how to prepare data for a Sunburst chart.  
I have the following aggregation, which is the time spent on projects. From this I believe it should be pretty simple to draw a sunburst chart, but I cannot wrap my head around how to prepare data in Vega.

```
GET foo/_search
{
    "aggs": {
    "Project": { "terms": { "field": "ProjectName.keyword" },
    "aggs": {
        "days": { "sum": {"field": "days"} },
        "Phase": {
          "terms": { "field": "Phase.keyword"},
          "aggs": {
            "days": { "sum": { "field": "days" } },
            "Task": {
          "terms": { "field": "Task.keyword"},
          "aggs": {
            "days": { "sum": { "field": "days" } }
          }
        }
          }
        }
      }
    }
  },
  "size": 0,
  "query": {
    "match_all": {}
  }
}

```

my goal is to create something like this [https://vega.github.io/vega/examples/sunburst/](https://vega.github.io/vega/examples/sunburst/) where the center is the sum of all days spent on all projects (total in output) and then split up by days spent on each project, then on each phase per project,...

If you happen to have any hints, I would greatly appreciate them.

thanks, Bernie

---

<div class="post-metadata">

**Author:** ![Bernie](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bernie/32/45778_2.png) [@Bernie](https://discuss.elastic.co/u/Bernie)\
**Post date:** [June 8, 2020, 8:10am UTC](https://discuss.elastic.co/t/sunburst-chart-from-aggregation/234805/2 "2020-06-08T08:10:47Z")

</div>

So, I realized way too late that a sunburst chart is built-in in Kibana by adding layers to a piechart... no need to fiddle with Vega

---

<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:** [July 6, 2020, 8:18am UTC](https://discuss.elastic.co/t/sunburst-chart-from-aggregation/234805/3 "2020-07-06T08:18:55Z")

</div>

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