How to build a Vega tree using csv data stored in my index

I want to visualize a tree using vega. I have indexed a csv file containing employee data into elasticsearch. I would like vega to query that index and visualize a tree for me.

Every employee has a PersonID and their managers have a SupervisorID in the csv data.

Can someone tell me the vega syntax to do this?

This is what I tried but it didn't give me any results

{
  "$schema": "https://vega.github.io/schema/vega/v2.0.json",
  "data": [
    {
      "name": "tree",
      "url": {
        "index": "bamboo",
      },
       "transform": [
        {
          "type": "stratify",
          "key": "PersonID",
          "parentKey": "SupervisorID"
        }
      ]
    },
    {
      "name": "links",
      "source": "tree",
      "transform": [
        {
          "type": "treelinks"
        }
      ]
    }
  ]
}

Your spec is just containing the data part, it's not mapping this data to any visual output.

To get started with vega there is lot's of documentation available, e.g. on the vega website: http://vega.github.io/. Google also gave me this example for a vega tree, might be a good starting point: https://bl.ocks.org/ijlyttle/c535a3172c9f7fabf316e18d5ab7b086 . For a complex chart like this I recommend starting to build it in the vega editor with inline dummy data, and once everything's working there, moving it into Kibana and connecting it to the real data set. Otherwise you have to deal with both Elasticsearch querying and vega charting at once.

To learn more about how to query elasticsearch within a vega spec in Kibana check out the documentation: https://www.elastic.co/guide/en/kibana/current/vega-querying-elasticsearch.html

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