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

Hi, I want to do


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.


{
      $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"}
      }
    }

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

1 Like

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!

1 Like

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