web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Pie chart colour condi...
Power Apps
Unanswered

Pie chart colour conditions

(0) ShareShare
ReportReport
Posted on by 63

Hi all,

 

Can't figure out how to get the conditions of the colours of my chart to correspond to the true false value... For context, the chart is getting data from a collection and I think the first data dictates whether true or false will be red and the other would be green. 

DJIX12_0-1692973691504.png

Is there a - If true = green, if false = red condition?

Categories:
I have the same question (0)
  • Geeks_D Profile Picture
    1,169 on at

    To manage colors for chart 
    You fix that in the side bar 

    Geeks_D_0-1692974143964.png

    The Item color set is hierarchical the first item in your collection takes the first RGBA from the item color set .. second item in your collection takes second just like that 
    You can also put in your if statement here 

  • DJIX12 Profile Picture
    63 on at

    What would the syntax look like if I wanted True = Green, False = Red?

  • BCBuizer Profile Picture
    22,510 Super User 2025 Season 2 on at

    Hi @DJIX12 ,

     

    Colors in the pie chart are assigned in order at which they are in the ItemColorSet property of the PieChart control.

     

    For instance, with the ItemColorSet property set to [Color.Green, Color.Red]

     

    When setting the Items property to first show the True percentage ( [{Label: "True", Percentage: 70}, {Label: "False", Percentage: 30}] ), this is what the chart looks like: 

     

    BCBuizer_0-1692974657511.png

     

     

    However, if you first offer the false percentage ( [{Label: "False", Percentage: 30}, {Label: "True", Percentage: 70}] ), the colours are reversed:

    BCBuizer_1-1692974744188.png

     

    So if you want a certain label to match with a certain colour, match the position in the tables for the Items and ItemColorSet.

  • Geeks_D Profile Picture
    1,169 on at

    @BCBuizer analysis solves it 
    If the first in your chart collection is true , the Item color Set first color should be green 
    Then the second Item is False, the Color set item should be red 

  • DJIX12 Profile Picture
    63 on at

    Issue is the first item is dynamically changing month over month. So I require a workaround

  • Geeks_D Profile Picture
    1,169 on at

    You might need to adjust your collection to have a threshold to keep some items true and other false 

  • DJIX12 Profile Picture
    63 on at

    Is there a way to sort the data so it's true first and false following? This is my syntax

     

    AddColumns(
    GroupBy(Filter(Source, 'Transaction'.Value = "ABC123"), "FirstTimeRight_x003f_","GroupData"),
    "Percentage",
    CountRows(GroupData)/CountRows(Filter(Source, 'Transaction'.Value = "ABC123"))

    )

  • BCBuizer Profile Picture
    22,510 Super User 2025 Season 2 on at

    Hi @DJIX12 ,

     

    May I ask what the Items property of your Piechart looks like?

     

    In case you are using a collection, you could use something like the below for the ItemColorSet:

     

    ForAll(
     colPiechart,
     Switch(
     ThisRecord.Label,
     "True", Color.Green,
     "False", Color.Red
     )
    )

     

    FYI this is what the collection looks like:

    ClearCollect(
     colPiechart,
     [{Label: "False", Percentage: 30}, {Label: "True", Percentage: 70}]
    )

    and this is the result:

    BCBuizer_0-1692975802131.png

     

  • DJIX12 Profile Picture
    63 on at

    It is a collection and this is the items property for my pie chart

     

    AddColumns(
    GroupBy(Filter(Source, 'Transaction'.Value = "ABC123"), "FirstTimeRight_x003f_","GroupData"),
    "Percentage",
    CountRows(GroupData)/CountRows(Filter(Source, 'Transaction'.Value = "ABC123"))

    )

  • BCBuizer Profile Picture
    22,510 Super User 2025 Season 2 on at

    Hi @DJIX12 ,

     

    What you can do is to insert a hidden gallery and set its' Items property to what you currently have as the Items property of the Piechart. Like this it can be referenced from both the Items and ItemColorSet properties of the PieChart:

     

    BCBuizer_0-1692976293798.png

     

    In the above I left galHidden visible to show what I mean, but its' Visible property should be set to false.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 765 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 272

Last 30 days Overall leaderboard