Calling javascript instead of href in Vega Lite Tooltop

I’d like to call another javascript function when an area is clicked, rather than follow a url as in the example below. How do I do this?

I mocked up a CSV file of URLS and used lodash to merge the two datasets together in one cell

bhamGeoFeaturesWithURL = _.merge(bhamGeoFeatures,urls)

and referenced the new datafile.

.data(bhamGeoFeaturesWithURL)
    .transform({ "calculate": "datum.url", "as": "url" })

Thanks Brett. However, what I’m looking to understand is how to execute javascript when the mouse is pressed on the area, instead of following the URL link.

I’ve added a simple piece of code to my original update the value of a html tag, but commented out as I don’t know how to add it.

Thanks, Chris.

You need to define selections and add signal listeners. I’ve created a simplified example here:

3 Likes