<?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 to render d3 charts in Power BI currently in Custom Visuals Development Discussion</title>
    <link>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/How-to-render-d3-charts-in-Power-BI-currently/m-p/2343219#M4288</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/24978"&gt;@smpa01&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;As noted on the website, &lt;A href="https://www.html-content.com/reference/limitations#what-doesnt-or-might-partially-work" target="_self"&gt;HTML Content doesn't support JavaScript&lt;/A&gt;.&amp;nbsp;If you want to use D3 to its full potential, I'd suggest creating a custom visual. I have a blog post &lt;A href="https://coacervo.co/examples/d3-line-chart-1" target="_self"&gt;here&lt;/A&gt; (&lt;A href="https://coacervo.co/examples/d3-line-chart-2" target="_self"&gt;pt2&lt;/A&gt;) which may help with converting over existing code to a custom visual.&lt;/P&gt;
&lt;P&gt;For your example, I notice you're only really using the DOM manipulation capabilities of D3 rather than things such as scaling, so you could do your example in HTML Content by writing a measure that creates the SVG elements and binds the data. Assuming your data is in a table called &lt;STRONG&gt;Test&lt;/STRONG&gt;&amp;nbsp;with the same columns as your example:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;SVG Circles = 
VAR Circles =
    CONCATENATEX(
        'Test',
        "&amp;lt;circle cy='60' cx='" &amp;amp; 'Test'[x] &amp;amp; "' r='" &amp;amp; 'Test'[r]
            &amp;amp; "'/&amp;gt;"
    )
RETURN
    "&amp;lt;svg width='350'&amp;gt;" &amp;amp; Circles &amp;amp; "&amp;lt;/svg&amp;gt;"&lt;/LI-CODE&gt;
&lt;P&gt;...which would result in the following output in the visual:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="dmp_0-1645046229747.png" style="width: 999px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/670985i96DB5349AB69CED0/image-size/large?v=v2&amp;amp;px=999" role="button" title="dmp_0-1645046229747.png" alt="dmp_0-1645046229747.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Alternatively, you can use &lt;A href="https://charticulator.com/" target="_self"&gt;Charticulator&lt;/A&gt; or &lt;A href="https://deneb-viz.github.io/" target="_self"&gt;Deneb&lt;/A&gt; to produce richer visual content without the overhead of writing a custom visual from scratch. Neither are D3, but they expose a reasonably broad grammar of graphics, which can be more convenient than coding. Deneb exposes the&amp;nbsp;&lt;A href="https://vega.github.io/vega/docs/" target="_self"&gt;Vega&lt;/A&gt; and &lt;A href="http://vega.github.io/vega-lite/docs/" target="_self"&gt;Vega-Lite&lt;/A&gt; languages (which can do a lot of common D3 use cases with much less code) and has the additional benefit of being certified.&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Daniel&lt;/P&gt;</description>
    <pubDate>Wed, 16 Feb 2022 21:22:11 GMT</pubDate>
    <dc:creator>dm-p</dc:creator>
    <dc:date>2022-02-16T21:22:11Z</dc:date>
    <item>
      <title>How to render d3 charts in Power BI currently</title>
      <link>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/How-to-render-d3-charts-in-Power-BI-currently/m-p/2343116#M4287</link>
      <description>&lt;P&gt;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/397"&gt;@dm-p&lt;/a&gt;&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/17823"&gt;@v-viig&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am trying to find out how can I render a d3.js scripted chart in Power BI&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Sample HTML which works fine in the browser.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;&amp;lt;!DOCTYPE html&amp;gt;
&amp;lt;html lang="en"&amp;gt;

&amp;lt;head&amp;gt;
    &amp;lt;meta charset="UTF-8"&amp;gt;
    &amp;lt;meta http-equiv="X-UA-Compatible" content="IE=edge"&amp;gt;
    &amp;lt;meta name="viewport" content="width=device-width, initial-scale=1.0"&amp;gt;
    &amp;lt;title&amp;gt;D3 Page Template&amp;lt;/title&amp;gt;
    &amp;lt;svg preserveAspectRatio="xMidYMid meet" viewbox="0 0 1280 720"&amp;gt;&amp;lt;/svg&amp;gt;
    &amp;lt;script type="text/javascript" src="https://d3js.org/d3.v7.min.js"&amp;gt;&amp;lt;/script&amp;gt;
&amp;lt;/head&amp;gt;

&amp;lt;body&amp;gt;
    &amp;lt;script&amp;gt;
        const dummyData = [{
            x: 32,
            r: 10
        }, {
            x: 87,
            r: 20
        }, {
            x: 293,
            r: 30
        }];

        var svg = d3.select("svg");

        var circle = svg.selectAll("circle")
            .data(dummyData, function(d) {
                return d;
            });

        circle.enter().append("circle")
            .attr("cy", 60)
            .attr("cx", function(d) {
                return d["x"];
            })
            .attr("r", function(d) {
                return d["r"];
            });

        circle.exit().remove();
    &amp;lt;/script&amp;gt;

&amp;lt;/body&amp;gt;

&amp;lt;/html&amp;gt;&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/397"&gt;@dm-p&lt;/a&gt;&amp;nbsp; can I use&amp;nbsp;&lt;A href="https://www.html-content.com/" target="_self"&gt;HTML Content&lt;/A&gt;&amp;nbsp;to render this? I tried and failed when I used the above as the following measure. if it is possible and I wrote the measure wrongly, would be great if you can please help me out.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Measure = 
"&amp;lt;!DOCTYPE html&amp;gt;
&amp;lt;html lang=""en""&amp;gt;

&amp;lt;head&amp;gt;
    &amp;lt;meta charset=""UTF-8""&amp;gt;
    &amp;lt;meta http-equiv=""X-UA-Compatible"" content=""IE=edge""&amp;gt;
    &amp;lt;meta name=""viewport"" content=""width=device-width, initial-scale=1.0""&amp;gt;
    &amp;lt;title&amp;gt;D3 Page Template&amp;lt;/title&amp;gt;
    &amp;lt;svg preserveAspectRatio=""xMidYMid meet"" viewbox=""0 0 1280 720""&amp;gt;&amp;lt;/svg&amp;gt;
    &amp;lt;script type=""text/javascript"" src=""https://d3js.org/d3.v7.min.js""&amp;gt;&amp;lt;/script&amp;gt;
&amp;lt;/head&amp;gt;

&amp;lt;body&amp;gt;
    &amp;lt;script&amp;gt;
        // Your beautiful D3 code will go here
        const dummyData = [{
            x: 32,
            r: 10
        }, {
            x: 87,
            r: 20
        }, {
            x: 293,
            r: 30
        }];

        var svg = d3.select(""svg"");

        var circle = svg.selectAll(""circle"")
            .data(dummyData, function(d) {
                return d;
            });

        circle.enter().append(""circle"")
            .attr(""cy"", 60)
            .attr(""cx"", function(d) {
                return d[""x""];
            })
            .attr(""r"", function(d) {
                return d[""r""];
            });

        circle.exit().remove();
    &amp;lt;/script&amp;gt;

&amp;lt;/body&amp;gt;

&amp;lt;/html&amp;gt;"&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I know the other alternative is to create d3 powered custom visual which I don't want to do as I can't possibly convert all possible d3 codes into a custom viz.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The other alternative is to use&amp;nbsp;&lt;A href="https://appsource.microsoft.com/en-us/product/power-bi-visuals/WA104381354?tab=Overview" target="_self"&gt;d3PowerBIApp&lt;/A&gt;&amp;nbsp;from the app store and I could not make the above measure to render out there as well.&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/397"&gt;@dm-p&lt;/a&gt;&amp;nbsp;my real preference is to use the HTML content for this purpose if possible.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Thank you in advance.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 16 Feb 2022 20:14:10 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/How-to-render-d3-charts-in-Power-BI-currently/m-p/2343116#M4287</guid>
      <dc:creator>smpa01</dc:creator>
      <dc:date>2022-02-16T20:14:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to render d3 charts in Power BI currently</title>
      <link>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/How-to-render-d3-charts-in-Power-BI-currently/m-p/2343219#M4288</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/24978"&gt;@smpa01&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;As noted on the website, &lt;A href="https://www.html-content.com/reference/limitations#what-doesnt-or-might-partially-work" target="_self"&gt;HTML Content doesn't support JavaScript&lt;/A&gt;.&amp;nbsp;If you want to use D3 to its full potential, I'd suggest creating a custom visual. I have a blog post &lt;A href="https://coacervo.co/examples/d3-line-chart-1" target="_self"&gt;here&lt;/A&gt; (&lt;A href="https://coacervo.co/examples/d3-line-chart-2" target="_self"&gt;pt2&lt;/A&gt;) which may help with converting over existing code to a custom visual.&lt;/P&gt;
&lt;P&gt;For your example, I notice you're only really using the DOM manipulation capabilities of D3 rather than things such as scaling, so you could do your example in HTML Content by writing a measure that creates the SVG elements and binds the data. Assuming your data is in a table called &lt;STRONG&gt;Test&lt;/STRONG&gt;&amp;nbsp;with the same columns as your example:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;SVG Circles = 
VAR Circles =
    CONCATENATEX(
        'Test',
        "&amp;lt;circle cy='60' cx='" &amp;amp; 'Test'[x] &amp;amp; "' r='" &amp;amp; 'Test'[r]
            &amp;amp; "'/&amp;gt;"
    )
RETURN
    "&amp;lt;svg width='350'&amp;gt;" &amp;amp; Circles &amp;amp; "&amp;lt;/svg&amp;gt;"&lt;/LI-CODE&gt;
&lt;P&gt;...which would result in the following output in the visual:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="dmp_0-1645046229747.png" style="width: 999px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/670985i96DB5349AB69CED0/image-size/large?v=v2&amp;amp;px=999" role="button" title="dmp_0-1645046229747.png" alt="dmp_0-1645046229747.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Alternatively, you can use &lt;A href="https://charticulator.com/" target="_self"&gt;Charticulator&lt;/A&gt; or &lt;A href="https://deneb-viz.github.io/" target="_self"&gt;Deneb&lt;/A&gt; to produce richer visual content without the overhead of writing a custom visual from scratch. Neither are D3, but they expose a reasonably broad grammar of graphics, which can be more convenient than coding. Deneb exposes the&amp;nbsp;&lt;A href="https://vega.github.io/vega/docs/" target="_self"&gt;Vega&lt;/A&gt; and &lt;A href="http://vega.github.io/vega-lite/docs/" target="_self"&gt;Vega-Lite&lt;/A&gt; languages (which can do a lot of common D3 use cases with much less code) and has the additional benefit of being certified.&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Daniel&lt;/P&gt;</description>
      <pubDate>Wed, 16 Feb 2022 21:22:11 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/How-to-render-d3-charts-in-Power-BI-currently/m-p/2343219#M4288</guid>
      <dc:creator>dm-p</dc:creator>
      <dc:date>2022-02-16T21:22:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to render d3 charts in Power BI currently</title>
      <link>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/How-to-render-d3-charts-in-Power-BI-currently/m-p/2343227#M4289</link>
      <description>&lt;P&gt;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/397"&gt;@dm-p&lt;/a&gt;&amp;nbsp; thank you very much for your detailed response.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I created a minimally reproducible example to seek your help that could have been rendered with HTML content differently. But that would not always be possible and there is literally no way to avoid javascript/d3 for this kind of advanced visual.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Again, thanks for posting the link as to how to develop custom viz if I choose to convert all my D3 creation (a lot of them currently) to power bi custom viz (not my preferred route; it means creating n X d3 custom viz). I assumed initially that rendering in Power BI would not be an issue before creating them.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I do have one follow up Q for you - I am trying to understand why HTML Content does not have the javascript capability? Does building an app currently prevents a developer to add the js engine to its app? I am simply trying to understand why? Or should I be hopeful of a future where you can add that capability?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Looking forward to hearing from you.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 16 Feb 2022 21:36:42 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/How-to-render-d3-charts-in-Power-BI-currently/m-p/2343227#M4289</guid>
      <dc:creator>smpa01</dc:creator>
      <dc:date>2022-02-16T21:36:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to render d3 charts in Power BI currently</title>
      <link>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/How-to-render-d3-charts-in-Power-BI-currently/m-p/2343235#M4290</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/24978"&gt;@smpa01&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;The HTML Content visual could potentially support JS but I don't feel that there would be an easy way to support features that can help creators with debugging code without a significant amount of work. The custom visual sandbox also has a lot of limitations so it would be very hard to identify, support and document all the known issues with JS.&lt;/P&gt;
&lt;P&gt;As I develop my visuals in my free time and support them free of charge, this is something I don't have the bandwidth for so I will not be looking at adding this. You may be better approaching one of the other HTML visual vendors (Nova Silva or K-Team) to see if they have capacity to add support for JS in their versions.&lt;/P&gt;
&lt;P&gt;You're of course welcome to fork HTML Content and add your own support for JS. You'd just need to change the visual GUID so that Power BI doesn't load my version from AppSource when you add your version to your reports.&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Daniel&lt;/P&gt;</description>
      <pubDate>Wed, 16 Feb 2022 21:46:47 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/How-to-render-d3-charts-in-Power-BI-currently/m-p/2343235#M4290</guid>
      <dc:creator>dm-p</dc:creator>
      <dc:date>2022-02-16T21:46:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to render d3 charts in Power BI currently</title>
      <link>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/How-to-render-d3-charts-in-Power-BI-currently/m-p/2343240#M4291</link>
      <description>&lt;P&gt;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/397"&gt;@dm-p&lt;/a&gt;&amp;nbsp; many thanks !!!&lt;/P&gt;</description>
      <pubDate>Wed, 16 Feb 2022 21:50:45 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/How-to-render-d3-charts-in-Power-BI-currently/m-p/2343240#M4291</guid>
      <dc:creator>smpa01</dc:creator>
      <dc:date>2022-02-16T21:50:45Z</dc:date>
    </item>
  </channel>
</rss>

