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
saviourofdp
Frequent Visitor

Font Size Property Unit Issue in Custom Visual

Hello 

 

I have an issue with creating a custom visual in which I need to be able to set 2 different font sizes from the property pane. The issue is that the first font size control is a slider which allows values from 8-40 whereas subsequent controls allow 0-100 percent.

 

I can show this using the basic new visualisation

 

 

pbiviz new fontVisual
npm install

Then edit capabilities.json to include a second font size property (in this case "fontSize1")

 

},
                "fontSize": {
                    "displayName": "Text Size",
                    "type": {
                        "formatting": {
                            "fontSize": true
                        }
                    }
                },
                "fontSize1": {
                    "displayName": "Text Size 1",
                    "type": {
                        "formatting": {
                            "fontSize": true
                        }
                    }
                }

 

 Update settings.ts to include the new property

 

     // Text Size
      public fontSize: number = 12;
      public fontSize1: number = 12;

Then build and run

 

pbiviz start

This is the result

 

2 different font size controls2 different font size controls 

Is this the expected behaviour? Or is the second font size meant to be a percentage of the first? If not, Is there any way I can make them the same control?

 

Thanks 

1 ACCEPTED SOLUTION
v-viig
Community Champion
Community Champion

Hello @saviourofdp

 

The fontSize is predefined Power BI capabilities name.

You might try to rename the second fontSize property to textSize, titleFontSize, secFontSize, secTitleFontSize.

 

Ignat Vilesov,

Software Engineer

 

Microsoft Power BI Custom Visuals

pbicvsupport@microsoft.com

View solution in original post

12 REPLIES 12

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.