This question is locked. New answers and comments are not allowed.
HI, I have a problem trying to set an item of my pie chart, I have two pie chart that are related, if I click in one item, the other chart is refreshed automatically, but if one item was selected previously... I need to keep this selection, so I checked this sample : http://demos.telerik.com/silverlight/#Chart/Selection to see how is doing...
this is my scenario, I have two charts, one chart has fruits and the other chart has colors, when I load the page, there are no selected items, after that I select one fruit (apple), so apple item is exploded, now I want to select a color (red) from the other chart, because my fisrt chart has one selected item, I need to keep this selection, this is my code:
DataSeries series = this.RadChartCategoryService.DefaultView.ChartArea.DataSeries[0]; foreach (DataPoint point in series) { if (((DashboardChart)point.DataItem).ID == index) { this.RadChartCategoryService.DefaultView.ChartArea.SelectItem(point); break; } }As soon as I call SelectItem, the SelectionChanged item is fired, in this case the dataPoint is always null and the problem is that my previous item was not keeped exploded. I saw in your example that is using a variable propagateSelection, is there anything else that I should do? only with SelectItem should explodes the item? why dataPoint is null in this case?
DataPoint dataPoint = null; if (e.AddedItems.Count > 0) dataPoint = e.AddedItems[0]; else if (e.RemovedItems.Count > 0) dataPoint = e.RemovedItems[0]; if (dataPoint != null) { TMEGlobals.TypeOfServices currentChart = ((TMEGlobals.TypeOfServices)this.CategoryTypeUC.RadChartCategoryService.Tag); Nullable<int> selectedID = ((DashboardChart)dataPoint.DataItem).ID; if (this.CategoryTypeUC.SelectedItemChart == selectedID) { this.CategoryTypeUC.SelectedItemChart = null; if (currentChart == TMEGlobals.TypeOfServices.ShowServiceType) { dashboardFilter.ServiceTypeID = null; } else { dashboardFilter.ServiceCategoryID = null; } this.ProviderUC.Load(dashboardFilter); this.MonthlyCostUC.Load(dashboardFilter, this.OrganizationUnitUC.RadGridViewOrgUnit); if (currentChart == TMEGlobals.TypeOfServices.ShowServiceCategory) { this.CategoryTypeUC.ImageSwitchService.Visibility = Visibility.Collapsed; } } else { this.CategoryTypeUC.SelectedItemChart = selectedID; if (currentChart == TMEGlobals.TypeOfServices.ShowServiceType) { dashboardFilter.ServiceTypeID = selectedID; } else { dashboardFilter.ServiceCategoryID = selectedID; } this.ProviderUC.Load(dashboardFilter); this.MonthlyCostUC.Load(dashboardFilter, this.OrganizationUnitUC.RadGridViewOrgUnit); if (this.CategoryTypeUC.ShowAlwaysServiceTypes == false) { this.CategoryTypeUC.ImageSwitchService.Visibility = System.Windows.Visibility.Visible; if (currentChart == TMEGlobals.TypeOfServices.ShowServiceCategory) { this.CategoryTypeUC.ToolTipSwitchService.Content = TMEGlobals.GetLanguageString("show_service_type"); } if (currentChart == TMEGlobals.TypeOfServices.ShowServiceType) { this.CategoryTypeUC.ToolTipSwitchService.Content = TMEGlobals.GetLanguageString("show_service_category"); } } } }is there any other example that I can see? I tried with a button and when I call SelectItem it works! the DataPoint is not null but I want it to be automatic... Any idea?
Thank you.