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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
Anonymous
Not applicable

Custom visual with external library

I am trying to develop a custom visual using d3-hierarchy (https://github.com/d3/d3-hierarchy). I've installed both the library and the typings using npm into the node_modules folder, and added the files to the tsconfig.json and pbiviz.json.

 

When I try to import the module, both VS Code and the TS compiler complain that they can't find a module called d3-hierarchy. Strangely, I get auto complete in VS Code for the library.

 

How can I set up my environment so I can use d3-hierarchy?

 

Unbenannt.PNG

6 REPLIES 6
v-viig
Community Champion
Community Champion

Hello @Anonymous

 

The current version of Power BI Visuals Tools don't support ES2015 (import/export) module system.

In other words, you should use another type definisitions that doesn't use ES2015.

 

Ignat Vilesov,

Software Engineer

 

Microsoft Power BI Custom Visuals

pbicvsupport@microsoft.com

v-chuncz-msft
Community Support
Community Support

@Anonymous,

 

You may check the following link.

https://community.powerbi.com/t5/Developer/Adding-a-static-js-script-to-a-custom-visualization/td-p/104957

Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Adding typings is just for the sake, that you will get intellisense for respective methods in given object.

If you don't need to have this, then you can directly go with solution as @v-chuncz-msft mentioned.

kuldeep_kumar
Helper I
Helper I

If I am not wrong, you don't need to import the module.

Just define lib in global dependencies in typings.json as it is done here for d3 .

To use this library in your file , define variable with same name where ever you want to use this lib.

Anonymous
Not applicable

Thank you for your answer. I don't understand yet what string I have to enter. I included a screenshot of my typings.jsontypings.PNG

 

I've looked into the github repository, but the string for d3 doesn't match the repositories structure, so I'm at a bit of a loss here 😕 

I hope this might help.

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors