/// <summary> /// write /// </summary> /// <param name="wb"></param> /// <param name="compHistory"></param> /// <param name="columnOffset"></param> private void WriteDataColumns(WorkBook wb, ComparisonHistoryModel compHistory, int columnOffset) { var list = compHistory.Data.ToList(); Console.WriteLine("Data column: {0}, {1}, count: {2}", compHistory.Name, columnOffset, list.Count); wb.setEntry(0, columnOffset, "EvalRun ID"); wb.setEntry(0, columnOffset + 1, "Label"); wb.setEntry(0, columnOffset + 2, string.Format("Runtime {0}", compHistory.Name)); for (int i = 0; i < list.Count; i++) { var tuple = list[i]; wb.setEntry(i + 1, columnOffset, tuple.EvaluationRunID.ToString(CultureInfo.InvariantCulture)); wb.setEntry(i + 1, columnOffset + 1, tuple.EvaluationRunLabel); wb.setEntry(i + 1, columnOffset + 2, tuple.Runtime.ToString(CultureInfo.InvariantCulture)); } }
/// <summary> /// writes the chart /// </summary> /// <param name="wb"></param> /// <param name="compHistory"></param> /// <param name="columnOffset"></param> private void WriteChart(WorkBook wb, ComparisonHistoryModel compHistory, int columnOffset, int sheetIndex) { cLogger.DebugFormat("write chart sheetIndex: {0}", sheetIndex); // transform sheet into chart sheeet ChartShape chartShape = wb.addChartSheet(sheetIndex); wb.Sheet = sheetIndex; wb.PrintScaleFitToPage = true; wb.PrintLandscape = true; wb.setSheetName(sheetIndex, string.Format("Diagram_{0}", compHistory.Name)); chartShape.ChartType = ChartShape.Scatter; chartShape.setAxisTitle(ChartShape.XAxis, 0, "Evaluation Run ID"); chartShape.setAxisTitle(ChartShape.YAxis, 0, "Runtime [ms]"); ChartFormat tFormat = chartShape.PlotFormat; tFormat.setLineNone(); chartShape.setSeriesName(0, compHistory.Name); var format = chartShape.getSeriesFormat(0); format.MarkerStyle = ChartFormat.MarkerCircle; chartShape.setSeriesFormat(0, format); string xFormula = string.Format("data!${0}${1}:${0}${2}", GetDataColumnIndex(columnOffset), 2, compHistory.Data.Count()); chartShape.setSeriesXValueFormula(0, xFormula); string yFormula = string.Format("data!${0}${1}:${0}${2}", GetDataColumnIndex(columnOffset + 2), 2, compHistory.Data.Count()); cLogger.DebugFormat("xFormula: {0}, yFormula: {1}", xFormula, yFormula); chartShape.setSeriesYValueFormula(0, yFormula); }