cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
skizofre3e Member
Member

Unable to read default color object

 

In my capabilities.json I defind an object called color. I'm trying to define it inside my custom visual using : 

             
 
startingColor: getValue<string>(options.dataViews[0].metadata.objects,'colors','startingColor',"#111111"),
 
 But I'm unable to read the default color, since the visual is not running untill I define a new color in the styling pane.
 
4 REPLIES 4
Moderator v-viig
Moderator

Re: Unable to read default color object

Hello @skizofre3e,

 

Power BI doesn't allow to get default color. However, you might define your own default color to return it to Power BI as a default.

You just need to apply your default color if there's no color in the metadata.

 

Ignat Vilesov,

Software Engineer

 

Microsoft Power BI Custom Visuals

pbicvsupport@microsoft.com

satishr Member
Member

Re: Unable to read default color object

Can you please let me know how to do it? How can I check whether the metadata available or not?

Moderator v-viig
Moderator

Re: Unable to read default color object

Can you share implementation of getValue function that you use to get color from the metadata?

 

Ignat Vilesov,

Software Engineer

 

Microsoft Power BI Custom Visuals

pbicvsupport@microsoft.com

 

Highlighted
satishr Member
Member

Re: Unable to read default color object

I figured it out. Thanks. I'm using the condition if (options.dataViews[0].metadata.objects) to check whether the user has made any changes in the format pane or not.

Helpful resources

Announcements
Can You Solve These Challenge

Challenge: Can You Solve These?

Find out how to participate in the first Power BI 'Can You Solve These?' challenge.

Community News & Announcements

Community News & Announcements

Get your latest community news and announcements.

Virtual Launch Event

Microsoft Business Applications October Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

Community Kudopalooza

Win Power BI Swag with Community Kudopalooza!

Each week, complete activities and be qualified in the drawing for cool Power BI Swag.

Top Kudoed Authors
Users Online
Currently online: 60 members 1,309 guests
Please welcome our newest community members: