Vega-lite: add a way for mark links (defined by "href") to open in a new window

Created on 23 May 2018  路  12Comments  路  Source: vega/vega-lite

given something like:

    "mark": { "type": "circle", "size": 100, "cursor": "pointer" },
    "encoding": {
        "href":    {"field": "some-url", "type": "nominal"}
    }

when clicked, the url is opened in the existing window. it would be great if it you could specify a new window to be opened.

Most helpful comment

+1 This would still be a useful in the vega-lite spec. Is there any update on supporting this in Vega?

All 12 comments

Unfortunately, we don't have an option in the Vega-Lite spec itself.

You can use shift click or set the target in the Vega loader as shown in https://github.com/vega/vega/issues/1171. We have an open issue to make it easy to pass the target option in Vega-Embed: https://github.com/vega/vega-embed/issues/77.

If you think that this option should be supported in Vega-Lite itself, we first need support in vega so please file an issue there.

no worries; i'm happy with the shift-click; thanks!

Excellent. If you think the docs could be clearer a out this, you can send a PR to update them.

+1 This would still be a useful in the vega-lite spec. Is there any update on supporting this in Vega?

Just want to circle back on that - in my humble, we could just switch the default way to open new tab, without changing the specs, no?

Yes, that's what's https://github.com/vega/vega-embed/issues/77 was for.

@domoritz can you provide a link to the documentation that shows how to:

override the loader

It's in the readme. The loader is one of the properties in the options object.

In the chart spec, I specified

"usermeta": {
            "embedOptions": {
                'theme': 'dark',
                'loader': {'target': '_blank'}
            }
        }

This did not work, but the readme mentions this should work. The theme is dark as expected though.

I passed {'loader': {'target':'_blank'}} to the opt argument in vegaEmbed and this did work as expected.
any reason why the usermeta.embedOptions did not work?

Fixed in https://github.com/vega/vega-embed/issues/625. Can you take a look just to double-check my logic?

usermeta.embedOptions.loader for vega-embed v6.15.1 works as expected now. Thank you @domoritz 鉂わ笍

Was this page helpful?
0 / 5 - 0 ratings