<?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 Creating a Pie chart visual with Static Data. in Custom Visuals Development Discussion</title>
    <link>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/Creating-a-Pie-chart-visual-with-Static-Data/m-p/275425#M324</link>
    <description>&lt;P&gt;&lt;SPAN&gt;Hi guys. I'm trying to create a pie chart power Bi visual for practicing custom visual creation.I have followed the tutorial given in the github repo for the environment setup and now is currently on the first step , ie creating visual with static data.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The visual is being built and served correctly.But when I insert the visual in the powerBi service,all i get is a blank&amp;nbsp; screen.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Can someone help? I'm new to d3 and TypeScript, so there may be a chance that I may have made some silly mistakes.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Here's my code:&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;module powerbi.extensibility.visual {
    "use strict";

    interface Data 
    {        
    quantity: number;
    category: string;
    }

    export class PieChart implements IVisual {
        private target: HTMLElement;        
        private settings: VisualSettings;
        private textNode: Text;
        private pieChartContainer:d3.Selection&amp;lt;SVGElement&amp;gt;;
        private arc:any;
        private host:IVisualHost;
        private svg:d3.Selection&amp;lt;SVGElement&amp;gt;;
        private g:any;
        private pie:any;
        private color:string;

        constructor(options: VisualConstructorOptions) {
            console.log('Visual constructor', options);
            this.target = options.element;
            this.host=options.host;
            let svg=this.svg=d3.select(options.element)
                                .append('svg')
                                .classed("pieChart",true);
            this.pieChartContainer=svg.append('g').classed('pieChartContainer',true);                        
        }


        public update(options: VisualUpdateOptions) {
            this.settings = PieChart.parseSettings(options &amp;amp;&amp;amp; options.dataViews &amp;amp;&amp;amp; options.dataViews[0]);
            let testData: Data[] = [
                {
                    quantity: 25,
                    category: 'a'
                },
                {
                    quantity: 50,
                    category: 'b'
                },
                {
                    quantity: 100,
                    category: 'c'
                },
                {
                    quantity: 200,
                    category: 'd'
                },
                {
                    quantity: 300,
                    category: 'e'
                }];
          
            let width=options.viewport.width;
            let height=options.viewport.height;
            let radius=Math.min(width,height)/2;
            this.svg.attr({
                width:width,
                height:height,
            });
            let colourValues = d3.scale.category20c();
            this.arc=d3.svg.arc()
            .innerRadius(0)
            .outerRadius(radius-20);
            this.pie = d3.layout.pie&amp;lt;Data&amp;gt;().value((d: Data):number =&amp;gt; d.quantity);
            let fill = (d=&amp;gt; colourValues(d.category));
            let tf   =  d =&amp;gt; `translate(${this.arc.centroid(d)})`;
            let text = d =&amp;gt; d.data.category;
            this.svg.append('g')
            .attr('transform', 'translate(' + width / 2 + ',' + height / 2 + ')');
            this.g=this.svg.selectAll('.arc')
                    .data(this.pie(testData))
                    .enter()
                    .append('g')
                    .attr('class', 'arc')
                    .data(this.pie(testData));

            this.g.append('path')
                    .attr('d', this.arc)
                    .attr('fill', fill)
                    .style("stroke","black")
                    .style("stroke-width","0.8")
                    .on("mouseover",d=&amp;gt;
                     {
                                            
                    d3.select(d)
                    .attr('fill','blue')
                    .style('opacity','0.6')
                    .attr('d',this.arc)
                    .style("stroke","black")
                    .style("stroke-width","3");
                    
                    this.color=d.getAttribute('fill');

                     })
                    
                    .on("mouseout",d=&amp;gt;
                     {   
                    d3.select(d)
                    .attr('fill',colourValues(this.color))
                    .style("opacity","1")
                    .attr('d',this.arc)
                    .style("stroke-width","0.8");
                   
                    
                    }).append("svg:title");
                    //.html(d=&amp;gt;'&amp;lt;p&amp;gt;Quantity :'+d=&amp;gt;d. + '&amp;lt;/p&amp;gt;');           
                    this.g.append('text').attr('transform', tf).text(text);
        }


        private static parseSettings(dataView: DataView): VisualSettings {
            return VisualSettings.parse(dataView) as VisualSettings;
        }

        /** 
         * This function gets called for each of the objects defined in the capabilities files and allows you to select which of the 
         * objects and properties you want to expose to the users in the property pane.
         * 
         */
        public enumerateObjectInstances(options: EnumerateVisualObjectInstancesOptions): VisualObjectInstance[] | VisualObjectInstanceEnumerationObject {
            return VisualSettings.enumerateObjectInstances(this.settings || VisualSettings.getDefault(), options);
        }
    }
}&lt;/PRE&gt;</description>
    <pubDate>Wed, 11 Oct 2017 03:55:38 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2017-10-11T03:55:38Z</dc:date>
    <item>
      <title>Creating a Pie chart visual with Static Data.</title>
      <link>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/Creating-a-Pie-chart-visual-with-Static-Data/m-p/275425#M324</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Hi guys. I'm trying to create a pie chart power Bi visual for practicing custom visual creation.I have followed the tutorial given in the github repo for the environment setup and now is currently on the first step , ie creating visual with static data.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The visual is being built and served correctly.But when I insert the visual in the powerBi service,all i get is a blank&amp;nbsp; screen.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Can someone help? I'm new to d3 and TypeScript, so there may be a chance that I may have made some silly mistakes.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Here's my code:&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;module powerbi.extensibility.visual {
    "use strict";

    interface Data 
    {        
    quantity: number;
    category: string;
    }

    export class PieChart implements IVisual {
        private target: HTMLElement;        
        private settings: VisualSettings;
        private textNode: Text;
        private pieChartContainer:d3.Selection&amp;lt;SVGElement&amp;gt;;
        private arc:any;
        private host:IVisualHost;
        private svg:d3.Selection&amp;lt;SVGElement&amp;gt;;
        private g:any;
        private pie:any;
        private color:string;

        constructor(options: VisualConstructorOptions) {
            console.log('Visual constructor', options);
            this.target = options.element;
            this.host=options.host;
            let svg=this.svg=d3.select(options.element)
                                .append('svg')
                                .classed("pieChart",true);
            this.pieChartContainer=svg.append('g').classed('pieChartContainer',true);                        
        }


        public update(options: VisualUpdateOptions) {
            this.settings = PieChart.parseSettings(options &amp;amp;&amp;amp; options.dataViews &amp;amp;&amp;amp; options.dataViews[0]);
            let testData: Data[] = [
                {
                    quantity: 25,
                    category: 'a'
                },
                {
                    quantity: 50,
                    category: 'b'
                },
                {
                    quantity: 100,
                    category: 'c'
                },
                {
                    quantity: 200,
                    category: 'd'
                },
                {
                    quantity: 300,
                    category: 'e'
                }];
          
            let width=options.viewport.width;
            let height=options.viewport.height;
            let radius=Math.min(width,height)/2;
            this.svg.attr({
                width:width,
                height:height,
            });
            let colourValues = d3.scale.category20c();
            this.arc=d3.svg.arc()
            .innerRadius(0)
            .outerRadius(radius-20);
            this.pie = d3.layout.pie&amp;lt;Data&amp;gt;().value((d: Data):number =&amp;gt; d.quantity);
            let fill = (d=&amp;gt; colourValues(d.category));
            let tf   =  d =&amp;gt; `translate(${this.arc.centroid(d)})`;
            let text = d =&amp;gt; d.data.category;
            this.svg.append('g')
            .attr('transform', 'translate(' + width / 2 + ',' + height / 2 + ')');
            this.g=this.svg.selectAll('.arc')
                    .data(this.pie(testData))
                    .enter()
                    .append('g')
                    .attr('class', 'arc')
                    .data(this.pie(testData));

            this.g.append('path')
                    .attr('d', this.arc)
                    .attr('fill', fill)
                    .style("stroke","black")
                    .style("stroke-width","0.8")
                    .on("mouseover",d=&amp;gt;
                     {
                                            
                    d3.select(d)
                    .attr('fill','blue')
                    .style('opacity','0.6')
                    .attr('d',this.arc)
                    .style("stroke","black")
                    .style("stroke-width","3");
                    
                    this.color=d.getAttribute('fill');

                     })
                    
                    .on("mouseout",d=&amp;gt;
                     {   
                    d3.select(d)
                    .attr('fill',colourValues(this.color))
                    .style("opacity","1")
                    .attr('d',this.arc)
                    .style("stroke-width","0.8");
                   
                    
                    }).append("svg:title");
                    //.html(d=&amp;gt;'&amp;lt;p&amp;gt;Quantity :'+d=&amp;gt;d. + '&amp;lt;/p&amp;gt;');           
                    this.g.append('text').attr('transform', tf).text(text);
        }


        private static parseSettings(dataView: DataView): VisualSettings {
            return VisualSettings.parse(dataView) as VisualSettings;
        }

        /** 
         * This function gets called for each of the objects defined in the capabilities files and allows you to select which of the 
         * objects and properties you want to expose to the users in the property pane.
         * 
         */
        public enumerateObjectInstances(options: EnumerateVisualObjectInstancesOptions): VisualObjectInstance[] | VisualObjectInstanceEnumerationObject {
            return VisualSettings.enumerateObjectInstances(this.settings || VisualSettings.getDefault(), options);
        }
    }
}&lt;/PRE&gt;</description>
      <pubDate>Wed, 11 Oct 2017 03:55:38 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/Creating-a-Pie-chart-visual-with-Static-Data/m-p/275425#M324</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-10-11T03:55:38Z</dc:date>
    </item>
    <item>
      <title>creating custom visual</title>
      <link>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/Creating-a-Pie-chart-visual-with-Static-Data/m-p/274386#M328</link>
      <description>&lt;P&gt;Hi guys. I'm trying to create a pie chart power Bi visual for practicing custom visual creation.I have followed the tutorial given in the github repo for the environment setup and now is currently on the first step , ie creating visual with static data.&lt;BR /&gt;&lt;BR /&gt;The visual is being built and served correctly.But when I insert the visual in the powerBi service,all i get is a blank&amp;nbsp; screen.&lt;BR /&gt;Can someone help? I'm new to d3 and TypeScript, so there may be a chance that I may have made some silly mistakes.&lt;BR /&gt;Here's my code:&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;module powerbi.extensibility.visual {
    "use strict";

    interface Data 
    {        
    quantity: number;
    category: string;
    }

    export class PieChart implements IVisual {
        private target: HTMLElement;        
        private settings: VisualSettings;
        private textNode: Text;
        private pieChartContainer:d3.Selection&amp;lt;SVGElement&amp;gt;;
        private arc:any;
        private host:IVisualHost;
        private svg:d3.Selection&amp;lt;SVGElement&amp;gt;;
        private g:any;
        private pie:any;
        private color:string;

        constructor(options: VisualConstructorOptions) {
            console.log('Visual constructor', options);
            this.target = options.element;
            this.host=options.host;
            let svg=this.svg=d3.select(options.element)
                                .append('svg')
                                .classed("pieChart",true);
            this.pieChartContainer=svg.append('g').classed('pieChartContainer',true);                        
        }


        public update(options: VisualUpdateOptions) {
            this.settings = PieChart.parseSettings(options &amp;amp;&amp;amp; options.dataViews &amp;amp;&amp;amp; options.dataViews[0]);
            let testData: Data[] = [
                {
                    quantity: 25,
                    category: 'a'
                },
                {
                    quantity: 50,
                    category: 'b'
                },
                {
                    quantity: 100,
                    category: 'c'
                },
                {
                    quantity: 200,
                    category: 'd'
                },
                {
                    quantity: 300,
                    category: 'e'
                }];
          
            let width=options.viewport.width;
            let height=options.viewport.height;
            let radius=Math.min(width,height)/2;
            this.svg.attr({
                width:width,
                height:height,
            });
            let colourValues = d3.scale.category20c();
            this.arc=d3.svg.arc()
            .innerRadius(0)
            .outerRadius(radius-20);
            this.pie = d3.layout.pie&amp;lt;Data&amp;gt;().value((d: Data):number =&amp;gt; d.quantity);
            let fill = (d=&amp;gt; colourValues(d.category));
            let tf   =  d =&amp;gt; `translate(${this.arc.centroid(d)})`;
            let text = d =&amp;gt; d.data.category;
            this.svg.append('g')
            .attr('transform', 'translate(' + width / 2 + ',' + height / 2 + ')');
            this.g=this.svg.selectAll('.arc')
                    .data(this.pie(testData))
                    .enter()
                    .append('g')
                    .attr('class', 'arc')
                    .data(this.pie(testData));

            this.g.append('path')
                    .attr('d', this.arc)
                    .attr('fill', fill)
                    .style("stroke","black")
                    .style("stroke-width","0.8")
                    .on("mouseover",d=&amp;gt;
                     {
                                            
                    d3.select(d)
                    .attr('fill','blue')
                    .style('opacity','0.6')
                    .attr('d',this.arc)
                    .style("stroke","black")
                    .style("stroke-width","3");
                    
                    this.color=d.getAttribute('fill');

                     })
                    
                    .on("mouseout",d=&amp;gt;
                     {   
                    d3.select(d)
                    .attr('fill',colourValues(this.color))
                    .style("opacity","1")
                    .attr('d',this.arc)
                    .style("stroke-width","0.8");
                   
                    
                    }).append("svg:title");
                    //.html(d=&amp;gt;'&amp;lt;p&amp;gt;Quantity :'+d=&amp;gt;d. + '&amp;lt;/p&amp;gt;');           
                    this.g.append('text').attr('transform', tf).text(text);
        }


        private static parseSettings(dataView: DataView): VisualSettings {
            return VisualSettings.parse(dataView) as VisualSettings;
        }

        /** 
         * This function gets called for each of the objects defined in the capabilities files and allows you to select which of the 
         * objects and properties you want to expose to the users in the property pane.
         * 
         */
        public enumerateObjectInstances(options: EnumerateVisualObjectInstancesOptions): VisualObjectInstance[] | VisualObjectInstanceEnumerationObject {
            return VisualSettings.enumerateObjectInstances(this.settings || VisualSettings.getDefault(), options);
        }
    }
}&lt;/PRE&gt;</description>
      <pubDate>Tue, 10 Oct 2017 12:53:58 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/Creating-a-Pie-chart-visual-with-Static-Data/m-p/274386#M328</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-10-10T12:53:58Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a Pie chart visual with Static Data.</title>
      <link>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/Creating-a-Pie-chart-visual-with-Static-Data/m-p/275783#M326</link>
      <description>&lt;P&gt;Hello&amp;nbsp;@Anonymous&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm wondering if you can clarify these items:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Did you install d3 by executing &lt;STRONG&gt;npm i d3@3.5.5 --save&lt;/STRONG&gt;?&lt;/LI&gt;&lt;LI&gt;Did you include d3 into &lt;STRONG&gt;externalJS&lt;/STRONG&gt; property of pbiviz.json? (&lt;A href="https://github.com/Microsoft/powerbi-visuals-pulsechart/blob/master/pbiviz.json#L22" target="_blank"&gt;example&lt;/A&gt;)&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Ignat Vilesov,&lt;/P&gt;&lt;P&gt;Software Engineer&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Microsoft Power BI Custom Visuals&lt;/P&gt;&lt;P&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>Wed, 11 Oct 2017 09:14:47 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/Creating-a-Pie-chart-visual-with-Static-Data/m-p/275783#M326</guid>
      <dc:creator>v-viig</dc:creator>
      <dc:date>2017-10-11T09:14:47Z</dc:date>
    </item>
    <item>
      <title>Re: creating custom visual</title>
      <link>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/Creating-a-Pie-chart-visual-with-Static-Data/m-p/275788#M329</link>
      <description>&lt;P&gt;This topic is duplicate of &lt;A href="https://community.powerbi.com/t5/Custom-Visuals-Development/Creating-a-Pie-chart-visual-with-Static-Data/m-p/275425#M324" target="_blank"&gt;that&amp;nbsp;one&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Ignat Vilesov,&lt;/P&gt;&lt;P&gt;Software Engineer&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Microsoft Power BI Custom Visuals&lt;/P&gt;&lt;P&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>Wed, 11 Oct 2017 09:18:23 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/Creating-a-Pie-chart-visual-with-Static-Data/m-p/275788#M329</guid>
      <dc:creator>v-viig</dc:creator>
      <dc:date>2017-10-11T09:18:23Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a Pie chart visual with Static Data.</title>
      <link>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/Creating-a-Pie-chart-visual-with-Static-Data/m-p/275789#M327</link>
      <description>&lt;P&gt;I'm using d3 3.5.17 and yes, i have included it into externalJS property.&lt;/P&gt;</description>
      <pubDate>Wed, 11 Oct 2017 09:19:35 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/Creating-a-Pie-chart-visual-with-Static-Data/m-p/275789#M327</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-10-11T09:19:35Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a Pie chart visual with Static Data.</title>
      <link>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/Creating-a-Pie-chart-visual-with-Static-Data/m-p/275830#M330</link>
      <description>&lt;P&gt;Your code actually works for me:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image.png" style="width: 600px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/64110iF782DBE81C505F68/image-size/large?v=v2&amp;amp;px=999" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, Pie chart is misplaced. I suppose that you should apply CSS transform-translate to fix position issue.&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Ignat Vilesov,&lt;/P&gt;&lt;P&gt;Software Engineer&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Microsoft Power BI Custom Visuals&lt;/P&gt;&lt;P&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>Wed, 11 Oct 2017 09:54:34 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/Creating-a-Pie-chart-visual-with-Static-Data/m-p/275830#M330</guid>
      <dc:creator>v-viig</dc:creator>
      <dc:date>2017-10-11T09:54:34Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a Pie chart visual with Static Data.</title>
      <link>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/Creating-a-Pie-chart-visual-with-Static-Data/m-p/275866#M331</link>
      <description>&lt;P&gt;Could you please share your &lt;EM&gt;.json&lt;/EM&gt; files?&lt;BR /&gt;Did you make any change to my code?&lt;BR /&gt;&lt;BR /&gt;Is there a need to fill the data fields when using static data?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank You&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Vishnu Suresh&lt;/P&gt;</description>
      <pubDate>Wed, 11 Oct 2017 10:17:07 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/Creating-a-Pie-chart-visual-with-Static-Data/m-p/275866#M331</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-10-11T10:17:07Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a Pie chart visual with Static Data.</title>
      <link>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/Creating-a-Pie-chart-visual-with-Static-Data/m-p/276677#M336</link>
      <description>&lt;P&gt;I got it. Thank you for your patience.&lt;BR /&gt;By the way,which element should be given the transform-translate style?&lt;BR /&gt;I added it as a attribute for &lt;EM&gt;svg ,&lt;/EM&gt;but no use&lt;EM&gt;.&lt;/EM&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Oct 2017 07:08:03 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/Creating-a-Pie-chart-visual-with-Static-Data/m-p/276677#M336</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-10-12T07:08:03Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a Pie chart visual with Static Data.</title>
      <link>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/Creating-a-Pie-chart-visual-with-Static-Data/m-p/276791#M339</link>
      <description>&lt;P&gt;Please take a look at this fixed version:&lt;/P&gt;&lt;PRE&gt;module powerbi.extensibility.visual {
    "use strict";

    interface Data {
        quantity: number;
        category: string;
    }

    export class PieChart implements IVisual {
        private target: HTMLElement;
        private settings: VisualSettings;
        private textNode: Text;
        private pieChartContainer: d3.Selection&amp;lt;SVGElement&amp;gt;;
        private arc: any;
        private host: IVisualHost;
        private svg: d3.Selection&amp;lt;SVGElement&amp;gt;;
        private g: any;
        private pie: any;
        private color: string;

        constructor(options: VisualConstructorOptions) {
            debugger;
            console.log('Visual constructor', options);
            this.target = options.element;
            this.host = options.host;
            let svg = this.svg = d3.select(options.element)
                .append('svg')
                .classed("pieChart", true);

            this.pieChartContainer = svg
                .append('g')
                .classed('pieChartContainer', true);
        }


        public update(options: VisualUpdateOptions) {
            console.log(options);

            this.settings = PieChart.parseSettings(options &amp;amp;&amp;amp; options.dataViews &amp;amp;&amp;amp; options.dataViews[0]);
            let testData: Data[] = [
                {
                    quantity: 25,
                    category: 'a'
                },
                {
                    quantity: 50,
                    category: 'b'
                },
                {
                    quantity: 100,
                    category: 'c'
                },
                {
                    quantity: 200,
                    category: 'd'
                },
                {
                    quantity: 300,
                    category: 'e'
                }];

            let width = options.viewport.width;
            let height = options.viewport.height;
            let radius = Math.min(width, height) / 2;

            this.svg.attr({
                width: width,
                height: height,
            });

            let colourValues = d3.scale.category20c();

            this.arc = d3.svg.arc()
                .innerRadius(0)
                .outerRadius(radius - 20);
            this.pie = d3.layout.pie&amp;lt;Data&amp;gt;().value((d: Data): number =&amp;gt; d.quantity);
            let fill = (d =&amp;gt; colourValues(d.category));
            let tf = d =&amp;gt; `translate(${this.arc.centroid(d)})`;
            let text = d =&amp;gt; d.data.category;

            this.pieChartContainer.attr('transform', 'translate(' + width / 2 + ',' + height / 2 + ')');


            this.g = this.pieChartContainer.selectAll('.arc')
                .data(this.pie(testData))
                .enter()
                .append('g')
                .attr('class', 'arc')
                .data(this.pie(testData));

            this.g.append('path')
                .attr('d', this.arc)
                .attr('fill', fill)
                .style("stroke", "black")
                .style("stroke-width", "0.8")
                .on("mouseover", d =&amp;gt; {

                    d3.select(d)
                        .attr('fill', 'blue')
                        .style('opacity', '0.6')
                        .attr('d', this.arc)
                        .style("stroke", "black")
                        .style("stroke-width", "3");

                    this.color = d.getAttribute('fill');

                })

                .on("mouseout", d =&amp;gt; {
                    d3.select(d)
                        .attr('fill', colourValues(this.color))
                        .style("opacity", "1")
                        .attr('d', this.arc)
                        .style("stroke-width", "0.8");


                }).append("svg:title");
            //.html(d=&amp;gt;'&amp;lt;p&amp;gt;Quantity :'+d=&amp;gt;d. + '&amp;lt;/p&amp;gt;');           
            this.g.append('text').attr('transform', tf).text(text);
        }


        private static parseSettings(dataView: DataView): VisualSettings {
            return VisualSettings.parse(dataView) as VisualSettings;
        }

        /** 
         * This function gets called for each of the objects defined in the capabilities files and allows you to select which of the 
         * objects and properties you want to expose to the users in the property pane.
         * 
         */
        public enumerateObjectInstances(options: EnumerateVisualObjectInstancesOptions): VisualObjectInstance[] | VisualObjectInstanceEnumerationObject {
            return VisualSettings.enumerateObjectInstances(this.settings || VisualSettings.getDefault(), options);
        }
    }
}&lt;/PRE&gt;&lt;P&gt;Ignat Vilesov,&lt;/P&gt;&lt;P&gt;Software Engineer&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Microsoft Power BI Custom Visuals&lt;/P&gt;&lt;P&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>Thu, 12 Oct 2017 08:11:16 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/Creating-a-Pie-chart-visual-with-Static-Data/m-p/276791#M339</guid>
      <dc:creator>v-viig</dc:creator>
      <dc:date>2017-10-12T08:11:16Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a Pie chart visual with Static Data.</title>
      <link>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/Creating-a-Pie-chart-visual-with-Static-Data/m-p/276820#M340</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/17823"&gt;@v-viig&lt;/a&gt;.&lt;BR /&gt;And consider this as a Humble request from my side, Please consider improving the current documentation for creating custom visuals. Beginners like me struggle a lot following the current documentation.&lt;/P&gt;</description>
      <pubDate>Thu, 12 Oct 2017 08:30:19 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/Creating-a-Pie-chart-visual-with-Static-Data/m-p/276820#M340</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-10-12T08:30:19Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a Pie chart visual with Static Data.</title>
      <link>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/Creating-a-Pie-chart-visual-with-Static-Data/m-p/276897#M344</link>
      <description>&lt;P&gt;Yes, sure. Thank you for the feedback.&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Ignat Vilesov,&lt;/P&gt;&lt;P&gt;Software Engineer&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Microsoft Power BI Custom Visuals&lt;/P&gt;&lt;P&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>Thu, 12 Oct 2017 09:25:50 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/Creating-a-Pie-chart-visual-with-Static-Data/m-p/276897#M344</guid>
      <dc:creator>v-viig</dc:creator>
      <dc:date>2017-10-12T09:25:50Z</dc:date>
    </item>
  </channel>
</rss>

