# Is there any way to jump to the linked url when the data is clicked in vega-lite?

**URL:** <https://discuss.elastic.co/t/is-there-any-way-to-jump-to-the-linked-url-when-the-data-is-clicked-in-vega-lite/239605>\
**Category:** Kibana\
**Tags:** vega\
**Created:** [July 2, 2020, 10:09am UTC](https://discuss.elastic.co/t/is-there-any-way-to-jump-to-the-linked-url-when-the-data-is-clicked-in-vega-lite/239605 "2020-07-02T10:09:56Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![c5101010](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/c5101010/32/69884_2.png) [@c5101010](https://discuss.elastic.co/u/c5101010)\
**Post date:** [July 2, 2020, 10:09am UTC](https://discuss.elastic.co/t/is-there-any-way-to-jump-to-the-linked-url-when-the-data-is-clicked-in-vega-lite/239605/1 "2020-07-02T10:09:56Z")

</div>

Hi, I want to do

> **[Encoding](https://vega.github.io/vega-lite/docs/encoding.html#href)**
>
> Vega-Lite - a high-level grammar for statistical graphics. Vega-Lite provides a higher-level grammar for visual analysis, comparable to ggplot or Tableau, that generates complete Vega specifications. Vega-Lite specifications consist of simple...

  
 ![image](https://us1.discourse-cdn.com/elastic/original/3X/5/5/5582cc4085b149cf85bcb3164db7d393a45bbdca.png)

I wrote my vega code as follows.  
However, I can not jump to the linked URL when I clicked the scatter plot.

I would appreciate it if you could give me a hint to solve this.

```auto

{
      $schema: https://vega.github.io/schema/vega-lite/v2.json
      title: "Scatter Plot Graph"
      mark: point
      data: {
        url: {
          %context%: true
index: zoom_chat_test
          body: {
            size: 100
            _source: ["x", "y","name","comment","url"]
          }
        }
format: {property: "hits.hits"}
      }
      encoding: {
x: {field: "_source.x", type: "quantitative",
"axis": {
        "title": "x-axis title"
        }
        }
y: {field: "_source.y", type: "quantitative",
"axis": {
        "title": "y-axis title"
        }
        }
"tooltip":[
        {"field":"_source['x']","type":"quantitative"},
        {"field":"_source['y']","type":"quantitative"},
        {"field":"_source['name']","type":"nominal"},
        {"field":"_source['comment']","type":"nominal"},
        {"field":"_source['url']","type":"nominal"}
        ],
    "href": {"field": "_source['url']", "type": "nominal"}
      }
    }

```

---

<div class="post-metadata">

**Author:** ![matw](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/matw/32/13913_2.png) [@matw](https://discuss.elastic.co/u/matw)\
**Post date:** [July 8, 2020, 5:28am UTC](https://discuss.elastic.co/t/is-there-any-way-to-jump-to-the-linked-url-when-the-data-is-clicked-in-vega-lite/239605/2 "2020-07-08T05:28:17Z")

</div>

Hi and welcome to our community!

seems your code is missing the transform part to make it functional:

```
"transform": [{
    "calculate": "'https://www.google.com/search?q=' + datum.Name", "as": "url"
  }],

```

Best,  
Matthias

---

<div class="post-metadata">

**Author:** ![c5101010](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/c5101010/32/69884_2.png) [@c5101010](https://discuss.elastic.co/u/c5101010)\
**Post date:** [July 12, 2020, 12:07am UTC](https://discuss.elastic.co/t/is-there-any-way-to-jump-to-the-linked-url-when-the-data-is-clicked-in-vega-lite/239605/3 "2020-07-12T00:07:38Z")

</div>

Hi Matthias,  
Thank you for your reply.

I could open the URL by clicking the point of scatter plot by applying your suggested solution as well as adding "vega.enableExternalUrls: true" setting to kibana.yml file.

Thank you!

---

<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 9, 2020, 12:07am UTC](https://discuss.elastic.co/t/is-there-any-way-to-jump-to-the-linked-url-when-the-data-is-clicked-in-vega-lite/239605/4 "2020-08-09T00:07:40Z")

</div>

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