Exemple #1
0
        private static void StyleStackedBar3DChart(ExcelWorksheet ws, eBarChartType chartType)
        {
            //Style 1
            AddBar(ws, chartType, "Column3DChartStyle1", 0, 5, ePresetChartStyle.StackedColumn3dChartStyle1,
                   c =>
            {
                c.Legend.Position       = eLegendPosition.Bottom;
                c.Axis[0].MajorTickMark = eAxisTickMark.None;
                c.Axis[0].MinorTickMark = eAxisTickMark.None;
                c.Axis[1].MajorTickMark = eAxisTickMark.None;
                c.Axis[1].MinorTickMark = eAxisTickMark.None;
            });

            //Style 2
            var chart2 = AddBar(ws, chartType, "Column3DChartStyle2", 0, 18, ePresetChartStyle.StackedColumn3dChartStyle2,
                                c =>
            {
                c.Legend.Position = eLegendPosition.Top;
            });

            //Style 3
            var chart3 = AddBar(ws, chartType, "Column3DChartStyle3", 0, 31, ePresetChartStyle.StackedColumn3dChartStyle3,
                                c =>
            {
                c.DataLabel.ShowPercent = true;
            });

            //Style 4
            AddBar(ws, chartType, "Column3DChartStyle4", 22, 5, ePresetChartStyle.StackedColumn3dChartStyle4,
                   c =>
            {
            });

            //Style 5
            AddBar(ws, chartType, "Column3DChartStyle5", 22, 18, ePresetChartStyle.StackedColumn3dChartStyle5,
                   c =>
            {
                c.Legend.Position = eLegendPosition.Top;
            });

            //Style 6
            AddBar(ws, chartType, "Column3DChartStyle6", 22, 31, ePresetChartStyle.StackedColumn3dChartStyle6,
                   c =>
            {
                c.DataLabel.ShowPercent = true;
            });

            //Style 7
            AddBar(ws, chartType, "Column3DChartStyle7", 44, 5, ePresetChartStyle.StackedColumn3dChartStyle7,
                   c =>
            {
            });

            //Style 8
            AddBar(ws, chartType, "Column3DChartStyle8", 44, 18, ePresetChartStyle.StackedColumn3dChartStyle8,
                   c =>
            {
                c.Legend.Position = eLegendPosition.Top;
            });
        }
Exemple #2
0
        private static ExcelBarChart AddBar(ExcelWorksheet ws, eBarChartType type, string name, int row, int col, ePresetChartStyle style, Action <ExcelBarChart> SetProperties)
        {
            var chart = ws.Drawings.AddBarChart(name, type);

            chart.SetPosition(row, 0, col, 0);
            chart.To.Column    = col + 12;
            chart.To.ColumnOff = 0;
            chart.To.Row       = row + 18;
            chart.To.RowOff    = 0;
            var serie = chart.Series.Add("D2:D8", "A2:A8");

            SetProperties(chart);

            chart.StyleManager.SetChartStyle(style);
            return(chart);
        }
Exemple #3
0
        private static void StyleBarChart(ExcelWorksheet ws, eBarChartType chartType)
        {
            //Style 1
            AddBar(ws, chartType, "ColumnChartStyle1", 0, 5, ePresetChartStyle.BarChartStyle1,
                   c =>
            {
                c.Legend.Position       = eLegendPosition.Bottom;
                c.Axis[0].MajorTickMark = eAxisTickMark.None;
                c.Axis[0].MinorTickMark = eAxisTickMark.None;
                c.Axis[1].MajorTickMark = eAxisTickMark.None;
                c.Axis[1].MinorTickMark = eAxisTickMark.None;
                c.GapWidth = 219;
                c.Overlap  = -27;
            });

            //Style 2
            AddBar(ws, chartType, "ColumnChartStyle2", 0, 18, ePresetChartStyle.BarChartStyle2,
                   c =>
            {
                c.Legend.Position = eLegendPosition.Top;
            });

            //Style 3
            var chart3 = AddBar(ws, chartType, "ColumnChartStyle3", 0, 31, ePresetChartStyle.BarChartStyle3,
                                c =>
            {
                c.DataLabel.ShowPercent = true;
                c.DataLabel.Position    = eLabelPosition.Center;
            });

            //Style 4
            AddBar(ws, chartType, "ColumnChartStyle4", 22, 5, ePresetChartStyle.BarChartStyle4,
                   c =>
            {
                c.Legend.Position = eLegendPosition.Bottom;
            });

            //Style 5
            AddBar(ws, chartType, "ColumnChartStyle5", 22, 18, ePresetChartStyle.BarChartStyle5,
                   c =>
            {
                c.Legend.Position = eLegendPosition.Bottom;
            });

            //Style 6
            AddBar(ws, chartType, "ColumnChartStyle6", 22, 31, ePresetChartStyle.BarChartStyle6,
                   c =>
            {
            });


            //Style 7
            AddBar(ws, chartType, "ColumnChartStyle7", 44, 5, ePresetChartStyle.BarChartStyle7,
                   c =>
            {
                c.Legend.Position = eLegendPosition.Bottom;
            });

            //Style 8
            AddBar(ws, chartType, "ColumnChartStyle8", 44, 18, ePresetChartStyle.BarChartStyle8,
                   c =>
            {
                c.Legend.Position = eLegendPosition.Bottom;
            });

            //Style 9
            AddBar(ws, chartType, "ColumnChartStyle9", 44, 31, ePresetChartStyle.BarChartStyle9,
                   c =>
            {
            });

            //Style 10
            AddBar(ws, chartType, "ColumnChartStyle10", 66, 5, ePresetChartStyle.BarChartStyle10,
                   c =>
            {
                c.Legend.Position = eLegendPosition.Bottom;
            });

            //Style 11
            AddBar(ws, chartType, "ColumnChartStyle11", 66, 18, ePresetChartStyle.BarChartStyle11,
                   c =>
            {
                c.Legend.Position = eLegendPosition.Bottom;
            });

            //Style 12
            AddBar(ws, chartType, "ColumnChartStyle12", 66, 31, ePresetChartStyle.BarChartStyle12,
                   c =>
            {
            });

            //Style 13
            AddBar(ws, chartType, "ColumnChartStyle13", 88, 5, ePresetChartStyle.BarChartStyle13,
                   c =>
            {
                c.Legend.Position = eLegendPosition.Bottom;
            });
        }
Exemple #4
0
 /// <summary>
 /// Adds a new barchart to the worksheet.
 /// </summary>
 /// <param name="Name"></param>
 /// <param name="ChartType">Type of linechart</param>
 /// <returns>The chart</returns>
 public ExcelBarChart AddBarChart(string Name, eBarChartType ChartType)
 {
     return((ExcelBarChart)AddChart(Name, (eChartType)ChartType, null));
 }
Exemple #5
0
 /// <summary>
 /// Adds a new bar chart to the chart
 /// </summary>
 /// <param name="chartType">The type of the new chart</param>
 /// <returns>The chart</returns>
 public ExcelBarChart AddBarChart(eBarChartType chartType)
 {
     return((ExcelBarChart)Add((eChartType)chartType));
 }