public CountryAvgsGraph() { InitializeComponent(); var models = new ProcessedStackoverflowModelReader().ProcessedStackoverflowModels; var countryAverageSalaries = CountryInsights.GetAverageByCountry(models); Countries = Enum.GetNames(typeof(Country)); CountryAverages = new SeriesCollection { new ColumnSeries { Title = "Average Salary", Values = new ChartValues <decimal>(countryAverageSalaries.Select(cas => cas.Value)) } }; DataContext = this; }
public DevTypeAvgsGraph() { InitializeComponent(); var models = new ProcessedStackoverflowModelReader().ProcessedStackoverflowModels; var averages = DevTypeInsights.GetAvgByDevType(models); DevTypes = Enum.GetNames(typeof(DevelopmentType)); DevTypeAverages = new SeriesCollection { new ColumnSeries { Title = "Average Salary", Values = new ChartValues <decimal>(averages.Select(avg => avg.Value)) }, }; DataContext = this; }
public YearBandAvgsGraph() { InitializeComponent(); var models = new ProcessedStackoverflowModelReader().ProcessedStackoverflowModels; var averages = YearBandDataInsights.GetAveragesByYearBand(models); var averageProfessionalList = (Dictionary <YearBand, decimal>)averages.ProfessionalAverages; var professionalValues = averageProfessionalList.Select(r => r.Value); var averageNonProfessionalList = (Dictionary <YearBand, decimal>)averages.NonProfessionalAverages; var nonprofessionalValues = averageNonProfessionalList.Select(r => r.Value); var yearBands = new List <string>(); foreach (YearBand yearBand in Enum.GetValues(typeof(YearBand))) { yearBands.Add(yearBand.ToString()); } YearBands = yearBands.ToArray(); YearBandAverages = new SeriesCollection { new LineSeries { Title = "Professional", Values = new ChartValues <decimal>(professionalValues) }, new LineSeries { Title = "Non-Professional", Values = new ChartValues <decimal>(nonprofessionalValues) } }; DataContext = this; }