Hello,
I'll try to explain my situation as clearly as possible. I'm building a visual to simulate the functionality of ThoughtWorks' Tech Radar. 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.
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.
I took a leaf out of the sample bar chart guide and added this to my capabilities.json:
"objects": { "colourSelector": { "displayName": "Sector colours", "properties": { "fill": { "displayName": "Colour", "type": { "fill": { "solid": { "color": true } } } } } } }
But I'm not sure how to proceed further. I changed my enumerateObjectInstances to:
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; }
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)
With this, I do get the following in the Format pane:
However I don't know how I can bind these values to sector.colour. Where do they go?
I hope this makes sense! Thanks in advance.