Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Building Power Apps
Unanswered

Changing colours on a pie chart

Like (0) ShareShare
ReportReport
Posted on 3 Nov 2021 16:37:38 by 389

Hi all,

 

This may be quite simple but I cant figure out on how to change the slice colours in a pie chart any ideas?

 

Screenshot 2021-11-03 at 4.31.53 PM.png

  • RandyHayes Profile Picture
    76,287 Super User 2024 Season 1 on 04 Nov 2021 at 21:43:08
    Re: Changing colours on a pie chart

    @AB1 

    Your Items property is the data for the chart.  It will not contain colors.

    The ItemColorSet is a table of colors that will govern how the slices look.

    For example, this default pie chart and changing it's colors:

    AB1.gif

    To accomplish this is very simple.  The dropdown control in the image has an items property of:

    Table(
     {Disp: "Original Colors", ColorSet:
     [RGBA(49, 130, 93, 1),RGBA(48,166,103, 1), RGBA(94,193,108,1), 
     RGBA(246,199,144,1), RGBA(247,199,114,1), RGBA(247,180,91,1), 
     RGBA(246,143,100,1), RGBA(212,96,104,1), RGBA(148, 110, 176, 1), 
     RGBA(118, 154, 204, 1), RGBA(96, 197, 234, 1)]
     },
     {Disp: "Wild Colors", ColorSet: 
     [Red, Green, Yellow, Blue, DarkGreen, LightBlue, urple, DarkGray, 
     DarkMagenta, LightSteelBlue]
     },
     {Disp: "Crazy Colors", ColorSet: 
     [Magenta, Purple, DarkMagenta, Crimson, DarkOrchid, DeepPink, GreenYellow,
     MediumSpringGreen, SlateBlue, Yellow]
     }
    )

    You will see in this that the first record "Original Colors" has a column called ColorSet that is a table of all the colors that were found in the default PieChart.

    The second and third records just have different names and ColorSet tables.

     

    For the Pie Chart, the ItemColorSet is set to: drpColorSelector.Selected.ColorSet  (where drpColorSelector is the name of the Dropdown mentioned above).

     

    That is all there is to it!

     

    So, you obviously don't need a dropdown to change colors and this was JUST a demonstration, but the key point here is that the ItemsColorSet table determines the colors used in the Pie Chart.  The order of the colors in the table will correspond to the order of the items in the table supplied to the Items property of the Pie Chart.

     

     

  • AB1 Profile Picture
    389 on 04 Nov 2021 at 21:12:54
    Re: Changing colours on a pie chart

    Hi @RandyHayes So it can be changed and I have to had in item property? Can even specify the slice colour? (if this makes sense)

  • RandyHayes Profile Picture
    76,287 Super User 2024 Season 1 on 03 Nov 2021 at 17:25:51
    Re: Changing colours on a pie chart

    @AB1 

    Colors are controlled by the ItemColorSet property.  It expects a table of color values. The order of the colors in that table correlates to the order of the items in your Items property.

     

    I hope this is helpful for you.

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

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Warren Belz – Community Spotlight

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

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,731 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 66,075 Most Valuable Professional

Leaderboard
Loading started