cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
optimusprime Regular Visitor
Regular Visitor

Custom Visual displayUnits drop down menu

Hi I am making my custom visual and need the display units drop down menu.....I suspect this is part of power bi utility that was packaged in?  but I cannot find any documentation.  Can anyone help?  Thanks.

2019_07_09_08_10_35_Window.png

1 ACCEPTED SOLUTION

Accepted Solutions
dm-p Established Member
Established Member

Re: Custom Visual displayUnits drop down menu

Hi @optimusprime 

Use a type in your capabilities.json as follows:

"type": {
    "formatting": {
        "labelDisplayUnits": true
    }
}

The corresponding class property in your settings.ts will be of type number, as the list value will pass in a number a valueFormatter can use in the value parameter of the ValueFormatterOptions.

Here's some examples from one of my custom visuals (we're looking at the labelDisplayUnits object):

Hopefully this gets you moving!

Daniel

 

EDIT: the formatting type also has support for fontSize and alignment, values which will add selectors for font size and graphics for left/centre/right alignment as in the properties pane. Here's the section of the JSON schema for capabilities, which documents the formatting object type.

DOUBLE EDIT: looks like fontFamily was added a while back, too; that'll be worth exploring at some point...

3 REPLIES 3
dm-p Established Member
Established Member

Re: Custom Visual displayUnits drop down menu

Hi @optimusprime 

Use a type in your capabilities.json as follows:

"type": {
    "formatting": {
        "labelDisplayUnits": true
    }
}

The corresponding class property in your settings.ts will be of type number, as the list value will pass in a number a valueFormatter can use in the value parameter of the ValueFormatterOptions.

Here's some examples from one of my custom visuals (we're looking at the labelDisplayUnits object):

Hopefully this gets you moving!

Daniel

 

EDIT: the formatting type also has support for fontSize and alignment, values which will add selectors for font size and graphics for left/centre/right alignment as in the properties pane. Here's the section of the JSON schema for capabilities, which documents the formatting object type.

DOUBLE EDIT: looks like fontFamily was added a while back, too; that'll be worth exploring at some point...

optimusprime Regular Visitor
Regular Visitor

Re: Custom Visual displayUnits drop down menu

@dm-p  Thank you so much for your help!  Every time your suggestions/tutorial guided us to solution.  We just made our first custom visual KPI card.

Thank you!

 

 

dm-p Established Member
Established Member

Re: Custom Visual displayUnits drop down menu

Hi @optimusprime - that's great to hear! Onwards and upwards! Smiley Happy

Helpful resources

Announcements
Back to School Contest

Back to School Contest

Engage and empower students with Power BI!

MBAS Gallery

Watch Sessions On Demand!

Continue your learning in our online communities.

Summit Australia 2019

Summit Australia 2019

Travel to Melbourne and network with thousands of peers!

PBI Community Highlights

PBI Community Highlights

Check out what's new in the Power BI Community!

Top Ideas
Users Online
Currently online: 31 members 925 guests
Please welcome our newest community members: