I have two pie charts side by side and I'm capturing the selected slice from the charts. My problem is when I select a slice on one Pie Chart and then go to the second Pie Chart and select a new slice, the first chart retains its selected slice. I can't
figure out how to clear the slice from the first chart so that only one slice between the two charts is displayed. Does anyone know if this is possible and how to approach it? Something tells me it's easy and I'm just overlooking the solution.
I tried using "Refresh" and its close to being a workable solution, but I'm using the default chart styles and each time I refresh the chart it redraws the chart in a new set of colors (is there a quick way to turn that off without having to set all of
my own styles?).
Thanks for assistance in advance. If it helps, here's my code for handling the chart selection from one chart:
Private
Sub EmpPie_SelectionChanged(ByVal sender
As System.Object,
ByVal e
As System.Windows.Controls.SelectionChangedEventArgs)
Dim selectedKey
As KeyValuePair(Of
String,
Integer)
' Clear Chart 1 Selection
' {Unselect Code would go Here}
' Check for Employment Size Pie Chart Selection
If e.AddedItems.Count > 0
Then
selectedKey = e.AddedItems.Item(0)
' Get data associated with the new selection - Build Selection Filter String
Call subBuildSelectionString("EmploymentSize",
selectedKey.Key)
End
If
' Clean Up
Try setting "mySeries.SelectedItem = null;" on the Series you want to remove selection from. There's an example of this in the samples page for PieSeries, as it happens.
CS465
Member
15 Points
10 Posts
Clear Pie Chart Slice Selection
Jun 02, 2009 05:05 PM | LINK
Thanks for assistance in advance. If it helps, here's my code for handling the chart selection from one chart:
Private Sub EmpPie_SelectionChanged(ByVal sender As System.Object, ByVal e As System.Windows.Controls.SelectionChangedEventArgs) Dim selectedKey As KeyValuePair(Of String, Integer) ' Clear Chart 1 Selection ' {Unselect Code would go Here} ' Check for Employment Size Pie Chart Selection If e.AddedItems.Count > 0 ThenselectedKey = e.AddedItems.Item(0)
' Get data associated with the new selection - Build Selection Filter String Call subBuildSelectionString("EmploymentSize", selectedKey.Key) End If ' Clean UpselectedKey =
Nothing End Subchart chart control
David Anson
Participant
1992 Points
249 Posts
Microsoft
Re: Clear Pie Chart Slice Selection
Jun 06, 2009 12:36 AM | LINK
Try setting "mySeries.SelectedItem = null;" on the Series you want to remove selection from. There's an example of this in the samples page for PieSeries, as it happens.
Hope this helps!
http://dlaa.me/
http://blogs.msdn.com/b/delay/
This posting is provided "AS IS" with no warranties, and confers no rights.