Gantt Visualization Using Vega

Sure, but you need to parse the string dates that you get from ES into the proper dates (you would not need to do it if the dates were in the unix time (long numbres), e.g. how time histogram keys look). Also, please post questions with data next time, retyping from image takes a long time :slight_smile:

{
  "$schema": "https://vega.github.io/schema/vega-lite/v2.json",
  "title": "Gantt Visualization Using Vega",
  "data": {
    "values": [
      {
        "_source": {
          "id": "bar",
          "start_time": "2018-05-20T12:00:00",
          "end_time": "2018-05-21T12:00:00"
        }
      },
      {
        "_source": {
          "id": "foo",
          "start_time": "2018-05-19T12:00:00",
          "end_time": "2018-05-20T12:00:00"
        }
      },
      {
        "_source": {
          "id": "baz",
          "start_time": "2018-05-20T12:00:00",
          "end_time": "2018-05-22T12:00:00"
        }
      }
    ]
  },
  "transform": [
    {"calculate": "toDate(datum._source.start_time)", "as": "start"},
    {"calculate": "toDate(datum._source.end_time)", "as": "end"}
  ],
  "mark": "bar",
  "encoding": {
    "y": {"field": "_source.id", "type": "nominal"},
    "x": {"field": "start", "type": "temporal"},
    "x2": {"field": "end", "type": "temporal"}
  }
}

cc: @Larry_Gregory

2 Likes