cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
callum Member
Member

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

Accepted Solutions
Community Support Team
Community Support Team

Re: Modifying parseSettings/VisualSettings

@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.
9 REPLIES 9
Community Support Team
Community Support Team

Re: Modifying parseSettings/VisualSettings

@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.
vichus Member
Member

Re: Modifying parseSettings/VisualSettings

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 ?

 

 

Moderator v-viig
Moderator

Re: Modifying parseSettings/VisualSettings

Hello @vichus

 

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

vichus Member
Member

Re: Modifying parseSettings/VisualSettings

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.

Moderator v-viig
Moderator

Re: Modifying parseSettings/VisualSettings

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

 

 

vichus Member
Member

Re: Modifying parseSettings/VisualSettings

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);
        } 

 

Moderator v-viig
Moderator

Re: Modifying parseSettings/VisualSettings

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

vichus Member
Member

Re: Modifying parseSettings/VisualSettings

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

Moderator v-viig
Moderator

Re: Modifying parseSettings/VisualSettings

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

Helpful resources

Announcements
Virtual Launch Event

Microsoft Business Applications October Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

Power BI Helps Homeless and Trouble Youth

Power BI Helps Homeless and Trouble Youth

We spoke with Power BI Super User, Greg Deckler, about his charity work

MBAS Gallery

Watch Sessions On Demand!

Continue your learning in our online communities.

Users Online
Currently online: 424 members 4,886 guests
Please welcome our newest community members: