Forum Discussion
Setting up D3 V4 with Custom Visuals and Types
- 8 years ago
There's no need to use module bundler.
The solution is:
- Remove let d3 = (<any>window).d3; from TypeScript code.
- Instead you should create a new file "d3Injector.js" (you can call it as you want).
- Put var d3 = window.d3; into created file
- Include d3Injector.js into externlaJS property of pbiviz.json right after "node_modules/d3/build/d3.min.js"
Please let me know if that works for you as well.
Ignat Vilesov,
Software Engineer
Microsoft Power BI Custom Visuals
There's no need to use module bundler.
The solution is:
- Remove let d3 = (<any>window).d3; from TypeScript code.
- Instead you should create a new file "d3Injector.js" (you can call it as you want).
- Put var d3 = window.d3; into created file
- Include d3Injector.js into externlaJS property of pbiviz.json right after "node_modules/d3/build/d3.min.js"
Please let me know if that works for you as well.
Ignat Vilesov,
Software Engineer
Microsoft Power BI Custom Visuals
- tylersbrown018 years agoFrequent Visitor
Wow, thank you, it works! This is great - there's a lot of people that don't think it's possible to use d3 v4 with Power BI Custom Visuals. I will spread the word!
One small issue - it seems power bi custom visuals work on an older version of typescript. Do to this - I had to disable a couple methods in the d3 geojson @types file to solve this error. I don't use geojson so it's not a big deal for me but it might be for other people.
error TYPESCRIPT C:/repos/visuals/pbiviz/simpleLine/node_modules/@types/geojson/index.d.ts : (164,21) Generic type 'Feature<G, P, GeoJsonProperties>' requires 3 type argument(s).
- v-viig8 years agoCommunity Champion
Yes, you're correct PBIVIZ uses the old version of TypeScript.
We have a backlog item to update TypeScript version.
Ignat Vilesov,
Software Engineer
Microsoft Power BI Custom Visuals
- mrogunlana7 years agoFrequent Visitor
Has the typescript version been updated yet? Or, what is the current version of typescript that the pbi library uses?