I'm using the free version of Spire and I'm able to create the first of the attachment. My goal is to create the second one but I don't know how to, cant't find info and/or the properties to set.
Can someone help me?
Thanks.
chart.Elevation = 20;
chart.Shadow.Color = Color.Black;
chart.Shadow.Transparency = 80;
chart.Shadow.Size = 102;
chart.Shadow.Angle = 0;
chart.Shadow.Distance = 0;
cs.DataPoints.DefaultDataPoint.DataLabels.FrameFormat.Fill.FillType = ShapeFillType.SolidColor;
cs.DataPoints.DefaultDataPoint.DataLabels.FrameFormat.Fill.ForeColor = Color.LightSkyBlue;
chart.Legend.FrameFormat.Fill.FillType = ShapeFillType.SolidColor;
chart.Legend.FrameFormat.Fill.ForeColor = Color.LightSkyBlue;
XlsShapeFill sha = chart.PlotArea.Fill as XlsShapeFill;
sha.FillType = ShapeFillType.Gradient;
sha.IsGradientSupported = true;
System.Drawing.Color color1 = System.Drawing.Color.FromArgb(255, 0, 0);
XlsGradientStop stop1 = new XlsGradientStop(new OColor(System.Drawing.Color.Red), 0, 0);
stop1.Transparency = 100000;
//type "Radial"
sha.GradientStops.GradientType = GradientType.Shape;
sha.GradientStops.Add(stop1);
ChartSerie.DataFormat.Shadow.ShadowOuterType = XLSXChartShadowOuterType.OffsetDiagonalBottomRight;
ChartSerie.DataFormat.Shadow.Color = System.Drawing.Color.Red;
ChartSerie.DataFormat.Shadow.Blur = 20;
ChartSerie.DataFormat.Shadow.Angle = 40;
ChartSerie.DataFormat.Shadow.Distance = 15;
ChartSerie.DataFormat.Shadow.Size = 50;
ChartSerie.DataFormat.Shadow.Transparency = 0;
ChartSerie.DataFormat.Shadow.HasCustomStyle = true;
static void Main(string[] args)
{
//Create a Workbook
Workbook workbook = new Workbook();
//Get the first sheet and set its name
Worksheet sheet = workbook.Worksheets[0];
sheet.Name = "Pie Chart";
//Add a 3d pei chart
Chart chart = sheet.Charts.Add(ExcelChartType.Pie3DExploded);
//Set chart data
CreateChartData(sheet);
//Set region of chart data
chart.DataRange = sheet.Range["B1:B2"];
chart.SeriesDataFromRange = false;
//Set position of chart
chart.LeftColumn = 1;
chart.TopRow = 6;
chart.RightColumn = 9;
chart.BottomRow = 25;
//Chart title
chart.ChartTitle = "Mitarbeiter";
chart.ChartTitleArea.IsBold = true;
chart.ChartTitleArea.Size = 12;
ChartSerie cs = chart.Series[0];
cs.CategoryLabels = sheet.Range["A1:A2"];
cs.Values = sheet.Range["B1:B2"];
cs.DataPoints.DefaultDataPoint.DataLabels.HasValue = true;
for (int i = 0; i < chart.Series.Count; i++)
{
chart.Series[i].DataPoints.DefaultDataPoint.DataLabels.Color = Color.White;
chart.Series[i].DataPoints.DefaultDataPoint.DataLabels.FrameFormat.Fill.Texture = GradientTextureType.BrownMarble;
chart.Series[i].DataPoints.DefaultDataPoint.DataLabels.Position = DataLabelPositionType.Center;
}
cs.DataPoints[1].DataFormat.Fill.ForeColor = Color.Red;
chart.UpdatePositions = true;
chart.Rotation = 0;
chart.TopRowOffset = 40; ;
chart.Elevation = 50;
//Legend style
chart.Legend.FrameFormat.Fill.ForeColor = Color.White;
chart.Legend.FrameFormat.Border.Color = Color.Transparent;
//Gradient
chart.ChartArea.Fill.FillType = ShapeFillType.Gradient;
chart.ChartArea.Fill.PresetGradientType = GradientPresetType.GradChrome;
chart.ChartArea.Fill.GradientColorType = GradientColorType.OneColor;
//Shadow
cs.DataFormat.Shadow.ShadowOuterType = XLSXChartShadowOuterType.OffsetDiagonalBottomRight;
cs.DataFormat.Shadow.Color = System.Drawing.Color.LightGray;
cs.DataFormat.Shadow.Blur = 20;
cs.DataFormat.Shadow.Angle = 30;
cs.DataFormat.Shadow.Distance = 10;
cs.DataFormat.Shadow.Size = 40;
cs.DataFormat.Shadow.Transparency =80;
cs.DataFormat.Shadow.HasCustomStyle = true;
//Save and Launch
workbook.SaveToFile("Output.xlsx", ExcelVersion.Version2010);
System.Diagnostics.Process.Start("Output.xlsx");
}
private static void CreateChartData(Worksheet sheet)
{
sheet.Range["A1"].Value = "Anzahl Mitarbeiterinnen";
sheet.Range["A2"].Value = "Anzahl Mitarbeiter";
sheet.Range["B1"].NumberValue = 125;
sheet.Range["B2"].NumberValue = 70;
}