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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Anonymous
Not applicable

Accessing highlights array - supportsHighlight capability

Hi, 

 

I' developing custom visual and want to support highlights. Here is my capabilities.json code:

 

{
    "dataRoles": [
        {
            "displayName": "Row",
            "name": "row",
            "kind": "Grouping"
        },
        {
            "displayName": "Column",
            "name": "column",
            "kind": "Grouping"
        },
        {
            "displayName": "Tile Title",
            "name": "tileTitle",
            "kind": "Grouping"
        },
        {
            "displayName": "Color",
            "name": "color",
            "kind": "Grouping"
        },
        {
            "displayName": "Total Cost",
            "name": "totalCost",
            "kind": "Grouping"
        },
        {
            "displayName": "Total Gap",
            "name": "totalGap",
            "kind": "Grouping"
        },
        {
            "displayName": "Is Header",
            "name": "isHeader",
            "kind": "Grouping"
        },
        {
            "displayName": "AnalysisId",
            "name": "analysisId",
            "kind": "Grouping"
        }
    ],
    "dataViewMappings": [
        {
            "categorical": {
                "categories": {
                    "for": {"in" : "analysisId"}
                },
            "values": {
                        "select": [
                            { "bind": { "to": "totalCost" } },
                            { "bind": { "to": "totalGap" } },
                            { "bind": { "to": "isHeader" } },
                            { "bind": { "to": "color" } },
                            { "bind": { "to": "tileTitle" } },
                            { "bind": { "to": "column" } },
                            { "bind": { "to": "row" } }
                    ]   
                }
            }
        }
    ],
    "supportsHighlight": true,
    "suppressDefaultTitle": true
}

Question is how do I access highlights array? This is not helping, as:

 

            let highlights = dataView.categorical.categories[0].highlights;

throws an error:

"Property 'highlights' does not exist on type 'DataViewCategoryColumn'.". I have no idea how to make PowerBI use 

'DataViewValueColumn' type  instead of 'DataViewCategoryColumn'.

 

Can anyone point me in the right direction? 

1 ACCEPTED SOLUTION
v-viig
Community Champion
Community Champion

As shown in the documentation highlights array will be added to values: options.dataViews[0].categorical.values[0].highlights

 

Ignat Vilesov,

Software Engineer

 

Microsoft Power BI Custom Visuals

pbicvsupport@microsoft.com

View solution in original post

1 REPLY 1
v-viig
Community Champion
Community Champion

As shown in the documentation highlights array will be added to values: options.dataViews[0].categorical.values[0].highlights

 

Ignat Vilesov,

Software Engineer

 

Microsoft Power BI Custom Visuals

pbicvsupport@microsoft.com

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!

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.