Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
Anonymous
Not applicable

How to append a hyperlink on d3 element on custom visual

Hi,

I need to insert a hyperlink on d3 element, e.g. when user click on the element, it will direct the browser to another page.  Is it doable?

I followed these 2 links but had no success.

https://community.powerbi.com/t5/Developer/Hyperlink-not-clickable-with-custom-visual/td-p/39446

https://github.com/Microsoft/PowerBI-visuals/blob/master/Tutorial/LaunchURL.md

 

Can anyone help please?

 

---------

my visual.ts code is simple, basically have a rect and need to get this rect clickable with the hyperlink.  Thanks!

 

1 ACCEPTED SOLUTION
dm-p
Super User
Super User

Hi @Anonymous,

Because custom visuals are sandboxed, they prevent external links, as they can (potentially) inadvertently expose users to malicious intent. launchUrl is the supported way to do this - I see you've tried, but this is how I've got it working. 

If implemented correctly, then the user gets prompted that they are about to navigate away. I have something like this in the Violin Plot, e.g.:

image.png

Here's where I'm implementing in my code, if this helps you to clarify how it's being done.

Hope this helps,

Daniel





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!


My course: Introduction to Developing Power BI Visuals


On how to ask a technical question, if you really want an answer (courtesy of SQLBI)




View solution in original post

1 REPLY 1
dm-p
Super User
Super User

Hi @Anonymous,

Because custom visuals are sandboxed, they prevent external links, as they can (potentially) inadvertently expose users to malicious intent. launchUrl is the supported way to do this - I see you've tried, but this is how I've got it working. 

If implemented correctly, then the user gets prompted that they are about to navigate away. I have something like this in the Violin Plot, e.g.:

image.png

Here's where I'm implementing in my code, if this helps you to clarify how it's being done.

Hope this helps,

Daniel





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!


My course: Introduction to Developing Power BI Visuals


On how to ask a technical question, if you really want an answer (courtesy of SQLBI)




Helpful resources

Announcements
Fabcon_Europe_Social_Bogo

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

Check out the June 2024 Power BI update to learn about new features.

PBI_Carousel_NL_June

Fabric Community Update - June 2024

Get the latest Fabric updates from Build 2024, key Skills Challenge voucher deadlines, top blogs, forum posts, and product ideas.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.