public void FillSectorsChart() { _sectorsChartDataSource = new RadObservableCollection <ChartSerie>(); RadObservableCollection <ChartSerie> tmpChart = new RadObservableCollection <ChartSerie>(); foreach (DataRow row in SectorsDataSource.Rows) { ChartSerie tmp = _model.GetChartDataForSector(_selectedPortefeuille, row["SECTOR GICS"].ToString()); if (tmp.Data.Count > 0) { tmpChart.Add(tmp); } } SectorsChartDataSource = tmpChart; }
public void FillCountriesChart() { _countryChartDataSource = new RadObservableCollection <ChartSerie>(); RadObservableCollection <ChartPoint> othersDataSource = null; String currentBench = PortToBench(SelectedPortefeuille.Replace("Ecart_", "")); foreach (DataRow row in CountriesDataSource.Rows) { ChartSerie tmp = _model.GetChartDataForCountry(SelectedPortefeuille, row["COUNTRY"].ToString()); if (IsCountryInBench(tmp.Label, currentBench)) { _countryChartDataSource.Add(tmp); } else { if (othersDataSource == null) { othersDataSource = tmp.Data; } else { for (int i = 0; i < tmp.Data.Count; i++) { othersDataSource[i].Value += tmp.Data[i].Value; othersDataSource[i].Label = "Others"; } } } } ChartSerie others = new ChartSerie() { Label = "Others", Data = othersDataSource }; _countryChartDataSource.Add(others); CountryChartDataSource = _countryChartDataSource; }