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

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

Reply
KennethWang
Frequent Visitor

Custom Object Formatting

Hi All,

 

I tried searching for this topic thinking it would be popoular. I just couldn't nail the keywords correctly and nothing comes up.

 

My question is, when you build a custom visual, is there a way to dynamic populate the formatting tab so that you can create some settings/formatting around them? For example, in the diagram below, the data color for each data node can be changed individually.

 

CustomFormatting.jpg

 

Is this possible in custom visual? Thank you.

 

Regards,

 

Kenneth

1 ACCEPTED SOLUTION
dm-p
Super User
Super User

Hi @KennethWang

This is possible in custom visuals - there is a specific portion of the tutorial in the sample bar chart repo for it, and this is pretty much the scenario you've added the image for.

This is all covered in the example in more detail but in short, you need to do the following:

  • Define a template object in your capabilities.json you can use for each value.
  • Add a property to your view model for each category's colour.
  • Create selectionIds for the items you want to appear in the properties pane (more about selection) when mapping your view model.
  • Also, when mapping your view model, you need to set the colour by looking in the dataView for any stored values based on this selectionId. If there is nothing found (which there typically won't be the first time), then this needs to be assigned a suitable default.
  • In your enumerateObjectInstances method (in visual.ts), you need to iterate through your categories from your view model and create colour pickers based on the vales set in your view model mapping, and use the template object defined in your capabilities.json above. Each one needs the selectionId also, so it knows where to store the value to in the dataView when the user sets it in the properties pane.

If this is all set up accordingly, the colour should be stored in the dataView and retrieved correctly for subsequent updates. If the colour changes back after selection, then there is an issue with the selectionId and you might need to review this to get it to work.

Good luck!

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

2 REPLIES 2
dm-p
Super User
Super User

Hi @KennethWang

This is possible in custom visuals - there is a specific portion of the tutorial in the sample bar chart repo for it, and this is pretty much the scenario you've added the image for.

This is all covered in the example in more detail but in short, you need to do the following:

  • Define a template object in your capabilities.json you can use for each value.
  • Add a property to your view model for each category's colour.
  • Create selectionIds for the items you want to appear in the properties pane (more about selection) when mapping your view model.
  • Also, when mapping your view model, you need to set the colour by looking in the dataView for any stored values based on this selectionId. If there is nothing found (which there typically won't be the first time), then this needs to be assigned a suitable default.
  • In your enumerateObjectInstances method (in visual.ts), you need to iterate through your categories from your view model and create colour pickers based on the vales set in your view model mapping, and use the template object defined in your capabilities.json above. Each one needs the selectionId also, so it knows where to store the value to in the dataView when the user sets it in the properties pane.

If this is all set up accordingly, the colour should be stored in the dataView and retrieved correctly for subsequent updates. If the colour changes back after selection, then there is an issue with the selectionId and you might need to review this to get it to work.

Good luck!

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)




Thank you!

 

I can't mention enough how much that has helped. It took me a while to get through your points layers by layers and also with reference to the bar chart. I also fell into the SelectionID issue as you have foresighted, mainly because I have multiple Categories and also processed the categories in a way different from the usual bar charts. 

 

You are awesome!

 

Regards,

 

Kenneth

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.