<?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 Confused about objects... in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/Confused-about-objects/m-p/239116#M7494</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'll try to explain my situation as clearly as possible. I'm building a visual to simulate the functionality of&amp;nbsp;&lt;A href="https://www.thoughtworks.com/radar" target="_self"&gt;ThoughtWorks' Tech Radar&lt;/A&gt;. I therefore have four classes; Radar, Sector, Point and Ring. Radar is the "main" class for which is an instance is returned from my visualTransform method. And then a radar has a property called sectors, which is an array of Sector instances. Each Sector then contains many Points (which then has a ring!), although this last bit doesn't really matter for the question.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Anyway, you can see how each sector has a different colour. I'd like the user to be able to choose these colours. I want to store it in a property of a Sector called colours, i.e. when plotting the visual I would use sector.colour.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I took a leaf out of the sample bar chart guide and added this to my capabilities.json:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;  "objects": {
    "colourSelector": {
      "displayName": "Sector colours",
      "properties": {
        "fill": {
          "displayName": "Colour",
          "type": {
            "fill": {
              "solid": {
                "color": true
              }
            }
          }
        }
      }
    }
  }&lt;/PRE&gt;&lt;P&gt;But I'm not sure how to proceed further. I changed my enumerateObjectInstances to:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;public enumerateObjectInstances(options: EnumerateVisualObjectInstancesOptions): VisualObjectInstance[] | VisualObjectInstanceEnumerationObject {
    let objectEnumeration = [];

    switch (options.objectName) {
        case "colourSelector":
            this.radar.sectors.forEach(function (sector) {
                objectEnumeration.push({
                    objectName: options.objectName,
                    displayName: sector.name,
                    properties: {
                        fill: {
                            solid: {
                                color: sector.colour
                            }
                        }
                    },
                    selector: sector
                });
            });
            break;
    }

    return objectEnumeration;
}&lt;/PRE&gt;&lt;P&gt;But I clearly need to do something more. Specifically in the "selector" bit; I don't think passing in an actual Sector instance is correct, but the guide seems to just glance over what should be passed in without giving much detail. (For clarity: each sector is given a default colour, hence why sector.colour is used here)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;With this,&amp;nbsp;I do get the following in the Format pane:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;However I don't know how I can bind these values to sector.colour. Where do they go?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I hope this makes sense! Thanks in advance.&lt;/P&gt;</description>
    <pubDate>Fri, 25 Aug 2017 11:00:48 GMT</pubDate>
    <dc:creator>callum</dc:creator>
    <dc:date>2017-08-25T11:00:48Z</dc:date>
    <item>
      <title>Confused about objects...</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Confused-about-objects/m-p/239116#M7494</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'll try to explain my situation as clearly as possible. I'm building a visual to simulate the functionality of&amp;nbsp;&lt;A href="https://www.thoughtworks.com/radar" target="_self"&gt;ThoughtWorks' Tech Radar&lt;/A&gt;. I therefore have four classes; Radar, Sector, Point and Ring. Radar is the "main" class for which is an instance is returned from my visualTransform method. And then a radar has a property called sectors, which is an array of Sector instances. Each Sector then contains many Points (which then has a ring!), although this last bit doesn't really matter for the question.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Anyway, you can see how each sector has a different colour. I'd like the user to be able to choose these colours. I want to store it in a property of a Sector called colours, i.e. when plotting the visual I would use sector.colour.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I took a leaf out of the sample bar chart guide and added this to my capabilities.json:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;  "objects": {
    "colourSelector": {
      "displayName": "Sector colours",
      "properties": {
        "fill": {
          "displayName": "Colour",
          "type": {
            "fill": {
              "solid": {
                "color": true
              }
            }
          }
        }
      }
    }
  }&lt;/PRE&gt;&lt;P&gt;But I'm not sure how to proceed further. I changed my enumerateObjectInstances to:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;public enumerateObjectInstances(options: EnumerateVisualObjectInstancesOptions): VisualObjectInstance[] | VisualObjectInstanceEnumerationObject {
    let objectEnumeration = [];

    switch (options.objectName) {
        case "colourSelector":
            this.radar.sectors.forEach(function (sector) {
                objectEnumeration.push({
                    objectName: options.objectName,
                    displayName: sector.name,
                    properties: {
                        fill: {
                            solid: {
                                color: sector.colour
                            }
                        }
                    },
                    selector: sector
                });
            });
            break;
    }

    return objectEnumeration;
}&lt;/PRE&gt;&lt;P&gt;But I clearly need to do something more. Specifically in the "selector" bit; I don't think passing in an actual Sector instance is correct, but the guide seems to just glance over what should be passed in without giving much detail. (For clarity: each sector is given a default colour, hence why sector.colour is used here)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;With this,&amp;nbsp;I do get the following in the Format pane:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;However I don't know how I can bind these values to sector.colour. Where do they go?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I hope this makes sense! Thanks in advance.&lt;/P&gt;</description>
      <pubDate>Fri, 25 Aug 2017 11:00:48 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Confused-about-objects/m-p/239116#M7494</guid>
      <dc:creator>callum</dc:creator>
      <dc:date>2017-08-25T11:00:48Z</dc:date>
    </item>
    <item>
      <title>Re: Confused about objects...</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Confused-about-objects/m-p/240287#M7512</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="36706" data-lia-user-login="callum" class="lia-mention lia-mention-user"&gt;callum&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You may check function getCategoricalObjectValue.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://github.com/Microsoft/PowerBI-visuals/blob/f76ae919d9c9df83318e62e2bd7b24d185e8a32e/Tutorial/DataBoundObjects.md" target="_blank"&gt;https://github.com/Microsoft/PowerBI-visuals/blob/f76ae919d9c9df83318e62e2bd7b24d185e8a32e/Tutorial/DataBoundObjects.md&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 28 Aug 2017 10:32:43 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Confused-about-objects/m-p/240287#M7512</guid>
      <dc:creator>v-chuncz-msft</dc:creator>
      <dc:date>2017-08-28T10:32:43Z</dc:date>
    </item>
  </channel>
</rss>

