web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Create Pie Chart based...
Power Apps
Answered

Create Pie Chart based on TextInput

(0) ShareShare
ReportReport
Posted on by 140

Hello,

 

I have 5 TextInput fields, these field include calculations. The result of these calculations is 100%.

Now I want to show these 5 Values in a Pie Chart. Is that possible?

Categories:
  • mdevaney Profile Picture
    29,993 Moderator on at

    @chhe 
    Do these values only exist in a TextInput field or are you reading them from a datasource?

    Please show a screenshot of your app.

     

    ---
    Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

  • chhe Profile Picture
    140 on at

    These Values are only stored in these TextInput field. Behind these Screen is a Sharepoint list.

    This view filters and counts the rows in the sharepoint list. The list stores different tasks sorted in categories. Each category is count how many tasks are in there.

     

    Then I calculate the percentage of each category. This result should be displayed in a Pie Chart.

    This Table is created by separate TextInput fields. Is there a better way to do this?

     

    02.jpg

  • chhe Profile Picture
    140 on at

    @mdevaney 

     

    Do you need more information? If you need specific information, let me know.

  • v-siky-msft Profile Picture
    Microsoft Employee on at

    Hi @chhe ,

     

    To create the pie chart, you have to first format the textinput value into the collection.

    Take the second row for example:

    1. add a button, set OnSelect property as below:

     

    ClearCollect(Col_1, {Value:TextInput1.Text, Label: "Category1"},{Value:TextInput2.Text, Label: "Category2"},{Value:TextInput3.Text, Label: "Category3"},{Value:TextInput4.Text, Label: "Category4"},{Value:TextInput5.Text, Label: "Category5"})

     

    2. Add a Pie Chart, Set items property of Pie chart to Col_1, set Series to Value, set Labels to Label

    Snipaste_2020-04-07_13-58-17.pngSnipaste_2020-04-07_14-04-05.png

    Hope this helps.

    Sik

  • mdevaney Profile Picture
    29,993 Moderator on at

    @chhe 

    The solution provided by @v-siky-msft seems correct.  Please give it a try.

  • chhe Profile Picture
    140 on at

    Hi,

     

    yes this works. Thank you very much! 🙂

    But now I want that the data is load and stored in a collection if the app is opened. So I have stored the code in the "onStart" from the app... But then the Chart is empty if I open the app? 

     

  • v-siky-msft Profile Picture
    Microsoft Employee on at

    Hi @chhe ,

     

    How and when do you calculate and show the value in these text input boxes? Please share more about this.

    The problem may be that when you create the collection at App.OnStart, there is no value in the text box, so the collection and Pie chart is empty.

    Please consider creating the collection after the field calculation is complete.

    Otherwise, you can replace the TextInput.Text by the calculate code into ClearCollect funciton at App.OnStart, like this:

     

    ClearCollect(Col_1, {Value:<The code of calcuation>, Label: "Category1"},{Value:<The code of calcuation>, Label: "Category2"},{Value:<The code of calcuation>, Label: "Category3"},{Value:<The code of calcuation>, Label: "Category4"},{Value:<The code of calcuation>, Label: "Category5"})

     

    Hope this helps.

    Sik

  • chhe Profile Picture
    140 on at

    Hi,

     

    I calculate these values by this code:

     

    Text(Value('TextInput1'/TextInput2)*100;"[$-de-DE]##0,#%";"de-DE")

     

    TextInput1 and TextInput2 are also calculated fields, they sum a column from a collection.

    I have integrated a workaround with a timer. I have put the ClearCollect code in "OnTimerStart" this works for now, but I think this isn't a good solution?

  • Verified answer
    v-siky-msft Profile Picture
    Microsoft Employee on at

    Hi @chhe ,

     

    Yes, the best solution I think is to set the items property of Pie chart as below, no need to format as a collection.

    Please have a try.

    Table({Value:TextInput1.Text, Label: "Category1"},{Value:TextInput2.Text, Label: "Category2"},{Value:TextInput3.Text, Label: "Category3"},{Value:TextInput4.Text, Label: "Category4"},{Value:TextInput5.Text, Label: "Category5"})

    Sik

     

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 402 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 328

#3
WarrenBelz Profile Picture

WarrenBelz 296 Most Valuable Professional

Last 30 days Overall leaderboard