Set Href Query String in Vega

I figured out how to make it so text acts as a URL:

    marks: [
      {
        type: "text",
        encode: { enter: { href: { value: "/path/from/base/href/<dashboard ID>/?myParam=myValue" }}}
      }
    ]

The problem is that I just need to update the query string (i.e. the part of the URL after the question mark). Is this possible? We have a bunch of dashboards (10+), so if I set the full href, I need to create a separate plugin for every dashboard. It doesn't seem that specifying the dashboard ID as part of the href is possible, but is it possible just to set the query string?

1 Like

Just to clarify a little more, what I'm trying to do is to click on a link inside a Vega plugin that stays on the current dashboard. I don't care how this is done - it could be by specifying a relative path, replacing the query string, or getting the dashboard ID as a signal. I'm just trying to figure out whether or not it's possible to do this so I know wheter or not I need to create a separate plugin for every dashboard.

If you want to stay on the current dashboard, why do you need a link? If you are trying to set a filter from within the Vega chart (e.g. by clicking a series), you can use the kibanaAddFilter integration. This is an example how this works: https://gist.github.com/nyurik/3c579fb8e81c8a981d4b267ad1767227

You basically have to piece together an object containing the thing you want to filter and then call kibanaAddFilter with it on click.

Joe,

Sorry for the really long delay - covid is definitely making things interesting here. At any rate, the reason for the link is that I need all visualizations on the dashboard to be updated. I believe the filter will only apply to the one visalization.

The filter will apply to all visualizations on the dashboard when triggered like this (given you are embedding the vega visualization in a panel on a dashboard, of course).

Joe,

Got it! I'll give it a shot soon, and thanks for looking into this!

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