<?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 Attributes are not getting applied after enter() using D3 in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/Attributes-are-not-getting-applied-after-enter-using-D3/m-p/970756#M22660</link>
    <description>&lt;P&gt;I am following the video tutorial:&amp;nbsp;&lt;A href="https://channel9.msdn.com/Blogs/Azure/Building-Power-BI-custom-visuals-that-meet-your-app-needs" target="_self"&gt;https://channel9.msdn.com/Blogs/Azure/Building-Power-BI-custom-visuals-that-meet-your-app-needs&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The update method is below:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;public update(options: VisualUpdateOptions) {
        console.log('update called');
        let width = options.viewport.width;
        let height = options.viewport.height;

        // other code

        let viewModel: ViewModel = {
            dataPoints: testData,
            dataMax: d3.max(testData.map((dataPoint) =&amp;gt; dataPoint.value))
        };

        // other code

        let bars = this.barContainer.selectAll('.bar').data(viewModel.dataPoints);

        console.log('xScale bandwidth: ', xScale.bandwidth());

        bars.enter().append('rect').classed('bar', true);

        bars
            .attr('width', xScale.bandwidth())
            .attr('height', d =&amp;gt; height - yScale(d.value))
            .attr('y', d =&amp;gt; yScale(d.value))
            .attr('x', d =&amp;gt; xScale(d.category));

        bars.exit().remove();
    }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;The above video tutorial is for creating a bar chart. When I run the code I do not see anything. But when I resize the visual the bar chart is showing up.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I noticed that, the .attr() function is not working in the initial load.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;After that I changed the code to:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;bars.enter().append('rect').classed('bar', true)
        .attr('width', xScale.bandwidth())
        .attr('height', d =&amp;gt; height - yScale(d.value))
        .attr('y', d =&amp;gt; yScale(d.value))
        .attr('x', d =&amp;gt; xScale(d.category));

    bars
        .attr('width', xScale.bandwidth())
        .attr('height', d =&amp;gt; height - yScale(d.value))
        .attr('y', d =&amp;gt; yScale(d.value))
        .attr('x', d =&amp;gt; xScale(d.category));&lt;/LI-CODE&gt;&lt;P&gt;The above code is working for initial load and also on resizing the visual. Resizing the visual is working because of the second line.&amp;nbsp;&lt;/P&gt;&lt;P&gt;So its causing the code to be &lt;STRONG&gt;duplicated&lt;/STRONG&gt; which I do not see in the video tutorial above.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Did anyone experience the same problem? Or is this the way it is supposed to work in the latest version?&lt;/P&gt;&lt;P class="ics-element-donot-delete 1001_CC@"&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 12 Mar 2020 11:25:09 GMT</pubDate>
    <dc:creator>hari_krishnan</dc:creator>
    <dc:date>2020-03-12T11:25:09Z</dc:date>
    <item>
      <title>Attributes are not getting applied after enter() using D3</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Attributes-are-not-getting-applied-after-enter-using-D3/m-p/970756#M22660</link>
      <description>&lt;P&gt;I am following the video tutorial:&amp;nbsp;&lt;A href="https://channel9.msdn.com/Blogs/Azure/Building-Power-BI-custom-visuals-that-meet-your-app-needs" target="_self"&gt;https://channel9.msdn.com/Blogs/Azure/Building-Power-BI-custom-visuals-that-meet-your-app-needs&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The update method is below:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;public update(options: VisualUpdateOptions) {
        console.log('update called');
        let width = options.viewport.width;
        let height = options.viewport.height;

        // other code

        let viewModel: ViewModel = {
            dataPoints: testData,
            dataMax: d3.max(testData.map((dataPoint) =&amp;gt; dataPoint.value))
        };

        // other code

        let bars = this.barContainer.selectAll('.bar').data(viewModel.dataPoints);

        console.log('xScale bandwidth: ', xScale.bandwidth());

        bars.enter().append('rect').classed('bar', true);

        bars
            .attr('width', xScale.bandwidth())
            .attr('height', d =&amp;gt; height - yScale(d.value))
            .attr('y', d =&amp;gt; yScale(d.value))
            .attr('x', d =&amp;gt; xScale(d.category));

        bars.exit().remove();
    }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;The above video tutorial is for creating a bar chart. When I run the code I do not see anything. But when I resize the visual the bar chart is showing up.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I noticed that, the .attr() function is not working in the initial load.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;After that I changed the code to:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;bars.enter().append('rect').classed('bar', true)
        .attr('width', xScale.bandwidth())
        .attr('height', d =&amp;gt; height - yScale(d.value))
        .attr('y', d =&amp;gt; yScale(d.value))
        .attr('x', d =&amp;gt; xScale(d.category));

    bars
        .attr('width', xScale.bandwidth())
        .attr('height', d =&amp;gt; height - yScale(d.value))
        .attr('y', d =&amp;gt; yScale(d.value))
        .attr('x', d =&amp;gt; xScale(d.category));&lt;/LI-CODE&gt;&lt;P&gt;The above code is working for initial load and also on resizing the visual. Resizing the visual is working because of the second line.&amp;nbsp;&lt;/P&gt;&lt;P&gt;So its causing the code to be &lt;STRONG&gt;duplicated&lt;/STRONG&gt; which I do not see in the video tutorial above.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Did anyone experience the same problem? Or is this the way it is supposed to work in the latest version?&lt;/P&gt;&lt;P class="ics-element-donot-delete 1001_CC@"&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Mar 2020 11:25:09 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Attributes-are-not-getting-applied-after-enter-using-D3/m-p/970756#M22660</guid>
      <dc:creator>hari_krishnan</dc:creator>
      <dc:date>2020-03-12T11:25:09Z</dc:date>
    </item>
  </channel>
</rss>

