Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
ankitnaudiyal
Regular Visitor

Need help on Custom Visual

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. 

Custom Property.jpg

 

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. 

Console.jpg

 

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.

3 REPLIES 3
v-chuncz-msft
Community Support
Community Support

@ankitnaudiyal,

 

Based on my research , you may take a look at this thread and change your code accordingly.

Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

@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. 

v-viig
Community Champion
Community Champion

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

pbicvsupport@microsoft.com

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.