<?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 Re: D3 V4 gallery library implementation with dependencies in Custom Visuals Development Discussion</title>
    <link>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/D3-V4-gallery-library-implementation-with-dependencies/m-p/384802#M914</link>
    <description>&lt;P&gt;Please visit &lt;A href="https://stackoverflow.com/questions/17493309/how-do-i-change-the-language-of-moment-js" target="_self"&gt;this Stackoverflow &lt;/A&gt;topic to find out more.&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;&lt;SPAN&gt;pbicvsupport@microsoft.com&lt;/SPAN&gt;&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 27 Mar 2018 15:00:30 GMT</pubDate>
    <dc:creator>v-viig</dc:creator>
    <dc:date>2018-03-27T15:00:30Z</dc:date>
    <item>
      <title>D3 V4 gallery library implementation with dependencies</title>
      <link>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/D3-V4-gallery-library-implementation-with-dependencies/m-p/381598#M889</link>
      <description>&lt;P&gt;&lt;IMG src="https://ip1.i.lithium.com/68589c9535e3575f59e923177f08eff967bd01cd/68747470733a2f2f7261772e67697468756275736572636f6e74656e742e636f6d2f666c72732f766973617661696c2f6d61737465722f707265766965772e6a7067" border="0" alt="" width="772" height="200" /&gt;&lt;/P&gt;&lt;P&gt;Hello everyone,&lt;BR /&gt;&lt;BR /&gt;I'm trying to implement an example library from the &lt;A href="https://github.com/d3/d3/wiki/Gallery" target="_blank"&gt;D3 gallery&lt;/A&gt;&amp;nbsp;called &lt;A href="https://github.com/flrs/visavail" target="_blank"&gt;Visavail&lt;/A&gt;. A demo of this library can be found here:&amp;nbsp;&lt;A href="http://phatduino.com.w010a51b.kasserver.com/visavail/example.htm" target="_blank"&gt;link.&lt;/A&gt;&lt;/P&gt;&lt;P&gt;I'm having difficulties getting it to work, any help or pointers will be appriciated.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Setup:&lt;/STRONG&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Installed Moment with npm&lt;/LI&gt;&lt;LI&gt;Installed D3 V4 with npm&lt;/LI&gt;&lt;LI&gt;Added Visavail library to the node_modules folder&lt;/LI&gt;&lt;LI&gt;Added font-awesome tot the style folder&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Then I referenced it all in pbiviz.json:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;  "externalJS": [
    "node_modules/powerbi-visuals-utils-dataviewutils/lib/index.js",
	  "node_modules/d3/build/d3.min.js",
    "node_modules/visavail/js/visavail.js",
    "node_modules/moment/min/moment-with-locales.min.js"
  ],
  "style": "style/visual.less",
  "capabilities": "capabilities.json",
  "dependencies": "dependencies.json",
  "stringResources": []&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The CSS was referenced in the visual.less file:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;@import (less) "style/font-awesome/css/font-awesome.min.css";
@import (less) "node_modules/visavail/css/visavail.css";&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;The code:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;In Visual.ts, based on the hello world update counter I recreated the Visavail example with static data.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;module powerbi.extensibility.visual {
    "use strict";
    export class Visual implements IVisual {
        private target: HTMLElement;
        private settings: VisualSettings;

        private d3;
        private visavail;
        private moment;
        private svg;
        private mydataset;
        private chart;

        constructor(options: VisualConstructorOptions) {
            console.log('Visual constructor', options);
            this.target = options.element;
            
            this.d3 = (window as any).d3;
            this.visavail = (window as any).visavail;
            this.moment = (window as any).moment;

            this.moment.locale("en");

            this.svg = this.d3.select(this.target).append('svg');

        }

        public update(options: VisualUpdateOptions) {
            this.settings = Visual.parseSettings(options &amp;amp;&amp;amp; options.dataViews &amp;amp;&amp;amp; options.dataViews[0]);
            this.target.innerHTML = '&amp;lt;p id="example"&amp;gt;TEST&amp;lt;/em&amp;gt;&amp;lt;/p&amp;gt;';
            
            this.chart = this.visavail.visavailChart().width(800);

            this.mydataset = [{
                "measure": "Annual Report", 
                "data": [
                    ["2015-01-01", 0, "2015-03-04"],
                    ["2016-01-01", 1, "2016-03-03"],
                    ["2017-01-01", 1, "2017-03-06"],
                    ["2018-01-01", 1, "2018-04-01"]
                ]
            }];

            this.d3.select("#example").datum(this.mydataset).call(this.chart);
        }

        private static parseSettings(dataView: DataView): VisualSettings {
            return VisualSettings.parse(dataView) as VisualSettings;
        }

        public enumerateObjectInstances(options: EnumerateVisualObjectInstancesOptions): VisualObjectInstance[] | VisualObjectInstanceEnumerationObject {
            return VisualSettings.enumerateObjectInstances(this.settings || VisualSettings.getDefault(), options);
        }
    }
}&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Am I referencing the &lt;SPAN&gt;dependencies&amp;nbsp;&lt;/SPAN&gt;correctly?&lt;/LI&gt;&lt;LI&gt;Am I importing the dependencies correctly?&lt;/LI&gt;&lt;LI&gt;Am I implementing the dependencies correctly?&lt;/LI&gt;&lt;LI&gt;How do I debug this?&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;I zipped the entire project, it can be downloaded here:&lt;/P&gt;&lt;PRE&gt;&lt;A href="https://www.dropbox.com/s/aggbcdm4vnooy8h/statisTimeLine2.zip?dl=0" target="_self"&gt;https://www.dropbox.com/s/aggbcdm4vnooy8h/statisTimeLine2.zip?dl=0&lt;/A&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 22 Mar 2018 10:43:21 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/D3-V4-gallery-library-implementation-with-dependencies/m-p/381598#M889</guid>
      <dc:creator>FunDeckHermit</dc:creator>
      <dc:date>2018-03-22T10:43:21Z</dc:date>
    </item>
    <item>
      <title>Re: D3 V4 gallery library implementation with dependencies</title>
      <link>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/D3-V4-gallery-library-implementation-with-dependencies/m-p/382353#M895</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="58785" data-lia-user-login="FunDeckHermit" class="lia-mention lia-mention-user"&gt;FunDeckHermit&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The chart didn't work due to using d3v4 instead of d3v3. We installed d3v3 and created the global injector for moment to fix this visual.&lt;/P&gt;
&lt;P&gt;Please find the fixed source code &lt;A href="https://1drv.ms/u/s!As9ZTdAyQtTDiRYbiMdWWl6O4kf8" target="_blank"&gt;here&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;&lt;SPAN&gt;pbicvsupport@microsoft.com&lt;/SPAN&gt;&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 23 Mar 2018 07:13:56 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/D3-V4-gallery-library-implementation-with-dependencies/m-p/382353#M895</guid>
      <dc:creator>v-viig</dc:creator>
      <dc:date>2018-03-23T07:13:56Z</dc:date>
    </item>
    <item>
      <title>Re: D3 V4 gallery library implementation with dependencies</title>
      <link>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/D3-V4-gallery-library-implementation-with-dependencies/m-p/384732#M906</link>
      <description>&lt;P&gt;Thank you!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;With the implementation of the globalinjector, do you happen to know how to change the locale of moment.js?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;calling moment.locale("de") in the momentGlobalInjector.js&lt;/LI&gt;&lt;LI&gt;calling this.&lt;SPAN&gt;moment.locale("de") in the visual.ts&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN&gt;&lt;SPAN&gt;changing "&lt;/SPAN&gt;&lt;/SPAN&gt;/moment/min/moment-with-locales.min.js" to "/moment/locale/de.js&lt;/LI&gt;&lt;/UL&gt;</description>
      <pubDate>Tue, 27 Mar 2018 13:58:14 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/D3-V4-gallery-library-implementation-with-dependencies/m-p/384732#M906</guid>
      <dc:creator>FunDeckHermit</dc:creator>
      <dc:date>2018-03-27T13:58:14Z</dc:date>
    </item>
    <item>
      <title>Re: D3 V4 gallery library implementation with dependencies</title>
      <link>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/D3-V4-gallery-library-implementation-with-dependencies/m-p/384802#M914</link>
      <description>&lt;P&gt;Please visit &lt;A href="https://stackoverflow.com/questions/17493309/how-do-i-change-the-language-of-moment-js" target="_self"&gt;this Stackoverflow &lt;/A&gt;topic to find out more.&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;&lt;SPAN&gt;pbicvsupport@microsoft.com&lt;/SPAN&gt;&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 27 Mar 2018 15:00:30 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/D3-V4-gallery-library-implementation-with-dependencies/m-p/384802#M914</guid>
      <dc:creator>v-viig</dc:creator>
      <dc:date>2018-03-27T15:00:30Z</dc:date>
    </item>
  </channel>
</rss>

