Beispiel #1
0
 /// <summary>
 /// Adds a new pie chart to the worksheet.
 /// </summary>
 /// <param name="Name"></param>
 /// <param name="ChartType">Type of chart</param>
 /// <param name="PivotTableSource">The pivottable source for a pivotchart</param>
 /// <returns>The chart</returns>
 public ExcelPieChart AddPieChart(string Name, ePieChartType ChartType, ExcelPivotTable PivotTableSource)
 {
     return((ExcelPieChart)AddChart(Name, (eChartType)ChartType, PivotTableSource));
 }
Beispiel #2
0
        private static void PieStyles(ExcelWorksheet ws, ePieChartType chartType)
        {
            //Style 1
            AddPie(ws, chartType, "PieChartStyle1", 0, 5, ePresetChartStyle.PieChartStyle1,
                   c =>
            {
                c.Legend.Position = eLegendPosition.Bottom;
            });

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

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

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

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

            //Style 6
            AddPie(ws, chartType, "PieChartStyle6", 22, 31, ePresetChartStyle.PieChartStyle6,
                   c =>
            {
            });

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

            //Style 8
            AddPie(ws, chartType, "PieChartStyle8", 44, 18, ePresetChartStyle.PieChartStyle8,
                   c =>
            {
                c.Legend.Position       = eLegendPosition.Top;
                c.DataLabel.ShowPercent = true;
                c.DataLabel.Position    = eLabelPosition.InEnd;
            });

            //Style 9
            AddPie(ws, chartType, "PieChartStyle9", 44, 31, ePresetChartStyle.PieChartStyle9,
                   c =>
            {
                c.Legend.Remove();
                c.DataLabel.ShowPercent  = true;
                c.DataLabel.ShowCategory = true;
                c.DataLabel.ShowValue    = true;
                c.DataLabel.Position     = eLabelPosition.OutEnd;
            });

            //Style 10
            AddPie(ws, chartType, "PieChartStyle10", 66, 5, ePresetChartStyle.PieChartStyle10,
                   c =>
            {
                c.Legend.Remove();
                c.DataLabel.ShowValue    = true;
                c.DataLabel.ShowPercent  = true;
                c.DataLabel.ShowCategory = true;
                c.DataLabel.Position     = eLabelPosition.InEnd;
            });

            //Style 11
            AddPie(ws, chartType, "PieChartStyle11", 66, 18, ePresetChartStyle.PieChartStyle11,
                   c =>
            {
                c.Legend.Position       = eLegendPosition.Bottom;
                c.DataLabel.ShowPercent = true;
            });

            //Style 12
            AddPie(ws, chartType, "PieChartStyle12", 66, 31, ePresetChartStyle.PieChartStyle12,
                   c =>
            {
                c.Legend.Position    = eLegendPosition.Bottom;
                c.DataLabel.Position = eLabelPosition.InEnd;
            });
        }
Beispiel #3
0
 /// <summary>
 /// Adds a new pie chart to the worksheet.
 /// </summary>
 /// <param name="Name"></param>
 /// <param name="ChartType">Type of chart</param>
 /// <returns>The chart</returns>
 public ExcelPieChart AddPieChart(string Name, ePieChartType ChartType)
 {
     return((ExcelPieChart)AddChart(Name, (eChartType)ChartType, null));
 }
Beispiel #4
0
        private static void Pie3DStyles(ExcelWorksheet ws, ePieChartType ePieChartType)
        {
            //Style 1
            AddPie(ws, ePieChartType, "PieChartStyle1", 0, 5, ePresetChartStyle.Pie3dChartStyle1,
                   c =>
            {
                c.Legend.Position = eLegendPosition.Bottom;
            });

            //Style 2
            var chart2 = AddPie(ws, ePieChartType, "PieChartStyle2", 0, 18, ePresetChartStyle.Pie3dChartStyle2,
                                c =>
            {
                c.Legend.Remove();
                c.DataLabel.ShowCategory = true;
                c.DataLabel.ShowValue    = true;
                c.View3D.RotY            = 50;
                c.View3D.RotX            = 50;
                c.View3D.DepthPercent    = 100;
                c.View3D.RightAngleAxes  = false;
            });

            //Style 3
            AddPie(ws, ePieChartType, "PieChartStyle3", 0, 31, ePresetChartStyle.Pie3dChartStyle3,
                   c =>
            {
                c.DataLabel.ShowPercent = true;
                c.DataLabel.Position    = eLabelPosition.Center;
            });

            //Style 4
            AddPie(ws, ePieChartType, "PieChartStyle4", 22, 5, ePresetChartStyle.Pie3dChartStyle4,
                   c =>
            {
                c.Legend.Position = eLegendPosition.Bottom;
            });

            //Style 5
            AddPie(ws, ePieChartType, "PieChartStyle5", 22, 18, ePresetChartStyle.Pie3dChartStyle5,
                   c =>
            {
                c.Legend.Position = eLegendPosition.Bottom;
            });

            //Style 6
            AddPie(ws, ePieChartType, "PieChartStyle6", 22, 31, ePresetChartStyle.Pie3dChartStyle6,
                   c =>
            {
            });

            //Style 7
            AddPie(ws, ePieChartType, "PieChartStyle7", 44, 5, ePresetChartStyle.Pie3dChartStyle7,
                   c =>
            {
                c.Legend.Position = eLegendPosition.Bottom;
            });

            //Style 8
            AddPie(ws, ePieChartType, "PieChartStyle8", 44, 18, ePresetChartStyle.Pie3dChartStyle8,
                   c =>
            {
                c.Legend.Position       = eLegendPosition.Top;
                c.DataLabel.ShowPercent = true;
                c.DataLabel.Position    = eLabelPosition.InEnd;
            });

            //Style 9
            AddPie(ws, ePieChartType, "PieChartStyle9", 44, 31, ePresetChartStyle.Pie3dChartStyle9,
                   c =>
            {
                c.Legend.Remove();
                c.DataLabel.ShowPercent  = true;
                c.DataLabel.ShowCategory = true;
                c.DataLabel.ShowValue    = true;
                c.DataLabel.Position     = eLabelPosition.OutEnd;
            });

            //Style 10
            AddPie(ws, ePieChartType, "PieChartStyle10", 66, 5, ePresetChartStyle.Pie3dChartStyle10,
                   c =>
            {
                c.Legend.Remove();
                c.DataLabel.ShowValue    = true;
                c.DataLabel.ShowPercent  = true;
                c.DataLabel.ShowCategory = true;
                c.DataLabel.Position     = eLabelPosition.InEnd;
            });
        }