<?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: How does D3 Object function pbi.dsv work? JavaScript colon functions in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/How-does-D3-Object-function-pbi-dsv-work-JavaScript-colon/m-p/381418#M11330</link>
    <description>&lt;P&gt;The dsv function will execute&amp;nbsp;&lt;STRONG&gt;accessor&lt;/STRONG&gt; first for each item of original &lt;STRONG&gt;data&lt;/STRONG&gt; array.&lt;/P&gt;
&lt;P&gt;After that, the&amp;nbsp;&lt;STRONG&gt;callback&amp;nbsp;&lt;/STRONG&gt;will be executed. The&amp;nbsp;&lt;STRONG&gt;callback&lt;/STRONG&gt; will receive the data array.&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;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 22 Mar 2018 08:05:49 GMT</pubDate>
    <dc:creator>v-viig</dc:creator>
    <dc:date>2018-03-22T08:05:49Z</dc:date>
    <item>
      <title>How does D3 Object function pbi.dsv work? JavaScript colon functions</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/How-does-D3-Object-function-pbi-dsv-work-JavaScript-colon/m-p/380998#M11314</link>
      <description>&lt;P&gt;Im struggling to understand the following code because i dont know which function sends/gets which paramaters from where and why:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;pbi.dsv ( &lt;BR /&gt;&lt;BR /&gt;  function(letters) {
    x.domain(letters.map(function(d) { return d.letter; }));
    y.domain([0, d3.max(letters, function(d) { return d.frequency; })]);
    svg.append("g")&lt;BR /&gt;       ...
  }&lt;BR /&gt;&lt;BR /&gt;);&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The object:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;var pbi = {&lt;BR /&gt;
   width:1200,
   ... ,

dsv:function(accessor, callback) {&lt;BR /&gt;
    data = [ ... ];

    if (arguments.length &amp;gt; 2) {
        callback=accessor,accessor = null;
    } else {
        data = data.map(function(d) {return accessor(d)});
    }
    callback(data);
}

}&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So which function is called first?&lt;/P&gt;&lt;P&gt;I know that &lt;STRONG&gt;pbi.dsv(...)&lt;/STRONG&gt; calls the function from the object pbi.&lt;STRONG&gt;dsv:function (accessor, callback) { ... }&amp;nbsp;&lt;/STRONG&gt;and also retrieves the data from it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But from where the parameters &lt;STRONG&gt;accessor and callback &lt;/STRONG&gt;are filled?&amp;nbsp;Does it get the data from PowerBI itself?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What exactly happens in this step.&amp;nbsp;&lt;SPAN&gt;Which data fills the variable&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;letters&lt;/STRONG&gt;&lt;SPAN&gt;? Is it the result of pbi.&lt;STRONG&gt;dsv:function (accessor, callback) { ... }&lt;/STRONG&gt;?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;pbi.dsv(function(letters) { ... });&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I couldnt find any documentation which explains this kind of functions to me and how they exactly work. I only understand that this would for example show an alert with the message "Hello". But still doesnt get how they work when parameters are filled inside the functions head.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;var obj = {
    test: function() {
        alert('Hello');
    }
};

obj.test();&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would thank You very much if you can explain me the syntax or a good website which explains it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Mar 2018 16:21:23 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/How-does-D3-Object-function-pbi-dsv-work-JavaScript-colon/m-p/380998#M11314</guid>
      <dc:creator>az2451</dc:creator>
      <dc:date>2018-03-21T16:21:23Z</dc:date>
    </item>
    <item>
      <title>Re: How does D3 Object function pbi.dsv work? JavaScript colon functions</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/How-does-D3-Object-function-pbi-dsv-work-JavaScript-colon/m-p/381418#M11330</link>
      <description>&lt;P&gt;The dsv function will execute&amp;nbsp;&lt;STRONG&gt;accessor&lt;/STRONG&gt; first for each item of original &lt;STRONG&gt;data&lt;/STRONG&gt; array.&lt;/P&gt;
&lt;P&gt;After that, the&amp;nbsp;&lt;STRONG&gt;callback&amp;nbsp;&lt;/STRONG&gt;will be executed. The&amp;nbsp;&lt;STRONG&gt;callback&lt;/STRONG&gt; will receive the data array.&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;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 22 Mar 2018 08:05:49 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/How-does-D3-Object-function-pbi-dsv-work-JavaScript-colon/m-p/381418#M11330</guid>
      <dc:creator>v-viig</dc:creator>
      <dc:date>2018-03-22T08:05:49Z</dc:date>
    </item>
  </channel>
</rss>

