# Cannot create data tables in Vega plugin for Kibana v6.2

**URL:** https://discuss.elastic.co/t/cannot-create-data-tables-in-vega-plugin-for-kibana-v6-2/120784
**Category:** Kibana
**Created:** [February 21, 2018, 8:15am UTC](https://discuss.elastic.co/t/cannot-create-data-tables-in-vega-plugin-for-kibana-v6-2/120784 "2018-02-21T08:15:13Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![AshishAAB](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ashishaab/32/28034_2.png) [@AshishAAB](https://discuss.elastic.co/u/AshishAAB)
#### Post date: [February 21, 2018, 8:15am UTC](https://discuss.elastic.co/t/cannot-create-data-tables-in-vega-plugin-for-kibana-v6-2/120784/1 "2018-02-21T08:15:13Z")

</div>

I **need to create a data table which has values that need to be calculated using scripted aggregations**.  
As Kibana out of box visualization don't support such aggregations(I think), I was considering using Vega visualization for this using the v6.2 Kibana.

However, I am **not able to find any documentation for creating data tables in Vega**.  
Any help would be really appreciated.

Sample query i am trying:

```
{
  "size": 0,
  "aggs": {
    "locales": {
      "terms": {
        "field": "locale.keyword"
      },
      "aggs": {
        "search_exit": {
          "sum": {
            "field": "Search_Exit"
          }
        },
        "sessions": {
          "value_count": {
            "field": "session_id.keyword"
          }
        },
        "Session_Clickthrough_%": {
          "bucket_script": {
            "buckets_path": {
              "Searches": "search_exit",
              "Sessions": "sessions"
            },
            "script": "params.Searches/params.Sessions*100"
          }
        }
      }
    }
  }
}

```

In the above case, I would like to create a table with values like:

```
 Locale Session_Clickthrough% Metric_2 Metric_3
 en-US 10% XX XX
 zh-cn 30% XX XX

```

> Basically, multiple columns calculating percentages need to be shown in a tabular format

Thanks!

---

<div class="post-metadata">

### Author: ![nyuriks](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nyuriks/32/26171_2.png) [@nyuriks](https://discuss.elastic.co/u/nyuriks)
#### Post date: [February 21, 2018, 7:58pm UTC](https://discuss.elastic.co/t/cannot-create-data-tables-in-vega-plugin-for-kibana-v6-2/120784/2 "2018-02-21T19:58:55Z")

</div>

@AshishAAB you can use Vega for this, but it won't be as easy as HTML. Vega has [text mark](https://vega.github.io/vega/docs/marks/text/), but you need to do all of the layout -- label positioning yourself, so it won't be trivial. You could make all columns the same width, or a fixed percentage of the graph's width, and use a scale to convert it - e.g. `x: { scale: "xscale", value: "locale" }`, and the xscale could be a [band scale](https://vega.github.io/vega/docs/scales/#band) which will map "locale" string onto some X coordinate scaled to the full width of the screen.

---

<div class="post-metadata">

### Author: ![AshishAAB](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ashishaab/32/28034_2.png) [@AshishAAB](https://discuss.elastic.co/u/AshishAAB)
#### Post date: [February 22, 2018, 5:50am UTC](https://discuss.elastic.co/t/cannot-create-data-tables-in-vega-plugin-for-kibana-v6-2/120784/3 "2018-02-22T05:50:18Z")

</div>

Thanks @nyuriks for the suggestion!  
I would try the text mark to create such tables

---

<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: [March 22, 2018, 5:50am UTC](https://discuss.elastic.co/t/cannot-create-data-tables-in-vega-plugin-for-kibana-v6-2/120784/4 "2018-03-22T05:50:40Z")

</div>

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