/// ------------------------------------------------------------------------------------ private void WriteStageChart() { var sessionsByStage = _statsViewModel.SessionInformant.GetSessionsCategorizedByStage() .Where(r => r.Key.Id != ComponentRole.kConsentComponentRoleId); var barInfoList = (sessionsByStage.Select( x => new ChartBarInfo(x.Key.Name, x.Value, x.Key.Color, x.Key.TextColor))).ToList(); ChartBarInfo.CalculateBarSizes(barInfoList); var text = LocalizationManager.GetString("ProgressView.ByStagesHeadingText", "By Stages"); WriteChartForList(text, barInfoList, null, false); }
/// ------------------------------------------------------------------------------------ private void WriteChartByFieldPair(string chartHeading, string primaryField, string secondaryField, IDictionary <string, Color> colors, IDictionary <string, Color> textColors) { var outerList = _statsViewModel.SessionInformant.GetCategorizedSessionsFromDoubleKey(primaryField, secondaryField); var barInfoList = (from x in outerList select new ChartBarInfo(x.Key, secondaryField, x.Value, colors, textColors)) .OrderBy(bi => bi.FieldValue).ToList(); ChartBarInfo.CalculateBarSizes(barInfoList); WriteChartForList(chartHeading, barInfoList, colors, true); }
/// ------------------------------------------------------------------------------------ private string WriteBar(ChartBarInfo barInfo) { foreach (var seg in barInfo.Segments) { if (seg.TotalTime > 0) { WriteBarSegment(seg); } } var text = LocalizationManager.GetString("ProgressView.SummaryTotalsTextForOneBar", "{0} sessions totaling {1} minutes"); return(string.Format(text, barInfo.TotalSessions, barInfo.TotalTime)); }
/// ------------------------------------------------------------------------------------ private void WriteChartEntry(ChartBarInfo barInfo) { OpenTableRow(); WriteTableCell("rowheading", barInfo.FieldValue); OpenTableCell("colorbar"); OpenTable(null, barInfo.BarSize); OpenTableRow(); var summaryText = WriteBar(barInfo); CloseTableRow(); CloseTable(); CloseTableCell(); CloseTableRow(); OpenTableRow(); WriteTableCell("entrysummaryrowheading", string.Empty); WriteTableCell("entrysummary", summaryText); CloseTableRow(); }