コード例 #1
0
        /// <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)
        {
            Console.WriteLine("write chart sheetIndex: {0}", sheetIndex);

            // transform sheet into chart sheeet

            var 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, "Similarity [%]");

            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());
            Console.WriteLine("xFormula: {0}, yFormula: {1}", xFormula, yFormula);

            chartShape.setSeriesYValueFormula(0, yFormula);
        }
コード例 #2
0
        /// <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("Result {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.Result.ToString(CultureInfo.InvariantCulture));
            }
        }