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
callum
Helper II
Helper II

Only calling update when visual size has "settled"

I have a visual that performs a lot of calculations when the update() method is called.

 

Normally this is fine, for example when I just click the refresh button it works fine.

 

However, I realised that when one resizes a visual, the update method essentially gets called nonstop. For example if I resize it from 500x200 to 300x200 I guess it gets called 200 times.

 

Anyway, because of the number of calculations my visual has to perform with each update, this just ends up crashing my browser!

 

Is there perhaps a way to make the update method only be called when the size is not still in the process of being adjusted? Or some other way to prevent this issue?

 

I'm not sure how feasible it would be to make the code more efficient without reducing its functionality unfortunately, so I'd rather try other methods before going down that route!

1 ACCEPTED SOLUTION
MeQT
Frequent Visitor

Hey,

 

for me this worked quite nice

public update(options: VisualUpdateOptions){
     if(options.type == VisualUpdateType.ResizeEnd)
     {
        // code here
     }
}

View solution in original post

2 REPLIES 2
v-chuncz-msft
Community Support
Community Support

@callum,

 

As mentioned above, you may make a distinction between VisualUpdateType.Resize and VisualUpdateType.Resize + VisualUpdateType.ResizeEnd.

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.
MeQT
Frequent Visitor

Hey,

 

for me this worked quite nice

public update(options: VisualUpdateOptions){
     if(options.type == VisualUpdateType.ResizeEnd)
     {
        // code here
     }
}

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.