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
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (1,918)