cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Sephiel
Level: Powered On

Pie chart colors by specific values? (Item property is nested calculation)

Hi all,

 

I've got hopefully a simple request, but layered in a few issues. I've got pie charts showing a percentage progress of files I get, which I mark "yes" when I get the files I need (it's a Yes/No column). So this is a simple true or false pie chart. Problem is, the colors can change depending on the status of the first record in my SharePoint list. This image below has it's ItemColorSet to where Red is first (because the first record is false) and the Green is true. I didn't realize that the order of colors is based on the value of the column in the first record. If I change it to true, the colors switch and are incorrect.

 

Capture2.PNG

 

So I saw through other posts that you can define the colors based on the result using ItemColorSet and the Switch function, but I must be doing something wrong, as it shows colors I haven't defined:

 

Capture3.PNG

 

Do I need to use a different column? AddColumn? Not sure, I'm stuck!

 

Thanks very much for the help Smiley Happy

5 REPLIES 5
Community Support Team
Community Support Team

Re: Pie chart colors by specific values? (Item property is nested calculation)

HI @Sephiel,

Can you share a bit more about your issue?

Can you show me the error info about your issue?

Do you want to define the color based on the result?

 

I made a test . 

I created a sharepoint list named ‘test3.

10.PNG

 

11.PNG

Set items property of piechart1 to:

AddColumns(GroupBy(test3,"columnname","GroupData"),"percentagedatatotal",CountRows(GroupData)/CountRows(test3))

Set itemcolorset property of piechart1 to:

ForAll(test3,Switch(columnname,true,Color.Green,false,Color.Red,Color.Gray))

regards,

eason

Community Support Team _ Eason YU
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Sephiel
Level: Powered On

Re: Pie chart colors by specific values? (Item property is nested calculation)

Hi Eason! You are exactly right - I want to define the color by the results of the record in the column. It's a yes/no column so the only options are true and false.

 

So, your example at least got me a result, which was further than I was able to take it - however the colors it's showing are wrong...

 

See my attached image for the code! 

Community Support Team
Community Support Team

Re: Pie chart colors by specific values? (Item property is nested calculation)

hi @Sephiel,

 

please try to recreate a Pie Chart and check if it is solved

 

regards,

eason

Community Support Team _ Eason YU
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Sephiel
Level: Powered On

Re: Pie chart colors by specific values? (Item property is nested calculation)

Capture.PNG

 

Hi Eason, here is a new screen with a new pie chart applied - same code to group the records by true/false but with your ItemColorSet code. Still getting the light green/blue combo instead of red and green.

 

Now that I think back - the column in question is actually a calculated column based on an ISBLANK of a different column. But the result is set to yes/no, and the resulting colors are still the same.

 

Capture2.PNG

 

I also tried publishing the app and looking at the published results as I have heard sometimes that changes things. No changes for my app though.

 

Any insight greatly appreciated!

Sephiel
Level: Powered On

Re: Pie chart colors by specific values? (Item property is nested calculation)

Also I tried changing the result of the first record of that column to "true" - the colors switched, which tells me that the ItemColorSet code seems to be bypassed to get this result, and it's defaulting to the colors displayed when there is a blank ItemColorSet.

 

Capture3.PNG

Helpful resources

Announcements
New Ranks and Rank Icons in April

'New Ranks and Rank Icons in April

Read the announcement for more information!

Better Together’ Contest Finalists Announced!

'Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

thirdimage

Community Summit North America

Innovate, Collaborate, Grow - The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors
Users online (4,878)