public List <GraphableSeries> TypeToChart(Question question) { var chartSeries = new List <GraphableSeries>(); var multipleChoiceQuestion = (MultipleChoiceQuestion)question; for (var i = 0; i < multipleChoiceQuestion.OptionCollection.Count; i++) { var option = multipleChoiceQuestion.OptionCollection[i]; // Hoevaak hebben we de index answered. var count = multipleChoiceQuestion.Answers .OfType <MultipleChoiceAnswer>() .Count(a => a.MultipleChoiceAnswerKey == i); var graphableSeries = new GraphableSeries { Title = option.Value, Values = new ChartValues <int> { count } }; chartSeries.Add(graphableSeries); } return(chartSeries); }
public List <GraphableSeries> TypeToChart(Question question) { var series = new List <GraphableSeries>(); var plannedInspections = question.Answers.Select(x => x.PlannedInspection); foreach (var plannedInspection in plannedInspections) { var graphableSeries = new GraphableSeries { Title = plannedInspection.EventTitle, Values = new ChartValues <int>() }; var answer = question.Answers .OfType <NumericAnswer>() .FirstOrDefault(x => x.PlannedInspection.Id == plannedInspection.Id); if (answer != null) { graphableSeries.Values.Add(answer.IntAnswer); } series.Add(graphableSeries); } return(series); }
public List <GraphableSeries> TypeToChart(Question question) { var series = new List <GraphableSeries>(); var graphableSeries = new GraphableSeries { Title = question.Contents }; var chartValues = new ChartValues <float>(); foreach (var answer in question.Answers.OfType <NumericAnswer>()) { chartValues.Add(answer.IntAnswer); } graphableSeries.Values = chartValues; series.Add(graphableSeries); return(series); }