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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / How to UnSelect from P...
Power Apps
Unanswered

How to UnSelect from Pie Chart

(0) ShareShare
ReportReport
Posted on by 144

Hey guys!  I'm looking for a way to deselect the section of a pie chart.

I'm using the onselect to navigate to different pages from the pie chart.  The issue, is when you get pack to the pie chart you have to first, click outside of the chart to deselect, and then reselect a section to get to a different page.

Any ideas how to get this pie chart to reset?  

Categories:
I have the same question (0)
  • Max44 Profile Picture
    223 on at

    Within the function chartValueSelected which is called when a slice has been selected/highlighted, I set a global variable containing the DataSetIndex:

    var dataSetIndexToDeselect : Int = 0
    func chartValueSelected(chartView: ChartViewBase, entry: ChartDataEntry, dataSetIndex: Int, highlight: ChartHighlight) {
    dataSetIndexToDeselect = dataSetIndex
    }
    On the button click, i unhighlight the slice by adding the following line the the IBAction:

    @IBAction func buttonClick(sender: AnyObject) {
    pieChartView.highlightValue(xIndex: -1, dataSetIndex: dataSetIndexToDeselect, callDelegate: false)
    }
    The '-1' on the xIndex causes the 'dataSetIndexToDeselect' value to no longer be selected.

  • Connor551 Profile Picture
    144 on at

    @Max44  Thanks for the reply Max!  

    I'm not sure I'm following you - can you show me what you mean? 

  • cp_matthew Profile Picture
    4 on at

    Just posted about this in another old thread, thought it worth sharing here as well (hope that is within the rules) for all the googlers trying to figure out how to solve this one...

     

    Old topic but in case others are stuck on this I wanted to share another solution (perhaps variation on previous solutions) that worked for my case. 

     

    Assuming your chart Items property points to a collection (or involves a collection as a datasource) then adding and then removing a row of 'dummy data' on the collection will reset / deselect the selected segment of the chart. 

     

    This is the example, which may need adjustment if your collection doesn't have  a column named 'Title' (in which case just replace this section with a text column that does appear in your collection.

     

    This worked for me because I specifically wanted the reset / deselect to be attached to another button in the screen which performed other actions that I won't go into. Either way perhaps the principle of why it worked - that changes to the datasource or refresh of datasource triggers chart to reset 'selected' properties - may assist in hacking your solution to the challenge.

     

     

    Collect(
     YOURCOLLECTIONNAME,
     {Title: "REMOVE"}
    );
    Remove(
     YOURCOLLECTIONNAME,
     LookUp(
     YOURCOLLECTIONNAME,
     Title = "REMOVE"
     )
    )

     

     

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 765 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 272

Last 30 days Overall leaderboard