# Drill down using vega lite

**URL:** <https://discuss.elastic.co/t/drill-down-using-vega-lite/311187>\
**Category:** Kibana\
**Tags:** vega\
**Created:** [August 2, 2022, 8:44am UTC](https://discuss.elastic.co/t/drill-down-using-vega-lite/311187 "2022-08-02T08:44:10Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Irwan\_Kurniawan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/irwan_kurniawan/32/101755_2.png) [@Irwan\_Kurniawan](https://discuss.elastic.co/u/Irwan_Kurniawan)\
**Post date:** [August 2, 2022, 8:44am UTC](https://discuss.elastic.co/t/drill-down-using-vega-lite/311187/1 "2022-08-02T08:44:10Z")

</div>

Hi, I want to drill down my chart using Vega Lite. I made a heat map and when I clicked on one point, it will become a filter or it can to move to another dashboard. This is my code, I try to make the simple one when I clicked the point it will go to url. I followed this source and not works [Scatterplot with External Links and Tooltips | Vega-Lite](https://vega.github.io/vega-lite/examples/point_href.html)

```auto
{
  "$schema": "https://vega.github.io/schema/vega-lite/v5.json",
  "params": [
    {
      "name": "pts",
      "select": {
        "type": "point",
        "fields": ["penyakit", "kabupaten"],
        "toggle": true
      }
    }
  ],
  "data": {
    "url": {
      "%timefield%": "tanggal",
      "%context%": true,
      "index": "dummy_data",
      "body": {
        "aggs": {
          "eqpt_buckets": {
            "composite": {
              "size": 5000,
              "sources": [
                {"no": {"terms": {"field": "no"}}},
                {"tanggal": {"terms": {"field": "tanggal"}}},
                {"penyakit": {"terms": {"field": "penyakit"}}},
                {"umur": {"terms": {"field": "umur"}}},
                {"provinsi": {"terms": {"field": "provinsi"}}},
                {"kabupaten": {"terms": {"field": "kabupaten"}}},
                {"gender": {"terms": {"field": "gender"}}}
              ]
            }
          }
        }
      }
    },
    "format": {"property": "aggregations.eqpt_buckets.buckets"}
  },
  "transform": [
    {"calculate": "datum.key.no", "as": "no"},
    {"calculate": "datum.key.tanggal", "as": "tanggal"},
    {"calculate": "datum.key.penyakit", "as": "penyakit"},
    {"calculate": "datum.key.umur", "as": "umur"},
    {"calculate": "datum.key.provinsi", "as": "provinsi"},
    {"calculate": "datum.key.kabupaten", "as": "kabupaten"},
    {"calculate": "datum.key.gender", "as": "gender"},
    {
      "calculate": " datum.key.umur >= 0 ? '0-11 yrs' : datum.key.umur",
      "as": "groupUmur"
    },
    {
      "calculate": " datum.key.umur > 11 ? '12-17 yrs' : datum.groupUmur",
      "as": "groupUmur"
    },
    {
      "calculate": " datum.key.umur > 17 ? '18-49 yrs' : datum.groupUmur",
      "as": "groupUmur"
    },
    {
      "calculate": " datum.key.umur > 49 ? '50-64 yrs' : datum.groupUmur",
      "as": "groupUmur"
    },
    {
      "calculate": " datum.key.umur > 64 ? '>= 65 yrs' : datum.groupUmur",
      "as": "groupUmur"
    },
    {
      "calculate": "'https://www.google.com/search?q=' + datum.penyakit",
      "as": "url"
    }
  ],
  "mark": {"type": "rect", "tooltip": true},
  "encoding": {
    "x": {"field": "kabupaten", "type": "nominal", "title": null},
    "color": {
      "condition": {
        "name": "test",
        "aggregate": "count",
        "field": "no,",
        "type": "quantitative",
        "title": "Cases",
        "scale": {
          "domainMid": 3,
          "domainMax": 20,
          "range": "diverging",
          "scheme": "yelloworangebrown"
        },
        "param": "pts"
      },
      "value": "grey"
    },
    "y": {"field": "penyakit", "type": "nominal", "title": null},
    "href": {"field": "url", "type": "nominal"}
  }
}

```

---

<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:** [August 30, 2022, 8:44am UTC](https://discuss.elastic.co/t/drill-down-using-vega-lite/311187/2 "2022-08-30T08:44:18Z")

</div>

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