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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Anonymous
Not applicable

Set default visual viewport size in custom visual

Is there a way to set the defaul viewport size when start a custom visual?  Thanks.

1 ACCEPTED SOLUTION
dm-p
Super User
Super User

Hi there,

It's currently not possible, but has been accepted onto the backlog. I'd suggest adding a vote to the idea and watching it for progress.

Regards,

Daniel





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!


On how to ask a technical question, if you really want an answer (courtesy of SQLBI)




View solution in original post

6 REPLIES 6
taghos
Microsoft Employee
Microsoft Employee

Just wondering, if there has been an update on the same?

I want to set a fixed width and height by default for a custom visual I am developing. Currently in I try to do options.viewport.width=800 in say Visual's constructor or update method, it's not respecting it.

Hi @taghos - there have been no new features added to the SDK for 9-10 months, so this is still not possible. The only manipulation of the viewport in the SDK is to maximise it to full screen mode by using switchFocusModeState on the visual host object.

Your best bet is to contact the custom visuals team - pbicvsupport@microsoft.com - if you need a direct answer.

Regards,

Daniel

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!


On how to ask a technical question, if you really want an answer (courtesy of SQLBI)




taghos
Microsoft Employee
Microsoft Employee

Yes, I followed up with pbicvsupport@microsoft.com team and they confirmed that the viewport properties like width and height could not be set as of now.

Also, I have another related question -> Although we can't set the viewport properties but at any point we can get and read the values(width & height) as described here: https://microsoft.github.io/PowerBI-visuals/tutorials/building-react-based-custom-visual/receiving-p.... Just wanted to check if there is any variable corresponding to the transparency under Background? I just want to get the transparency value in % or fraction of the current window.

This is probably another question to the team to confirm. I suspect that we can't do this - advice I have been provided previously is that standard properties are not accessible through the SDK, unless exposed to the host services.

I just tested and inspected checked the host.colorPalette object in my constructor and this doesn't correspond to the value I set in my visual properties, so I presume this pulls from the report theme.

I also checked to see if the sandbox has anything passed through as part of its CSS from the parent window, but this appears to be set far above the iframe sandbox in the DOM in a div with a class of themableBackgroundColor, meaning that the style is several levels higher and therefore inaccessible.





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!


On how to ask a technical question, if you really want an answer (courtesy of SQLBI)




dm-p
Super User
Super User

Hi there,

It's currently not possible, but has been accepted onto the backlog. I'd suggest adding a vote to the idea and watching it for progress.

Regards,

Daniel





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!


On how to ask a technical question, if you really want an answer (courtesy of SQLBI)




Anyone know if there has been any movement on this?  Looks like the idea was accepted a year ago.

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

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