<?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: Custom Visual : Properties (Color picker) in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/Custom-Visual-Properties-Color-picker/m-p/773014#M20484</link>
    <description>&lt;P&gt;Hi @Anonymous&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have spent some hours trying to find a solution.&lt;/P&gt;&lt;P&gt;But I'm sad to say I wasn't able to solve it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you find something :), you can always let me know.&lt;/P&gt;</description>
    <pubDate>Thu, 22 Aug 2019 11:26:11 GMT</pubDate>
    <dc:creator>MichielVA</dc:creator>
    <dc:date>2019-08-22T11:26:11Z</dc:date>
    <item>
      <title>Custom Visual : Properties (Color picker)</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Custom-Visual-Properties-Color-picker/m-p/708594#M19587</link>
      <description>&lt;P&gt;Hi all,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have created a small and simple custom visual using pbiviz.&lt;/P&gt;&lt;P&gt;It all works great, but I'm having a minor issue with the custom formatting options I added.&lt;BR /&gt;&lt;BR /&gt;So, one possibility I added is to change the two colors that are used in the visual, "Color OK", "Color NOK".&lt;/P&gt;&lt;P&gt;Almost everything works:&lt;/P&gt;&lt;P&gt;1) they are shown in the formatting pane and I can change them&lt;/P&gt;&lt;P&gt;2) the default colors that I set in the settings.ts file are used&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, one weird thing I see is the following.&lt;/P&gt;&lt;P&gt;In the formatting pane, as default they are always shown as grey (see picture I attached).&lt;/P&gt;&lt;P&gt;Although the default colors are green and red and these are the ones that are actually shown in the visual.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;IMG src="https://ip1.i.lithium.com/72373a37586080cc43c9b525ab902680f0731c69/68747470733a2f2f692e696d6775722e636f6d2f71556c757432532e6a7067" border="0" alt="PBI property pane" width="162" height="151" /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Part of the capabilities.json code:&lt;/P&gt;&lt;PRE&gt;    "objects":
    {
        "colors":{
            "displayName": "Data Colors",
            "properties": {
                "colorOK": {
                    "displayName": "Color OK",
                    "type": {
                        "fill": {
                            "solid": {
                                "color": true
                            }
                        }
                    }
                },
                "colorNOK": {
                    "displayName": "Color NOK",
                    "type": {
                        "fill": {
                            "solid": {
                                "color": true
                            }
                        }
                    }
                }
            }
        },&lt;/PRE&gt;&lt;P&gt;Part of the settings.ts code where defaults were set:&lt;/P&gt;&lt;PRE&gt;    export class VisualSettings extends DataViewObjectsParser {
      public colors: ColorSettings = new ColorSettings();
    }

     export class ColorSettings {
       // Default colors
       public colorOK : string = "green";
       public colorNOK : string = "red";
     }&lt;/PRE&gt;&lt;P&gt;Part of the visual.ts code:&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;PRE&gt;        public enumerateObjectInstances(options: EnumerateVisualObjectInstancesOptions): VisualObjectInstanceEnumeration {
            const settings: VisualSettings = this.visualSettings || VisualSettings.getDefault() as VisualSettings;
            return VisualSettings.enumerateObjectInstances(settings, options);
        }&lt;/PRE&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 06 Jun 2019 12:32:16 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Custom-Visual-Properties-Color-picker/m-p/708594#M19587</guid>
      <dc:creator>MichielVA</dc:creator>
      <dc:date>2019-06-06T12:32:16Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Visual : Properties (Color picker)</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Custom-Visual-Properties-Color-picker/m-p/773011#M20483</link>
      <description>&lt;P&gt;Hi. I am facing the same issue. Did you manage to solve it?&lt;/P&gt;</description>
      <pubDate>Thu, 22 Aug 2019 11:15:23 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Custom-Visual-Properties-Color-picker/m-p/773011#M20483</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-08-22T11:15:23Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Visual : Properties (Color picker)</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Custom-Visual-Properties-Color-picker/m-p/773014#M20484</link>
      <description>&lt;P&gt;Hi @Anonymous&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have spent some hours trying to find a solution.&lt;/P&gt;&lt;P&gt;But I'm sad to say I wasn't able to solve it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you find something :), you can always let me know.&lt;/P&gt;</description>
      <pubDate>Thu, 22 Aug 2019 11:26:11 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Custom-Visual-Properties-Color-picker/m-p/773014#M20484</guid>
      <dc:creator>MichielVA</dc:creator>
      <dc:date>2019-08-22T11:26:11Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Visual : Properties (Color picker)</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Custom-Visual-Properties-Color-picker/m-p/773030#M20485</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/142127"&gt;@MichielVA&lt;/a&gt;&amp;nbsp;,&amp;nbsp;@Anonymous&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you add the following line of code to the update method, it will set the visual &lt;FONT face="courier new,courier"&gt;this.ettings&lt;/FONT&gt; variable to either the default colors or the values from the formatting pane.&lt;/P&gt;&lt;PRE&gt;this.visualSettings = VisualSettings.parse(dataView) as VisualSettings&lt;/PRE&gt;&lt;P&gt;And in the rest of the code you can refer to &lt;FONT face="courier new,courier"&gt;this.settings&lt;/FONT&gt; to get the configured colors.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;-JP&lt;/P&gt;</description>
      <pubDate>Thu, 22 Aug 2019 11:47:51 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Custom-Visual-Properties-Color-picker/m-p/773030#M20485</guid>
      <dc:creator>jppp</dc:creator>
      <dc:date>2019-08-22T11:47:51Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Visual : Properties (Color picker)</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Custom-Visual-Properties-Color-picker/m-p/773063#M20486</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/3821"&gt;@jppp&lt;/a&gt;-.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have that method in my code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;    private static parseSettings(dataView: DataView): VisualSettings {
        return VisualSettings.parse(dataView) as VisualSettings;
    }&lt;/PRE&gt;&lt;P&gt;Also the enumerate object instances method:&lt;/P&gt;&lt;PRE&gt;    public enumerateObjectInstances(options: EnumerateVisualObjectInstancesOptions): VisualObjectInstance[] {
        let objectName: string = options.objectName;
        let objectEnumeration: VisualObjectInstance[] = [];
        switch( objectName ) {
            case 'colorPicker':
                objectEnumeration.push({
                    objectName: objectName,
                    properties: {
                        "firstColor":{
                            "type": {
                                "fill": {
                                    "solid": {
                                        "color": this.viewModel.minColor
                                    }
                                }
                            }
                        },
                        "secondColor":{
                            "type": {
                                "fill": {
                                    "solid": {
                                        "color": this.viewModel.midColor
                                    }
                                }
                            }
                        },
                        "thirdColor":{
                            "type": {
                                "fill": {
                                    "solid": {
                                        "color": this.viewModel.maxColor
                                    }
                                }
                            }
                        }
                    },
                    selector: null
                });
                break;
        };
    
        return objectEnumeration;
    }&lt;/PRE&gt;&lt;P&gt;And at the beginnning of my visualTransform method (takes VisualUpdateOptions and updates the viewmodel):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;    public visualTransform(options: VisualUpdateOptions){

        this.viewModel = {
            dataPoints: [],
            dataIndex: {},
            dataMin: 0,
            dataMax: 1,
            highlighted: true,
            categoryName: '',
            minColor: this.settings.colorPicker.firstColor,
            midColor: this.settings.colorPicker.secondColor,
            maxColor: this.settings.colorPicker.thirdColor
        };

more code&lt;/PRE&gt;&lt;P&gt;And my objects element in capabilites json:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt; "objects": {
        "colorPicker": {
            "displayName": "Gradient",
            "properties": {
                "firstColor":{
                    "displayName" : "Min value",
                    "type": {
                        "fill": {
                            "solid": {
                                "color": true
                            }
                        }
                    }
                },
                "secondColor":{
                    "displayName" : "Mid value",
                    "type": {
                        "fill": {
                            "solid": {
                                "color": true
                            }
                        }
                    }
                },
                "thirdColor":{
                    "displayName" : "Max value",
                    "type": {
                        "fill": {
                            "solid": {
                                "color": true
                            }
                        }
                    }
                }
            }
        }
    }&lt;/PRE&gt;&lt;P&gt;Basically, I can use the three color pickers and the visual gets updated with the selected color... but the app updates the color to gray in the selector (it does display the selected color for a bit amount of time, and the switches back to gray).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My version of API is 2.6.0.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your help&lt;/P&gt;</description>
      <pubDate>Thu, 22 Aug 2019 12:36:12 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Custom-Visual-Properties-Color-picker/m-p/773063#M20486</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-08-22T12:36:12Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Visual : Properties (Color picker)</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Custom-Visual-Properties-Color-picker/m-p/773088#M20488</link>
      <description>&lt;P&gt;Hi&amp;nbsp;@Anonymous&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Do you call the &lt;STRONG&gt;&lt;FONT face="courier new,courier"&gt;parseSettings&lt;/FONT&gt; &lt;/STRONG&gt;also in the &lt;STRONG&gt;&lt;FONT face="courier new,courier"&gt;update&lt;/FONT&gt; &lt;/STRONG&gt;method?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The&amp;nbsp;&lt;STRONG&gt;&lt;FONT face="courier new,courier"&gt;enumerateObjectInstances&lt;/FONT&gt;&lt;/STRONG&gt; is only called when the formatting pane is used and not by the main code of the visual.&lt;/P&gt;&lt;P&gt;And the configured state of the formatting pane is being stored in the &lt;STRONG&gt;&lt;FONT face="courier new,courier"&gt;options.dataView&lt;/FONT&gt; &lt;/STRONG&gt;object that is a parameter of the &lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;update&lt;/STRONG&gt; &lt;/FONT&gt;method. That is why you have to parse the settings from the dataView in the update method as each change in the formatting pane will trigger that method.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;-JP&lt;/P&gt;</description>
      <pubDate>Thu, 22 Aug 2019 12:55:16 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Custom-Visual-Properties-Color-picker/m-p/773088#M20488</guid>
      <dc:creator>jppp</dc:creator>
      <dc:date>2019-08-22T12:55:16Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Visual : Properties (Color picker)</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Custom-Visual-Properties-Color-picker/m-p/773089#M20489</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/3821"&gt;@jppp&lt;/a&gt;&amp;nbsp;,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;firstly thanks for your prompt response &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here goes my update method. Second line is the call to visual.parseSettings.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;    public update(options: VisualUpdateOptions) {
        let self = this;
        self.settings = Visual.parseSettings(options &amp;amp;&amp;amp; options.dataViews &amp;amp;&amp;amp; options.dataViews[0]);        
        self.visualTransform(options);
        self.svg.selectAll('path').each(self.updateHandler());
        self.fitSVGtoViewPort(options.viewport.width, options.viewport.height);
    }&lt;/PRE&gt;&lt;P&gt;Could it be related with the fact that selector is null when declaring the objectEnumeration?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Jorge&lt;/P&gt;</description>
      <pubDate>Thu, 22 Aug 2019 12:59:02 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Custom-Visual-Properties-Color-picker/m-p/773089#M20489</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-08-22T12:59:02Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Visual : Properties (Color picker)</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Custom-Visual-Properties-Color-picker/m-p/773096#M20490</link>
      <description>&lt;P&gt;Hi&amp;nbsp;@Anonymous&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Looks like the colors are 'static' and not related to any data, so you can keep you &lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;enumerateObjectInstances&lt;/STRONG&gt; &lt;/FONT&gt;method pretty simple like this:&lt;/P&gt;&lt;PRE&gt;public enumerateObjectInstances(options: EnumerateVisualObjectInstancesOptions): VisualObjectInstanceEnumeration {
    const settings: VisualSettings = this.visualSettings || VisualSettings.getDefault() as VisualSettings;
    return VisualSettings.enumerateObjectInstances(settings, options);
}&lt;/PRE&gt;&lt;P&gt;And define in your VisualSettings the default colors of your three colors. Probably you have to set them in the format #RRGGBB to let enerything work.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;-JP&lt;/P&gt;</description>
      <pubDate>Thu, 22 Aug 2019 13:09:52 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Custom-Visual-Properties-Color-picker/m-p/773096#M20490</guid>
      <dc:creator>jppp</dc:creator>
      <dc:date>2019-08-22T13:09:52Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Visual : Properties (Color picker)</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Custom-Visual-Properties-Color-picker/m-p/773101#M20491</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/3821"&gt;@jppp&lt;/a&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It worked &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; I can confirm after replacing the code now the selector is working as expected.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks very much for your support&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Jorge&lt;/P&gt;</description>
      <pubDate>Thu, 22 Aug 2019 13:17:23 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Custom-Visual-Properties-Color-picker/m-p/773101#M20491</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-08-22T13:17:23Z</dc:date>
    </item>
  </channel>
</rss>

