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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Custom Properties won't show

 Hey!

 

I'm trying to use custom properties in my visual but they won't show in the GUI. I don't know what is missing, following is the code I'm using for the properties:

 

capabilities.json:

    "objects": {
        "general": {
            "displayName": "General",
            "properties": {
                "filter": {
                    "type": {
                        "filter": true
                    }
                }
            }
        },
        "dataPoint": {
            "displayName": "Graph Settings",
            "properties": {
                 "textSize": {
                    "displayName": "Text Size",
                    "type": {
                        "formatting": {
                            "fontSize": true
                        }
                    }
                },
                "filterSelfLoops": {
                    "displayName": "Filter selfloops",
                    "type": {
                        "bool": true
                    }
                },
                "useMultipleProcesses": {
                    "displayName": "Use multiple Processes",
                    "type": {
                        "bool": true
                    }
                }
            }
        }
    }

visual.ts:

    /**
    * Interface for Flowchart Settings.
    *
    * @interface
    * @property {} dataPoint - textSize => Change the fontsize.
    *                        - filterSelfLoops => Activate to disable selfloops.
    *                        - useMultipleProcesses => Active if you want to use multiple Processes.
    *
    */
    interface FlowchartSettings {
        dataPoint: {
            textSize: string;
            filterSelfLoops: boolean;
            useMultipleProcesses: boolean;
        };
    }

 

    export class Visual implements IVisual {
        private host: IVisualHost;
        .
        .
        .
        private flowChartSettings: FlowchartSettings;
        public enumerateObjectInstances(options: EnumerateVisualObjectInstancesOptions): VisualObjectInstanceEnumeration {
            let objectName = options.objectName;
            let objectEnumeration: VisualObjectInstance[] = [];

            switch (objectName) {
                case 'dataPoint':
                    objectEnumeration.push({
                        objectName: objectName,
                        properties: {
                            textSize: this.flowChartSettings.dataPoint.textSize,
                            filterSelfLoops: this.flowChartSettings.dataPoint.filterSelfLoops,
                            useMultipleProcesses: this.flowChartSettings.dataPoint.useMultipleProcesses,
                        },
                        selector: null
                    });
            }
            return objectEnumeration;
        }

 

Thanks in advance for your help,

lschroth

1 ACCEPTED SOLUTION
v-viig
Community Champion
Community Champion

What value is in this.flowChartSettings? Do you parse values to fill FlowchartSettings interface?

 

Ignat Vilesov,

Software Engineer

 

Microsoft Power BI Custom Visuals

pbicvsupport@microsoft.com

View solution in original post

4 REPLIES 4
v-viig
Community Champion
Community Champion

Code looks good. Have you tried to restart pbiviz start and refresh the web page?

 

Ignat Vilesov,

Software Engineer

 

Microsoft Power BI Custom Visuals

pbicvsupport@microsoft.com

Anonymous
Not applicable

Yes I tried to restart the visual, I also tried it in different Browsers and the Desktop Version. I'm running the latest stable API Version (1.11.0).

 

Do you have any other ideas why it's not working?

v-viig
Community Champion
Community Champion

What value is in this.flowChartSettings? Do you parse values to fill FlowchartSettings interface?

 

Ignat Vilesov,

Software Engineer

 

Microsoft Power BI Custom Visuals

pbicvsupport@microsoft.com

Anonymous
Not applicable

Well that helped.. I didn't save the settings to this.flowChartSettings, I accidently saved it to a new variable flowChartSettings.Smiley Mad And so this.flowChartSettings was undefined when it was used in the enumerateObjectInstaces function.

 

Thanks for your time!

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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