Pie Chart Control in the Power Apps

The Pie chart control is used to show the Labels and their corresponding value of that label.

The Pie chart has the following properties: 1. Items The Items property specifies the source of data that appears in a control such as a gallery, a list, or a chart. 2. ShowLabels The ShowLabels property specifies whether a pie chart shows the value that is associated with each of its wedges. 3. Explode The Explode property specifies the distance between wedges in a pie chart. 4. LabelPosition The LabelPosition property specifies the location of labels in a pie chart relative to its wedges. 5. X The distance between the left edge of a control and the left edge of its parent container (screen if no parent container). 6. Y The distance between the top edge of a control and the top edge of the parent container (screen if no parent container).

1. Excel as the DataSource We can use the Excel table as a data source to create a pie chart in Power apps. The following excel file is used for this exercise Chart-controls.xlsx. You can download it by clicking on the link.
The name of the Table is Table1.

NameMarks
Suman45
Jyoti97
Akshay67
Laveena87
Lata46
Anjali85
Rohan48
Sumit97
Ashish70

Step 1: Add the Excel table in the Power app using Add Data section. Insert a Pie chart control to the screen by clicking on + Insert and then from the Charts section click on Pie chart.

Pie chart in Power Apps

Step 2: The Pie chart control is a group of three controls.

Pie chart in Power Apps

Step 3: There is a Text label control in the group, used to specify the title of the chart. By default, its name is ‘Chart Title’. We can modify it as per our requirement.

Pie chart in Power Apps

After updating the text of the Label control.

Pie chart in Power Apps

Step 4: Select the Pie chart control and set its Items property to the data source.

Pie chart in Power Apps

After setting the Items property to the data source Table1.

Pie chart in Power Apps

Step 5: We can set the ShowLabels property to true or false. By default, it is true.

Pie chart in Power Apps

After setting it to false.

Pie chart in Power Apps

Step 6: Set the Explodeproperty to the value 20. By default, it is 0.

Pie chart in Power Apps

After setting the value.

Pie chart in Power Apps

Step 7: Set the LabelPosition property to the value Inside. By default, its value is Outside.

Pie chart in Power Apps

After changing the Label position value to Inside.

Pie chart in Power Apps

2. Sharepoint as the DataSource

We can use the pie chart control with Sharepoint as a Data source.

TeacherIDTeacher nameTeacher QualificationTeacher salaryExpenditure
1SushmitaB. Tech26,00020,000
2Anjali SharmaMBA28,00022,000
3Lata VermaBBA22,00018,000
4AliaM. Tech34,00025,000
5VickyEngineer13,0006,000
6AakanshaLLB45,00023,000
7Shilpa ShettyYoga guru60,00015,000
Pie chart in Power Apps

Step 1: Add the sharepoint list in the power apps by using Add data section. Add one more Pie chart control and set the Items property to the ‘Teachers Data’, i.e., name of our sharepoint list.

Pie chart in Power Apps

We can see that we specify in the Labels the Teachername column and in the Series we are specifying the Teachersalary column from the sharepoint list. In the dropdown we can see all the columns including those that are created automatically when we create a list.

Step 2: In the ItemColorSet property we can specify the different color values of the control. We can give the color values directly or by using the RGBA format.

Pie chart in Power Apps

Suppose we are specifying for the first three values only and leave the rest.

Pie chart in Power Apps

Step 3: The Color property specifies the text color inside the control. Suppose we are giving this value to Color.White.

Pie chart in Power Apps

Step 4: Add a Text label control and set its Text property to the following powerapps formula:

Power Apps Formula

PieChart1_1.Selected.‘Teacher salary’

Here, PieChart1_1 is the name of our graphic control and by leveraging its Selected property we are fetching the entire record. From the record by using the dot notation concept we are extracting the ‘Teacher salary’ column value.

Pie chart in Power Apps

Put the preview mode and try by clicking on the various slices of the pie chart. Suppose we click on the Slice of Shilpa Shetty. The value in Text label changes to 60000, i.e., the Shilpa Shetty Salary.

Pie chart in Power Apps