cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
roknron
Helper I
Helper I

how to load pie chart when the application begins to run

I have an app that was created to track task catagories and the time spend on each catagory.  The pie is presneted correctly but it will not load when the app initially runs.  I have to either go to the new record screen and cancel or select the record edit screen then return to the browseGallery screen for the pie to be displayed.  In the onVisible property of the Gallery control a collection is created an agregate column and the pie chart card item property is set to the new agregate column in the collection.  How do I cause the pie to be generated at applicaton load?

 

Ron

3 REPLIES 3
v-monli-msft
Community Support
Community Support

Hi Ron,

 

If you create a new similar app, will this issue reproduce?

 

Regards,

Mona

Community Support Team _ Mona Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
mr-dang
Community Champion
Community Champion

Limitation: When you set the Items property of a Pie Chart to a Collection, you will have to add data into the Collection before anything shows up. Also, if you want to change any data to the Pie Chart, that requires you to recollect it to reflect changes.

 

As an alternative, the Table() function is perfect for the Items property of the Pie Chart because it show real-time data. You do not need to recollect data. It's probably the most underrated function in PowerApps since connected datasources are emphasized so much.

 

Below is an example of a formula used to summarize the level of proficiency of students as a whole:

Table(
	{label: "Advanced", num: CountRows(Filter(datasource,Score>=90))},
	{label: "Proficient", num: CountRows(Filter(datasource,Score<90 && Score>=80))},
	{label: "Basic", num: CountRows(Filter(datasource,Score<80 && Score>=70))},
	{label: "Below", num: CountRows(Filter(datasource,Score<70))}
)

Each record in a table is wrapped between curly brackets {}. Each record is separated by a comma. Within each record, each column includes its name, a colon, and its value.

 

The pie chart above expects 4 slices. The slices are named by the "label" column. The size of each slice is set to the "num" column. Rename things to your needs. 

 

If I add or remove any records from datasource, the changes will be immediately reflected in the Pie Chart since Table() is dynamic.

Microsoft Employee
@8bitclassroom

That's pretty cool. but, my lables are contained within the datasource and the agregate column that currently is in the contorl item property.  How do I apply this table formula to that situation?

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Power Apps June 2021

June Power Apps Community Call

Don't miss the call this month on June 16th - 8a PDT

Top Solution Authors
Top Kudoed Authors
Users online (74,834)