<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Setting up D3 V4 with Custom Visuals and Types in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/Setting-up-D3-V4-with-Custom-Visuals-and-Types/m-p/330101#M9775</link>
    <description>&lt;P&gt;D3 V4 has been out for some time now, but there is not a straightforward way to get it working inside a pbiviz. Instead, most Power BI examples and documentation show you how to work with D3 version 3.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The goal is to get D3 V4 working in my custom visual with types. Using the following steps (described below), I was able to get D3 V4 working without types. I believe the ultimate solution involves using a js bundler such as Rollup or Webpack. I am less familiar with these tools so I was hoping someone could point me in the right direction to get types working.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is what I've done so far&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;//STEP 1 - install d3 and types&lt;BR /&gt;npm install d3 @types/d3 --save&lt;BR /&gt;&lt;BR /&gt;//STEP 2 - Include d3 in pbiviz.json&lt;BR /&gt;"externalJS": [&lt;BR /&gt;  "node_modules/d3/build/d3.min.js",&lt;BR /&gt;  "node_modules/powerbi-visuals-utils/dataviewutils/lib/index.js"&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;//STEP 3 - reference d3 in visual.ts by declaring a gloabal variable&lt;BR /&gt;let d3 = (&amp;lt;any&amp;gt;window).d3;&lt;BR /&gt;module powerbi.extensibility.visual {&lt;BR /&gt;  "use strict"&lt;BR /&gt;  export class Visual implements IVisual {&lt;BR /&gt;  ...&lt;BR /&gt;  }&lt;BR /&gt;}&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Although this solution works for using d3, I lose my types as soon when I declare d3 as a global&amp;nbsp;variable in visual.ts (step 3). If I comment out this variable, i get my types back, but then my visual doesn't compile. So I've been switching back and forth by commenting/uncommenting that global d3 variable reference to get my types working during development.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My big question is this: how can I get d3 v4 to work here, without me needing to reference it as a global variable? Would rollup/webpack help for this? If so, how do I implement this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
    <pubDate>Thu, 28 Dec 2017 17:37:32 GMT</pubDate>
    <dc:creator>tylersbrown01</dc:creator>
    <dc:date>2017-12-28T17:37:32Z</dc:date>
    <item>
      <title>Setting up D3 V4 with Custom Visuals and Types</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Setting-up-D3-V4-with-Custom-Visuals-and-Types/m-p/330101#M9775</link>
      <description>&lt;P&gt;D3 V4 has been out for some time now, but there is not a straightforward way to get it working inside a pbiviz. Instead, most Power BI examples and documentation show you how to work with D3 version 3.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The goal is to get D3 V4 working in my custom visual with types. Using the following steps (described below), I was able to get D3 V4 working without types. I believe the ultimate solution involves using a js bundler such as Rollup or Webpack. I am less familiar with these tools so I was hoping someone could point me in the right direction to get types working.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is what I've done so far&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;//STEP 1 - install d3 and types&lt;BR /&gt;npm install d3 @types/d3 --save&lt;BR /&gt;&lt;BR /&gt;//STEP 2 - Include d3 in pbiviz.json&lt;BR /&gt;"externalJS": [&lt;BR /&gt;  "node_modules/d3/build/d3.min.js",&lt;BR /&gt;  "node_modules/powerbi-visuals-utils/dataviewutils/lib/index.js"&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;//STEP 3 - reference d3 in visual.ts by declaring a gloabal variable&lt;BR /&gt;let d3 = (&amp;lt;any&amp;gt;window).d3;&lt;BR /&gt;module powerbi.extensibility.visual {&lt;BR /&gt;  "use strict"&lt;BR /&gt;  export class Visual implements IVisual {&lt;BR /&gt;  ...&lt;BR /&gt;  }&lt;BR /&gt;}&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Although this solution works for using d3, I lose my types as soon when I declare d3 as a global&amp;nbsp;variable in visual.ts (step 3). If I comment out this variable, i get my types back, but then my visual doesn't compile. So I've been switching back and forth by commenting/uncommenting that global d3 variable reference to get my types working during development.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My big question is this: how can I get d3 v4 to work here, without me needing to reference it as a global variable? Would rollup/webpack help for this? If so, how do I implement this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Thu, 28 Dec 2017 17:37:32 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Setting-up-D3-V4-with-Custom-Visuals-and-Types/m-p/330101#M9775</guid>
      <dc:creator>tylersbrown01</dc:creator>
      <dc:date>2017-12-28T17:37:32Z</dc:date>
    </item>
    <item>
      <title>Re: Setting up D3 V4 with Custom Visuals and Types</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Setting-up-D3-V4-with-Custom-Visuals-and-Types/m-p/330317#M9784</link>
      <description>&lt;P&gt;There's no need to use module bundler.&lt;/P&gt;&lt;P&gt;The solution is:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Remove&amp;nbsp;&lt;STRONG&gt;let d3 = (&amp;lt;any&amp;gt;window).d3;&amp;nbsp;&lt;/STRONG&gt;from TypeScript code.&lt;/LI&gt;&lt;LI&gt;Instead you should create a new file "&lt;STRONG&gt;d3Injector.js&lt;/STRONG&gt;" (you can call it as you want).&lt;/LI&gt;&lt;LI&gt;Put &lt;STRONG&gt;var d3 = window.d3;&amp;nbsp;&lt;/STRONG&gt;into created file&lt;/LI&gt;&lt;LI&gt;Include&amp;nbsp;&lt;STRONG&gt;d3Injector.js&amp;nbsp;&lt;/STRONG&gt;into externlaJS property of pbiviz.json right after "node_modules/d3/build/d3.min.js"&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please let me know if that works for you as well.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Ignat Vilesov,&lt;/P&gt;&lt;P&gt;Software Engineer&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Microsoft Power BI Custom Visuals&lt;/P&gt;&lt;P&gt;&lt;A href="mailto:pbicvsupport@microsoft.com" target="_blank"&gt;&lt;SPAN&gt;pbicvsupport@microsoft.com&lt;/SPAN&gt;&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 29 Dec 2017 07:38:46 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Setting-up-D3-V4-with-Custom-Visuals-and-Types/m-p/330317#M9784</guid>
      <dc:creator>v-viig</dc:creator>
      <dc:date>2017-12-29T07:38:46Z</dc:date>
    </item>
    <item>
      <title>Re: Setting up D3 V4 with Custom Visuals and Types</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Setting-up-D3-V4-with-Custom-Visuals-and-Types/m-p/330579#M9795</link>
      <description>&lt;P&gt;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!&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;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.&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;PRE&gt;error  TYPESCRIPT  C:/repos/visuals/pbiviz/simpleLine/node_modules/@types/geojson/index.d.ts : (164,21) Generic type 'Feature&amp;lt;G, P, GeoJsonProperties&amp;gt;' requires 3 type argument(s).&lt;/PRE&gt;&lt;/DIV&gt;</description>
      <pubDate>Fri, 29 Dec 2017 22:42:03 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Setting-up-D3-V4-with-Custom-Visuals-and-Types/m-p/330579#M9795</guid>
      <dc:creator>tylersbrown01</dc:creator>
      <dc:date>2017-12-29T22:42:03Z</dc:date>
    </item>
    <item>
      <title>Re: Setting up D3 V4 with Custom Visuals and Types</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Setting-up-D3-V4-with-Custom-Visuals-and-Types/m-p/333191#M9863</link>
      <description>&lt;P&gt;Yes, you're correct PBIVIZ uses the old version of TypeScript.&lt;/P&gt;&lt;P&gt;We have a backlog item to update TypeScript version.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Ignat Vilesov,&lt;/P&gt;&lt;P&gt;Software Engineer&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Microsoft Power BI Custom Visuals&lt;/P&gt;&lt;P&gt;&lt;A href="mailto:pbicvsupport@microsoft.com" target="_blank"&gt;&lt;SPAN&gt;pbicvsupport@microsoft.com&lt;/SPAN&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 05 Jan 2018 12:41:33 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Setting-up-D3-V4-with-Custom-Visuals-and-Types/m-p/333191#M9863</guid>
      <dc:creator>v-viig</dc:creator>
      <dc:date>2018-01-05T12:41:33Z</dc:date>
    </item>
    <item>
      <title>Re: Setting up D3 V4 with Custom Visuals and Types</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Setting-up-D3-V4-with-Custom-Visuals-and-Types/m-p/576638#M17778</link>
      <description>&lt;P&gt;Has the typescript version been updated yet? Or, what is the current version of typescript that the pbi library uses?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 01 Dec 2018 06:40:10 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Setting-up-D3-V4-with-Custom-Visuals-and-Types/m-p/576638#M17778</guid>
      <dc:creator>mrogunlana</dc:creator>
      <dc:date>2018-12-01T06:40:10Z</dc:date>
    </item>
    <item>
      <title>Re: Setting up D3 V4 with Custom Visuals and Types</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Setting-up-D3-V4-with-Custom-Visuals-and-Types/m-p/577072#M17786</link>
      <description>&lt;P&gt;We recently released the beta version of PBIVIZ Tools that uses the new TypeScript and webpack under the hood.&lt;/P&gt;
&lt;P&gt;That means you can use D3 v4 and even v5&amp;nbsp;&lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://community.fabric.microsoft.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To find out more please visit &lt;A href="https://community.powerbi.com/t5/Custom-Visuals-Community-Blog/New-Beta-version-of-powerbi-visual-tools-v3/ba-p/545287" target="_self"&gt;this blog post&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Calibri; font-size: 11.0pt; color: #333333;"&gt;Ignat Vilesov,&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Calibri; font-size: 11.0pt; color: #333333;"&gt;Software Engineer&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Calibri; font-size: 11.0pt; color: #333333;"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Calibri; font-size: 11.0pt; color: #333333;"&gt;Microsoft Power BI Custom Visuals&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Calibri; font-size: 11.0pt;"&gt;&lt;A href="mailto:pbicvsupport@microsoft.com" target="_blank"&gt;pbicvsupport@microsoft.com&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 03 Dec 2018 06:58:26 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Setting-up-D3-V4-with-Custom-Visuals-and-Types/m-p/577072#M17786</guid>
      <dc:creator>v-viig</dc:creator>
      <dc:date>2018-12-03T06:58:26Z</dc:date>
    </item>
  </channel>
</rss>

