<?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: Auto update custom vizualization in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/Auto-update-custom-vizualization/m-p/2112603#M32195</link>
    <description>&lt;P&gt;Hi &lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/329928"&gt;@filipwydra&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;Thanks for provising your capabilities, but this very much sounds like a common misstep when setting up a D3 visual. Most examples work with a static data set, so don't manage events where the data may change, which is common need with Power BI visuals (as you're experiencing). As I haven't seen your code, I can only assume it's the same, but I'd recommend checking the detail below first.&lt;/P&gt;
&lt;P&gt;If the visual only adds elements for additional data, or works when you refresh, it sounds like you aren't handling data joins with D3 correctly. It sounds like you might just be using .&lt;FONT face="courier new,courier"&gt;enter()&lt;/FONT&gt; to create your elements? If so you should consider adding handlers for &lt;FONT face="courier new,courier"&gt;.update()&lt;/FONT&gt; and .&lt;FONT face="courier new,courier"&gt;exit()&lt;/FONT&gt; so that D3 will re-bind data for already drawn elements and ensure that if elements are not required (e.g. less data in an update) then they are removed from the DOM. By refreshing the visual completely, this is sen by D3 as a new set of data and will only handle &lt;FONT face="courier new,courier"&gt;.enter()&lt;/FONT&gt; events, which is why it re-draws successfully.&lt;/P&gt;
&lt;P&gt;If you haven't seen it, &lt;A href="https://www.d3indepth.com/datajoins/" target="_self"&gt;this article&lt;/A&gt; is really good for explaining the concepts, with simple demos. There is a section &lt;A href="https://www.d3indepth.com/datajoins/#update-functions" target="_self"&gt;dedicated to handling updates&lt;/A&gt; to the data as well, and what is needed for updating the DOM. &lt;A href="https://github.com/dm-p/powerbi-dumbbellChart" target="_self"&gt;I also have a custom visual&lt;/A&gt; for the purposes of teaching the SDK that you can look at and cross-check for an example how I'm managing these events, which may give you some ideas (&lt;A href="https://github.com/dm-p/powerbi-dumbbellChart/blob/18e49ddc8590d80de002b63b7f2eeb1845f46295/src/visual.ts#L109" target="_self"&gt;point where joins are introduced&lt;/A&gt; | &lt;A href="https://github.com/dm-p/powerbi-dumbbellChart/blob/master/src/ChartManager.ts#L149" target="_self"&gt;joins in finished visual&lt;/A&gt;).&lt;/P&gt;
&lt;P&gt;If you're sure that you've wired this up correctly, then it is possible that there may be an issue with how you're binding your data to your viewmodel for updates, but we'd need to see your code to assist further with that (although I'm confident it's the data join issue).&lt;/P&gt;
&lt;P&gt;Good luck,&lt;/P&gt;
&lt;P&gt;Daniel&lt;/P&gt;</description>
    <pubDate>Sun, 03 Oct 2021 19:04:07 GMT</pubDate>
    <dc:creator>dm-p</dc:creator>
    <dc:date>2021-10-03T19:04:07Z</dc:date>
    <item>
      <title>Auto update custom vizualization</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Auto-update-custom-vizualization/m-p/2111185#M32191</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I develop custom Gantt Chart for Power BI using TS and D3.js. I'm facing a problem with re-rendering my visual once I add or modify fields which are meaures. In this case only "Phases" are measures.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I add a new field to Pahses, it only reloads the number of project bars that are non-null. So if, for example, we have 10 lines / 10 projects and we add "Phases", 4 of which are null, only the first 6 lines will be refreshed so that in the remaining 4 milestons will be under the squares.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I reload the visualization manually it works fine. But I want to be updated automatically.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is how it looks like when crashed:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="filipwydra_0-1633106629812.png" style="width: 999px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/604996i0C2BFE95F100FD78/image-size/large?v=v2&amp;amp;px=999" role="button" title="filipwydra_0-1633106629812.png" alt="filipwydra_0-1633106629812.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My "dataroles" and "&lt;SPAN&gt;dataViewMappings" looks like that:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;       "dataRoles": [
        {
            "displayName": "Project Name",
            "name": "yAxis",
            "kind": "Grouping"
        },
        {
            "displayName": "Type Name",
            "name": "typeName",
            "kind": "Grouping"
        },
        {
            "displayName": "Phases",
            "name": "segments",
            "kind": "Measure"
        },
        {
            "displayName": "Milestones - Major",
            "name": "milestonesG1",
            "kind": "Grouping"
            
        },
        {
            "displayName": "Milestones - Regions",
            "name": "milestonesG2",
            "kind": "Grouping"
        },
        {
            "displayName": "Milestones - Market",
            "name": "milestonesG3",
            "kind": "Grouping"
        },
        {
            "displayName": "Business Case Status",
            "name": "businessCaseStatus",
            "kind": "Grouping"
        },
        {
            "displayName": "Images",
            "name": "images",
            "kind": "Grouping"
        }

    ],

 "dataViewMappings": [
        {
            "conditions": [
                {
                    "yAxis": {
                        "max": 1
                    },
                    "typeName": {
                        "max": 1
                    },
                    "businessCaseStatus": {
                        "min": 0,
                        "max": 1
                    },
                    "images": {
                        "min": 0,
                        "max": 1
                    },
                    "segments": {
                        "min": 0,
                        "max": 20
                    }
                }
            ],
            "categorical": {
                "categories": {
                    "select": [
                        { "bind": { "to": "yAxis" } },
                        { "bind": { "to": "typeName" } },
                        { "bind": { "to": "milestonesG1" } },
                        { "bind": { "to": "milestonesG2" } },
                        { "bind": { "to": "milestonesG3" } },
                        { "bind": { "to": "businessCaseStatus" } },
                        { "bind": { "to": "images" } }
                    ]
                },
                "values": {
                    "group": {
                        "by": "typeName",
                        "select": [
                            { "bind": { "to": "segments" } }
                        ]
                    }
                }
            }
        }
    ]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Did you ever face that problem ? Do you have any solution for that ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for all answears and ideas !&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;[UPDATE]&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It's worth to clear the D3 visual when update. To do this use this line of code:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;d3.selectAll("svg &amp;gt; *").remove();&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 15 Oct 2021 10:42:28 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Auto-update-custom-vizualization/m-p/2111185#M32191</guid>
      <dc:creator>filipwydra</dc:creator>
      <dc:date>2021-10-15T10:42:28Z</dc:date>
    </item>
    <item>
      <title>Re: Auto update custom vizualization</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Auto-update-custom-vizualization/m-p/2112603#M32195</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/329928"&gt;@filipwydra&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;Thanks for provising your capabilities, but this very much sounds like a common misstep when setting up a D3 visual. Most examples work with a static data set, so don't manage events where the data may change, which is common need with Power BI visuals (as you're experiencing). As I haven't seen your code, I can only assume it's the same, but I'd recommend checking the detail below first.&lt;/P&gt;
&lt;P&gt;If the visual only adds elements for additional data, or works when you refresh, it sounds like you aren't handling data joins with D3 correctly. It sounds like you might just be using .&lt;FONT face="courier new,courier"&gt;enter()&lt;/FONT&gt; to create your elements? If so you should consider adding handlers for &lt;FONT face="courier new,courier"&gt;.update()&lt;/FONT&gt; and .&lt;FONT face="courier new,courier"&gt;exit()&lt;/FONT&gt; so that D3 will re-bind data for already drawn elements and ensure that if elements are not required (e.g. less data in an update) then they are removed from the DOM. By refreshing the visual completely, this is sen by D3 as a new set of data and will only handle &lt;FONT face="courier new,courier"&gt;.enter()&lt;/FONT&gt; events, which is why it re-draws successfully.&lt;/P&gt;
&lt;P&gt;If you haven't seen it, &lt;A href="https://www.d3indepth.com/datajoins/" target="_self"&gt;this article&lt;/A&gt; is really good for explaining the concepts, with simple demos. There is a section &lt;A href="https://www.d3indepth.com/datajoins/#update-functions" target="_self"&gt;dedicated to handling updates&lt;/A&gt; to the data as well, and what is needed for updating the DOM. &lt;A href="https://github.com/dm-p/powerbi-dumbbellChart" target="_self"&gt;I also have a custom visual&lt;/A&gt; for the purposes of teaching the SDK that you can look at and cross-check for an example how I'm managing these events, which may give you some ideas (&lt;A href="https://github.com/dm-p/powerbi-dumbbellChart/blob/18e49ddc8590d80de002b63b7f2eeb1845f46295/src/visual.ts#L109" target="_self"&gt;point where joins are introduced&lt;/A&gt; | &lt;A href="https://github.com/dm-p/powerbi-dumbbellChart/blob/master/src/ChartManager.ts#L149" target="_self"&gt;joins in finished visual&lt;/A&gt;).&lt;/P&gt;
&lt;P&gt;If you're sure that you've wired this up correctly, then it is possible that there may be an issue with how you're binding your data to your viewmodel for updates, but we'd need to see your code to assist further with that (although I'm confident it's the data join issue).&lt;/P&gt;
&lt;P&gt;Good luck,&lt;/P&gt;
&lt;P&gt;Daniel&lt;/P&gt;</description>
      <pubDate>Sun, 03 Oct 2021 19:04:07 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Auto-update-custom-vizualization/m-p/2112603#M32195</guid>
      <dc:creator>dm-p</dc:creator>
      <dc:date>2021-10-03T19:04:07Z</dc:date>
    </item>
    <item>
      <title>Re: Auto update custom vizualization</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Auto-update-custom-vizualization/m-p/2118231#M32247</link>
      <description>&lt;P&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif"&gt;Hi&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/329928"&gt;@filipwydra&lt;/a&gt;,&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif"&gt;Did&amp;nbsp;dm-p's suggestions help with your scenario? if that is the case, you can consider Kudo or accept this suggestion to help others who faced similar requirements.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif"&gt;If these also don't help, please share more detailed information to help us clarify your scenario to test.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif"&gt;&lt;A href="http://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490" target="_blank"&gt;How to Get Your Question Answered Quickly&amp;nbsp;&lt;/A&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif"&gt;Regards,&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif"&gt;Xiaoxin Sheng&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 06 Oct 2021 07:10:35 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Auto-update-custom-vizualization/m-p/2118231#M32247</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-10-06T07:10:35Z</dc:date>
    </item>
    <item>
      <title>Re: Auto update custom vizualization</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Auto-update-custom-vizualization/m-p/2118548#M32251</link>
      <description>&lt;P&gt;Daniel,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you so much for the tips !&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As you mentioned the problem doesn't come from Power BI implementation but it comes from D3.js. I created three data transformations and milestones are using different dataset than rectangles. I will have to change it and make only one dataset.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks again!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;Filip&lt;/P&gt;</description>
      <pubDate>Wed, 06 Oct 2021 09:09:55 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Auto-update-custom-vizualization/m-p/2118548#M32251</guid>
      <dc:creator>filipwydra</dc:creator>
      <dc:date>2021-10-06T09:09:55Z</dc:date>
    </item>
  </channel>
</rss>

