The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hi Team!
I've been trying to customize the Gantt Chart custom visual on PowerBI. There are a couple of requriemetns that we need to fulfill. One of those is to be able to assign colors to different tasks or the data points. I am currently following the instructions posted on GitHub for creating databound objects
https://github.com/Microsoft/PowerBI-visuals/blob/master/Tutorial/DataBoundObjects.md
Steps followed by me:
> Defined an object in the capabilities.json
"colorSelector": { "displayName": "Data Colors", "properties": { "fill": { "displayName": "color", "type": { "fill": { "solid": { "color": true } } } } } },
> Created a case and instantiated an VisualInstance object in the ObjectEnumeration method
case "colorSelector": { for (let t of vm.tasks) { objectEnumeration.push({ objectName: objectName, displayName: t.name, properties: { fill: { solid: { color: t.color } } }, selector: null }); }
The outcome of this was that I was able to see a property object called DataColor in PowerBI Format. The element did also show four elements as there are four tasks in my dataset. The color of the task was also being bound to the property of the color picker and the color picker showed the right color. But the displayName property could not be bound with the data supplied. The display name for all the four properties was the same. The name was the same as what I had assigned in the capabilities.json.
To check whether the object is being created properly I even printed the displayName property of the object on console and it also showed the exact 4 taskNames that I was expecting.
But surprisingly the name is not visible on the UI.
I tried debugging the enumerate method but was unable to do so. I guess this gets called by the framework so might not be able to do so.
Could someone please help me understand the issue here and suggest a fix.
Based on my research , you may take a look at this thread and change your code accordingly.
@v-chuncz-msft Not sure how the other post is related to his question. I have same issue, I can enumarate the values in the property panel, but the display name cannot be overwriten. Is stays the same as it is in the capabilities files.
You must specify a proper selector for each enumeration.
Selector can be created by using SelectionManager and calling getSelector method.
Please let me know if you need any details.
Ignat Vilesov,
Software Engineer
Microsoft Power BI Custom Visuals