Skip to main content

Notifications

Community site session details

Community site session details

Session Id : Fb7+cBYX+cOIvvBN6FoeGh
Power Apps - Building Power Apps
Unanswered

Pie chart colour conditions

Like (0) ShareShare
ReportReport
Posted on 25 Aug 2023 14:29:04 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:
  • BCBuizer Profile Picture
    22,070 Super User 2025 Season 1 on 06 Oct 2023 at 19:38:14
    Re: Pie chart colour conditions

    Hi @DJIX12 ,

     

    Can you please use what you have for the Pie Chart Items property and apply that to the Items property of the hidden gallery. Then set the Items property of the pie chart to refer to galHidden.AllItems as per my earlier post: https://powerusers.microsoft.com/t5/Building-Power-Apps/Pie-chart-colour-conditions/m-p/2316602/highlight/true#M578990

  • DJIX12 Profile Picture
    63 on 06 Oct 2023 at 12:39:53
    Re: Pie chart colour conditions
    For the gallery it is:
    Filter(SOURCE, 'Trans Type'.Value = "Type1",
       'Created By'.DisplayName = Dropdown3.Selected.displayName)
     
    For my pie chart the items property is:
    AddColumns(
        GroupBy(Filter(SOURCE,
        'Created By'.DisplayName = Dropdown3_5.Selected.displayName),
        "First_x003f_","GroupData"),
        "Percentage",
         CountRows(GroupData)/CountRows(Filter(SOURCE,
         'Created By'.DisplayName = Dropdown3_5.Selected.displayName))
    )
  • BCBuizer Profile Picture
    22,070 Super User 2025 Season 1 on 05 Oct 2023 at 20:32:23
    Re: Pie chart colour conditions

    Hi @DJIX12 ,

     

    Can you please share the Items property of that gallery?

  • DJIX12 Profile Picture
    63 on 05 Oct 2023 at 14:27:14
    Re: Pie chart colour conditions

    Sorry I was away from work for a bit. The hidden gallery trick doesn't work for my case because the gallery would give me every line item as supposed to giving me a count of items = true and items = false like your gallery does.

  • BCBuizer Profile Picture
    22,070 Super User 2025 Season 1 on 28 Aug 2023 at 12:07:31
    Re: Pie chart colour conditions

    Hi @DJIX12 ,

     

    How are you coming along with this? Hope you managed to get everything working.

  • BCBuizer Profile Picture
    22,070 Super User 2025 Season 1 on 25 Aug 2023 at 15:25:24
    Re: Pie chart colour conditions

    Hi @DJIX12 ,

     

    No it wouldn't, but that's not necessary since the colours will follow the data rather than the other way around.

  • DJIX12 Profile Picture
    63 on 25 Aug 2023 at 15:22:01
    Re: Pie chart colour conditions

    But the gallery wouldn't be sorted would it?

  • BCBuizer Profile Picture
    22,070 Super User 2025 Season 1 on 25 Aug 2023 at 15:12:31
    Re: Pie chart colour conditions

    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.

  • DJIX12 Profile Picture
    63 on 25 Aug 2023 at 15:06:12
    Re: Pie chart colour conditions

    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,070 Super User 2025 Season 1 on 25 Aug 2023 at 15:03:30
    Re: Pie chart colour conditions

    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

     

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

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Power Apps - Building Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 98 Most Valuable Professional

#2
MS.Ragavendar Profile Picture

MS.Ragavendar 60

#3
stampcoin Profile Picture

stampcoin 48

Overall leaderboard