Quantcast
Channel: Developer topics
Viewing all articles
Browse latest Browse all 18011

Need help on Custom Visual

$
0
0

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.


Viewing all articles
Browse latest Browse all 18011

Trending Articles