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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
kpia
Helper I
Helper I

Unable to add formatting options for custom visual

I am creating a cusotm visual and want to add some formatting options. I've followed the guide in the custom visual documentation. As I understand it, if I add objects to the capabilities file it should show up in the formatting panel. Below is my code, I'm not sure why it doens't work.

 

Any insight is greatly appreciated. 

 

{
    "dataRoles": [
        {
            "displayName": "Date",
            "name": "categories",
            "kind": "Grouping",
            "description": "Add a date-type column"
        },
        {
            "displayName": "Max Date Column",
            "name": "max date",
            "kind": "Grouping",
            "description": "Add column that contains max date"
        }
    ],
    "objects": {
        "general": {
            "displayName": "General",
            "displayNameKey": "formattingGeneral",
            "properties": {
                "filter": {
                    "type": {
                        "filter": true
                    }
                },
                "selfFilter": {
                    "type": {
                        "filter": {
                            "selfFilter": true
                        }
                    }
                }
            }
        },
        "buttonTypes": {
            "displayName": "BoB Buttons",
            "displayNameKey": "Visual_Buttons",
            "properties": {
                "show": {
                    "displayName": "Show",
                    "displayNameKey": "Visual_Show",
                    "type": {
                        "bool": true
                    }
                }
            }
        }
    },
    "dataViewMappings": [
        {
            "conditions": [
                {
                    "categories": {
                        "max": 1
                    }
                }
            ],
            "categorical": {
                "categories": {
                    "select": [
                        {
                            "for": {
                                "in": "categories"
                            }
                        }
                    ],
                    "dataReductionAlgorithm": {
                        "window": {
                            "count": 30000
                        }
                    }
                }
            }
        }
    ],
    "privileges": [],
    "supportsHighlight": true,
    "supportsLandingPage": true,
    "suppressDefaultTitle": true,
    "supportsSynchronizingFilterState": true,
    "supportsKeyboardFocus": true
}

 

 

1 REPLY 1
dm-p
Super User
Super User

Hi @kpia,

 

Capabilities are added to tell Power BI what objects and properties your visual will want to persist to the report for later retrieval. However, to display them for the user, you will need to write the necessary code to do so.

 

This code will typically include classes that match the structure of your capabilities (a class instance for each object and each class has to have properties with default values instantiated) and suitable logic to handle things that are not defined in the capabilities, such as enabling/disabling other properties based on what you choose in others or performing validation.

 

The Objects and Properties page in the developer documentation has a section that details how to get started with the code necessary for populating the formatting pane. Suppose you've created a brand new visual using powerbi-visuals-tools. In that case, there is usually a VisualSettings.ts (or similar file) that is generated, showing the necessary structure needed to match the capabilities that are generated from the template, and this may help you to get started.

 

Good luck!

 

Daniel





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

Proud to be a Super User!


My course: Introduction to Developing Power BI Visuals


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




Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Feb2025 Sticker Challenge

Join our Community Sticker Challenge 2025

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

Jan NL Carousel

Fabric Community Update - January 2025

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

Top Solution Authors
Top Kudoed Authors