<?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 Custom Visual Won't Display in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/Custom-Visual-Won-t-Display/m-p/683797#M19314</link>
    <description>&lt;P&gt;I've installed everything for creating custom visuals, as the "Update: X" visual displays properly. However, when trying to display a visual with static data, the visual is blank. I have added values to both Category &amp;amp; Measure field wells.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The code I'm using is the static bar chart:&amp;nbsp;&lt;A href="https://github.com/Microsoft/PowerBI-visuals-sampleBarChart/blob/master/Tutorial/StaticVisual.md" target="_blank" rel="noopener"&gt;https://github.com/Microsoft/PowerBI-visuals-sampleBarChart/blob/master/Tutorial/StaticVisual.md&lt;/A&gt;&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="Screen Shot 2019-05-04 at 7.13.45 AM.png" style="width: 999px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/162537i6335E2EA4155A79A/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screen Shot 2019-05-04 at 7.13.45 AM.png" alt="Screen Shot 2019-05-04 at 7.13.45 AM.png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screen Shot 2019-05-04 at 7.13.20 AM.png" style="width: 999px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/162538i897FC3C22CFC0070/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screen Shot 2019-05-04 at 7.13.20 AM.png" alt="Screen Shot 2019-05-04 at 7.13.20 AM.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Code:&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;PRE&gt;/*
 *  Power BI Visual CLI
 *
 *  Copyright (c) Microsoft Corporation
 *  All rights reserved.
 *  MIT License
 *
 *  Permission is hereby granted, free of charge, to any person obtaining a copy
 *  of this software and associated documentation files (the ""Software""), to deal
 *  in the Software without restriction, including without limitation the rights
 *  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 *  copies of the Software, and to permit persons to whom the Software is
 *  furnished to do so, subject to the following conditions:
 *
 *  The above copyright notice and this permission notice shall be included in
 *  all copies or substantial portions of the Software.
 *
 *  THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 *  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 *  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 *  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 *  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 *  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 *  THE SOFTWARE.
 */

module powerbi.extensibility.visual {

    interface dataPoint {
        category: string;
        value: number;
    }

    interface ViewModel {
        dataPoints: dataPoint[];
        maxValue: number;
    };

    "use strict";
    export class Visual implements IVisual {
        private host: IVisualHost;
        private svg: d3.Selection&amp;lt;SVGElement&amp;gt;;
        private barGroup: d3.Selection&amp;lt;SVGElement&amp;gt;;
        private xPadding: number = 0.1;



        constructor(options: VisualConstructorOptions) {
                this.host = options.host;
                this.svg = d3.select(options.element)
                    .append("svg")
                    .classed("barchart", true);
                this.barGroup = this.svg
                .append("g")
                .classed("barGroup", true);


            
        }

        public update(options: VisualUpdateOptions) {
            let sample: dataPoint[] = [
                {category: 'apples', value: 5},
                {category: 'bananas', value: 10},
                {category: 'oranges', value: 15}
            ];

            let viewModel: ViewModel = {
                dataPoints: sample,
                maxValue: d3.max(sample, x =&amp;gt; x.value)
            };

            let width = options.viewport.width;
            let height = options.viewport.height;

            this.svg.attr({
                width: width,
                height: height
            });

            let yScale = d3.scale.linear().domain([0, viewModel.maxValue]).range([height, 0]);
            let xScale = d3.scale.ordinal().domain(viewModel.dataPoints.map(d =&amp;gt; d.category)).rangeRoundBands([0,width], this.xPadding);

            let bars = this.barGroup
                .selectAll(".bar")
                .data(viewModel.dataPoints);

            bars.enter()
                .append("rect")
                .classed("bar", true);

            bars.attr({
                width: xScale.rangeBand(),
                height: d =&amp;gt; height - yScale(d.value),
                y: d =&amp;gt; yScale(d.value),
                x: d =&amp;gt; xScale(d.category)
            });

            bars.exit()
                .remove();

        };

 /** 
        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;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;</description>
    <pubDate>Sat, 04 May 2019 12:21:13 GMT</pubDate>
    <dc:creator>gattoun1</dc:creator>
    <dc:date>2019-05-04T12:21:13Z</dc:date>
    <item>
      <title>Custom Visual Won't Display</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Custom-Visual-Won-t-Display/m-p/683797#M19314</link>
      <description>&lt;P&gt;I've installed everything for creating custom visuals, as the "Update: X" visual displays properly. However, when trying to display a visual with static data, the visual is blank. I have added values to both Category &amp;amp; Measure field wells.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The code I'm using is the static bar chart:&amp;nbsp;&lt;A href="https://github.com/Microsoft/PowerBI-visuals-sampleBarChart/blob/master/Tutorial/StaticVisual.md" target="_blank" rel="noopener"&gt;https://github.com/Microsoft/PowerBI-visuals-sampleBarChart/blob/master/Tutorial/StaticVisual.md&lt;/A&gt;&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="Screen Shot 2019-05-04 at 7.13.45 AM.png" style="width: 999px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/162537i6335E2EA4155A79A/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screen Shot 2019-05-04 at 7.13.45 AM.png" alt="Screen Shot 2019-05-04 at 7.13.45 AM.png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screen Shot 2019-05-04 at 7.13.20 AM.png" style="width: 999px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/162538i897FC3C22CFC0070/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screen Shot 2019-05-04 at 7.13.20 AM.png" alt="Screen Shot 2019-05-04 at 7.13.20 AM.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Code:&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;PRE&gt;/*
 *  Power BI Visual CLI
 *
 *  Copyright (c) Microsoft Corporation
 *  All rights reserved.
 *  MIT License
 *
 *  Permission is hereby granted, free of charge, to any person obtaining a copy
 *  of this software and associated documentation files (the ""Software""), to deal
 *  in the Software without restriction, including without limitation the rights
 *  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 *  copies of the Software, and to permit persons to whom the Software is
 *  furnished to do so, subject to the following conditions:
 *
 *  The above copyright notice and this permission notice shall be included in
 *  all copies or substantial portions of the Software.
 *
 *  THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 *  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 *  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 *  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 *  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 *  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 *  THE SOFTWARE.
 */

module powerbi.extensibility.visual {

    interface dataPoint {
        category: string;
        value: number;
    }

    interface ViewModel {
        dataPoints: dataPoint[];
        maxValue: number;
    };

    "use strict";
    export class Visual implements IVisual {
        private host: IVisualHost;
        private svg: d3.Selection&amp;lt;SVGElement&amp;gt;;
        private barGroup: d3.Selection&amp;lt;SVGElement&amp;gt;;
        private xPadding: number = 0.1;



        constructor(options: VisualConstructorOptions) {
                this.host = options.host;
                this.svg = d3.select(options.element)
                    .append("svg")
                    .classed("barchart", true);
                this.barGroup = this.svg
                .append("g")
                .classed("barGroup", true);


            
        }

        public update(options: VisualUpdateOptions) {
            let sample: dataPoint[] = [
                {category: 'apples', value: 5},
                {category: 'bananas', value: 10},
                {category: 'oranges', value: 15}
            ];

            let viewModel: ViewModel = {
                dataPoints: sample,
                maxValue: d3.max(sample, x =&amp;gt; x.value)
            };

            let width = options.viewport.width;
            let height = options.viewport.height;

            this.svg.attr({
                width: width,
                height: height
            });

            let yScale = d3.scale.linear().domain([0, viewModel.maxValue]).range([height, 0]);
            let xScale = d3.scale.ordinal().domain(viewModel.dataPoints.map(d =&amp;gt; d.category)).rangeRoundBands([0,width], this.xPadding);

            let bars = this.barGroup
                .selectAll(".bar")
                .data(viewModel.dataPoints);

            bars.enter()
                .append("rect")
                .classed("bar", true);

            bars.attr({
                width: xScale.rangeBand(),
                height: d =&amp;gt; height - yScale(d.value),
                y: d =&amp;gt; yScale(d.value),
                x: d =&amp;gt; xScale(d.category)
            });

            bars.exit()
                .remove();

        };

 /** 
        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;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Sat, 04 May 2019 12:21:13 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Custom-Visual-Won-t-Display/m-p/683797#M19314</guid>
      <dc:creator>gattoun1</dc:creator>
      <dc:date>2019-05-04T12:21:13Z</dc:date>
    </item>
  </channel>
</rss>

