This question is locked. New answers and comments are not allowed.
Hi @
I am developing an application using SL 4, VS 2010. I am using Telerik Silverlight Chart controls in the application.
I am displaying Pie chart.
I have to show count of Employees in each organisation in Pie chart with Organisation in Legend positions.
I am getting correct chart but all the organisations in same color.
Please let me know i am doing something wrong in following code snippet.
/// <summary> /// Load pie chart /// </summary> /// <param name="selectionData">FilterResult list</param> private void LoadPieChart(FilterResult[] selectionData) { Binding binding = new Binding("DefaultView.ChartLegendPosition"); binding.Mode = BindingMode.TwoWay; LegendPosition.DataContext = trcRadPieChart; LegendPosition.SetBinding(RadComboBox.SelectedValueProperty, binding); Binding binding2 = new Binding("DefaultView.ChartLegend.LegendItemMarkerShape"); binding2.Mode = BindingMode.TwoWay; LegendItemMarkerShape.DataContext = trcRadPieChart; LegendItemMarkerShape.SetBinding(RadComboBox.SelectedValueProperty, binding2); this.trcRadPieChart.DefaultView.ChartTitle.Content = "Employee per Organisation"; this.trcRadPieChart.DefaultView.ChartArea.LabelFormatBehavior = LabelFormatBehavior.None; this.SetMappings(this.trcRadPieChart); this.trcRadPieChart.ItemsSource = selectionData; isPieChartSeriesMappingAdded = true; this.trcRadPieChart.DefaultView.ChartLegend.LegendItemMarkerShape = MarkerShape.Circle; } /// <summary> /// Set the mapping /// </summary> /// <param name="chart">RadChart</param> private void SetMappings(RadChart chart) { SeriesMapping seriesMapping = new SeriesMapping(); seriesMapping.SeriesDefinition = new PieSeriesDefinition(); seriesMapping.GroupingSettings.GroupDescriptors.Add(new ChartGroupDescriptor("ORGANISATION")); seriesMapping.GroupingSettings.ShouldCreateSeriesForLastGroup = true; ItemMapping itemMapping = new ItemMapping("EMPLOYEE", DataPointMember.YValue); seriesMapping.ItemMappings.Add(itemMapping); itemMapping = new ItemMapping("ORGANISATION", DataPointMember.LegendLabel); seriesMapping.ItemMappings.Add(itemMapping); chart.SeriesMappings.Clear(); chart.SeriesMappings.Add(seriesMapping); }