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

Join the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register now

Reply
Anonymous
Not applicable

Custom Visual, when I add table binding, the custom formatting disappears.

I use API 2.3.0

 

I created table bind
{
    "dataRoles": [
        {
            "displayName": "Category",
            "name": "Category",
            "kind": "GroupingOrMeasure"
        },
        {
            "displayName": "Value1",
            "name": "Value1",
            "kind": "GroupingOrMeasure"
        },
        {
            "displayName": "Value2",
            "name": "Value2",
            "kind": "GroupingOrMeasure"
        }
    ],
    "objects": {
        "category": {
            "displayName": "Category ",
            "properties": {
                "show": {
                    "displayName": "Turn on/off",
                    "type": {
                        "bool": true
                    }
                },    
                "fontColor": {
                    "displayName": "Font Color",
                    "description": "Select font color",
                    "type": {
                        "fill": {
                            "solid": {
                                "color": true
                            }
                        }
                    }
                }
            }
        }       
    },
    "dataViewMappings": [
        {
            "table": {
                "rows": {
                    "select": [
                        {
                            "for": {
                                "in": "Category"
                            }
                        },                
                        {
                            "for": {
                                "in": "Value1"
                            }
                        },
                        {
                            "for": {
                                "in": "Value2"
                            }
                        }
                    ],
                    "dataReductionAlgorithm": {
                        "sample": {
                            "count": 2000
                        }
                    }
                }
            }
        }
    ]
}
 When I add custom visual to the board, I see custom formatting. But when select some field, custom formatting disappears.
The general format is always available.
 
When I bind via category, everything works correctly. But I need to work with table now.
 
Function enumerateObjectInstances has default code
 const settings: VisualSettings = this.visualSettings || 
                                         VisualSettings.getDefault() as VisualSettings;
        var visualObjects: VisualObjectInstanceEnumerationObject = <VisualObjectInstanceEnumerationObject> VisualSettings.enumerateObjectInstances(settings, options);
        return visualObjects;
 In update method I add 
let dataView = options.dataViews[0] || {} as powerbi.DataView;
this.visualSettings = VisualSettings.parse<VisualSettings>(dataView);
 
 
What I miss?
Also what is the best way to parse data bind?
I have noticed that sometimes metadata.object is not displayed, why?
 
 
1 ACCEPTED SOLUTION

6 REPLIES 6
dm-p
Super User
Super User

I can't help with the majority of what you're asking, but regarding your question about metadata.objects not always being present - in my experience, this is only populated if a property is different to its default value, i.e. modified by the end-user. If your visual has not have any properties modified from the defaults then this will be empty.

 

The framework will assume the default values (typically specified in your settings.ts) if this is not present for any objects defined. The following code in your post is handling that part:

 

const settings: VisualSettings = this.visualSettings || 
                                         VisualSettings.getDefault() as VisualSettings;

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!


On how to ask a technical question, if you really want an answer (courtesy of SQLBI)




Anonymous
Not applicable

Thanks, I've noticed it duration same time. 

 

v-evelk
Microsoft Employee
Microsoft Employee

Hello,

 

It is necessary to analyze the source code to make some suggestion. Could you please share the repo link or send files to pbicvsupport@microsoft.com for analysis?

 

Thanks!

 

Evgenii Elkin,
Software Engineer
Microsoft Power BI Custom Visuals
pbicvsupport@microsoft.com

 

Anonymous
Not applicable

I found the problem, It was the cache issues.

Also, do you know where I can find full documentation about capabilities.json?

 

Hello,

 

You should check the following documentation pages:

https://microsoft.github.io/PowerBI-visuals/docs/concepts/capabilities/

https://microsoft.github.io/PowerBI-visuals/docs/concepts/dataviewmappings/

https://microsoft.github.io/PowerBI-visuals/docs/concepts/objects-and-properties/

 

Evgenii Elkin,
Software Engineer
Microsoft Power BI Custom Visuals
pbicvsupport@microsoft.com

Anonymous
Not applicable

Ok, thank you.

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

FabCon and SQLCon Highlights Carousel

FabCon &SQLCon Highlights

Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.