Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
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.
Solved! Go to Solution.
You may check function getCategoricalObjectValue.
You may check function getCategoricalObjectValue.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
13 | |
2 | |
1 | |
1 | |
1 |
User | Count |
---|---|
22 | |
3 | |
2 | |
2 | |
2 |