示例#1
0
        public void Create3DChart(string chartName, string chartTitle, ExcelWorksheetWrapper to,
                                  string[] axisTitles, int height = 20)
        {
            var chart = to.Worksheet.Drawings.AddChart(chartName, eChartType.Surface);

            chart.Title.Text = chartTitle;
            for (var i = _pos1Line; i <= _pos2Line; i++)
            {
                var signaturesAddress = string.Format("{0}{1}:{0}{2}", (char)(_pos1Column + 64),
                                                      _pos1Line, _pos2Line);
                var dataAddress = string.Format("{0}{1}:{2}{1}", (char)(_pos1Column + 64 + 1),
                                                i, (char)(_pos2Column + 64));
                var serie = chart.Series.Add(ExcelRange.GetFullAddress(Worksheet.Name, dataAddress),
                                             ExcelRange.GetFullAddress(Worksheet.Name, signaturesAddress));
                serie.Header = Worksheet.Cells[string.Format("{0}{1}", (char)(_pos1Column + 64), i)].Value.ToString();
            }
            chart.Legend.Position    = eLegendPosition.Right;
            chart.XAxis.Title.Text   = axisTitles[0];
            chart.YAxis.Title.Text   = "SigmaMin";
            chart.Axis[2].Title.Text = "B";

            for (var i = 0; i < chart.Axis.Length; i++)
            {
                chart.Axis[i].Title.Text      = axisTitles[i];
                chart.Axis[i].Title.Font.Size = 12;
            }

            to.PlaceChart(chart, 20);
        }
 public ExcelReporter()
 {
     _package   = new ExcelPackage();
     _temp      = new ExcelWorksheetWrapper(_package.Workbook.Worksheets.Add("_Temp"));
     _main      = new ExcelWorksheetWrapper(_package.Workbook.Worksheets.Add("Главная"));
     _questions = new ExcelWorksheetWrapper(_package.Workbook.Worksheets.Add("Вопросы"));
 }
示例#3
0
        public void CreateChart(string chartName, string chartTitle, ExcelWorksheetWrapper to, int height = 10)
        {
            var chart = to.Worksheet.Drawings.AddChart(chartName, eChartType.ColumnClustered);

            chart.Title.Text = chartTitle;
            var address1 = string.Format("{0}{1}:{2}{3}",
                                         (char)(_pos2Column + 64), _pos1Line, (char)(_pos2Column + 64), _pos2Line);
            var address2 = string.Format("{0}{1}:{2}{3}",
                                         (char)(_pos1Column + 64), _pos1Line, (char)(_pos1Column + 64), _pos2Line);

            chart.Series.Add(ExcelRange.GetFullAddress(Worksheet.Name, address1),
                             ExcelRange.GetFullAddress(Worksheet.Name, address2));
            chart.Legend.Remove();

            to.PlaceChart(chart, height);
        }