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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
callum
Helper II
Helper II

Modifying parseSettings/VisualSettings

Hello,

 

A newly created visual comes with a static parseSettings method, which calls VisualSettings.parse(). If I inspect the return value of this call then it is a VisualSettings instance with a property called "dataPointSettings", which itself has properties like "defaultColor", "fontSize", etc. My question is where are these defined? I'd like to be able to modify these values but I can't find any class called VisualSettings in my source code.

 

Thank you.

1 ACCEPTED SOLUTION
v-chuncz-msft
Community Support
Community Support

@callum,

 

Check "src/settings.ts" in your visual project.

Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

9 REPLIES 9
Anonymous
Not applicable

Hi @callum @v-chuncz-msft
I'm also trying to develop a custom visual and is stuck at this particular point.
how did you retrieve property values from the dataview and how did you populate the property pane afterwards?
Did you use enumerateObjectInstances ?

 

 

v-viig
Community Champion
Community Champion

Hello @Anonymous

 

Yes, you should implement enumerateObjectInstances in order to update values at the format panel.

Do you have VisualSettings class in your csutom visual?

 

Ignat Vilesov,

Software Engineer

 

Microsoft Power BI Custom Visuals

pbicvsupport@microsoft.com

Anonymous
Not applicable

hello @v-viig
Yes,I am using VisualSettings class.
Should i use the switch statement then.
I'm a little confused as this template is slightly different from the one in the tutorial.

v-viig
Community Champion
Community Champion

If you want to include new properties into formatting panel you should:

  • Create a new class

 

export class NewGroup {
    public show: boolean = true;
}
  • Specify an instance of the new class into VisualSettings class

 

export class VisualSettings extends DataViewObjectsParser {
  public newGroup: NewGroup = new NewGroup();
}
  • Specify the new group at capabilities.json
"objects": {
    "newGroup": {
        "displayName": "New Group",
        "properties": {
            "show": {
                "displayName": "Show",
                "type": {
                    "bool": true
                }
            }
        }
    }
}

Please note that these steps are for including the new group of properties. You can actually include new properties into the existing classes (please don't forget to specify the same properties at capabilities.json).

 

Please let me know if you have any further questions.

 

Ignat Vilesov,

Software Engineer

 

Microsoft Power BI Custom Visuals

pbicvsupport@microsoft.com

 

 

Anonymous
Not applicable

Actually I have done upto here.Since now there is no need for an interface,How do I retrieve the property value from the pane.
Also how would this code snippet change after I add more properties?

public enumerateObjectInstances(options: EnumerateVisualObjectInstancesOptions): VisualObjectInstance[] | VisualObjectInstanceEnumerationObject {                   
            return VisualSettings.enumerateObjectInstances(this.settings || VisualSettings.getDefault(), options);
        } 

 

v-viig
Community Champion
Community Champion

You shouldn't change this snippet code.
All of properties will be parsed automatically.

 

Ignat Vilesov,

Software Engineer

 

Microsoft Power BI Custom Visuals

pbicvsupport@microsoft.com

Anonymous
Not applicable

@v-viig
and how do i retrieve the property values from the pane?
are interfaces needed?

v-viig
Community Champion
Community Champion

The property will in this.settings.

Do you want to include any extra properties?

 

Ignat Vilesov,

Software Engineer

 

Microsoft Power BI Custom Visuals

pbicvsupport@microsoft.com

v-chuncz-msft
Community Support
Community Support

@callum,

 

Check "src/settings.ts" in your visual project.

Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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