Vega Lite Table Output Option

Is there a table output option for vega lite (there is like 10 "mark" options but none of them are data table / grid or something similar.

Seems so simple - any help would be appreciated.

2 Likes

Hi,

Vega is not meant to use pure text output like a table. So you won't find any table mark. Though you could of course hack that together if you want to, by placing text output at specific positions, but that won't be fun.

Might I ask, why you are looking into Vega for visualizing a table, instead of using the table visualization?

Cheers,
Tim

There is an example of how to create a table with Vega Lite - https://vega.github.io/vega-lite/examples/layer_text_heatmap.html -- this is somewhat close to a table, but it is not the same as a true spreadsheet, because it won't resize cells if the content gets too big.

Hey Tim,

I have nested documents in elastic (if you are interest you can see how I am modelling the data in elastic you can look here --> https://github.com/swarmee/partySearch). Anyways using vega, for the first time, I can query nested documents in Kibana and produce visualisations on a dashboard (this is a massive step forward - great work guys). Previously we had to run our nested aggregations then push the results into elastic for visualisations in Kibana. Below is a sanitised example of a simple vega-lite visualisation I am using.

{
  "$schema": "https://vega.github.io/schema/vega-lite/v2.json",
  "title": "Identification Type Used",
  "data": {
    "url": {
      "%context%": true,
      "%timefield%": "saleDate",
      "index": "real-estate-sales",
      "body": {
        "aggs": {
          "a": {
            "nested": {"path": "role.party.identification"},
            "aggs": {
              "b": {
                "terms": {
                  "field": "role.party.identification.type.keyword",
                  "size": 10
                }
              }
            }
          }
        },
        "size": 0
      }
    },
    "format": {"type": "json", "property": "aggregations.a.b.buckets"}
  },
  "mark": "bar",
  "encoding": {
    "x": {"field": "key", "type": "ordinal"},
    "y": {"field": "doc_count", "type": "quantitative"}
  }
}

I'm guessing the plan is to add nested aggregations to the standard visualisations eventually, however if there was a way to push the results of a vega-lite query into a table before then - that would be cool.

1 Like

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