Interface IChartFormat
Provides access to the formatting options for chart elements.
public interface IChartFormat
Properties
BubbleScale
Percent of largest bubble compared to chart in general. ( 0 - 300 ).
//Create worksheet
Workbook workbook = new Workbook();
workbook.LoadFromFile("Sample.xlsx");
Worksheet worksheet = workbook.Worksheets[0];
//Create chart and set range
IChart chart = worksheet.Charts.Add(ExcelChartType.Bubble3D);
chart.DataRange = worksheet.Range["A1:C2"];
chart.Series[0].Bubbles = worksheet.Range["A2:C3"];
//Set chart format
IChartFormat format = chart.Series[0].Format.Options;
//Set bubble scale
format.BubbleScale = 50;
//Save to file
workbook.SaveToFile("Chart.xlsx");
int BubbleScale { get; set; }
Property Value
DoughnutHoleSize
Size of center hole in a doughnut chart (as a percentage).( 10 - 90 ).
//Create worksheet
Workbook workbook = new Workbook();
workbook.LoadFromFile("Sample.xlsx");
Worksheet worksheet = workbook.Worksheets[0];
//Create chart and set range
IChart chart = worksheet.Charts.Add();
chart.DataRange = worksheet.Range["A1:C2"];
//Set chart type
chart.ChartType = ExcelChartType.Doughnut;
//Set chart format
IChartFormat format = chart.Series[0].Format.Options;
//Set Doughnut hole size
format.DoughnutHoleSize = 60;
//Save to file
workbook.SaveToFile("Chart.xlsx");
int DoughnutHoleSize { get; set; }
Property Value
FirstDropBar
Returns object that represents first drop bar.
//Create worksheet
Workbook workbook = new Workbook();
workbook.LoadFromFile("Sample.xlsx");
Worksheet worksheet = workbook.Worksheets[0];
//Create chart and set range
IChart chart = worksheet.Charts.Add();
chart.DataRange = worksheet.Range["A1:C3"];
//Set chart type
chart.ChartType = ExcelChartType.Line;
//Set chart drop bar
IChartDropBar dropBar = chart.Series[0].Format.Options.FirstDropBar;
IChartDropBar FirstDropBar { get; }
Property Value
FirstSliceAngle
Angle of the first pie slice expressed in degrees. ( 0 - 360 ).
//Create worksheet
Workbook workbook = new Workbook();
workbook.LoadFromFile("Sample.xlsx");
Worksheet worksheet = workbook.Worksheets[0];
//Create chart and set range
IChart chart = worksheet.Charts.Add();
chart.DataRange = worksheet.Range["A1:C2"];
//Set chart type
chart.ChartType = ExcelChartType.Pie;
//Set chart format
IChartFormat format = chart.Series[0].Format.Options;
//Set Gap width
format.FirstSliceAngle = 60;
//Save to file
workbook.SaveToFile("Chart.xlsx");
int FirstSliceAngle { get; set; }
Property Value
GapWidth
Space between categories (percent of bar width), default = 50.
//Create worksheet
Workbook workbook = new Workbook();
workbook.LoadFromFile("Sample.xlsx");
Worksheet worksheet = workbook.Worksheets[0];
//Create chart and set range
IChart chart = worksheet.Charts.Add();
chart.DataRange = worksheet.Range["A1:C3"];
//Set chart type
chart.ChartType = ExcelChartType.Column3DStacked;
//Set chart format
IChartFormat format = chart.Series[0].Format.Options;
//Set Gap width
format.GapWidth = 400;
//Save to file
workbook.SaveToFile("Chart.xlsx");
int GapWidth { get; set; }
Property Value
HasRadarAxisLabels
True if a radar chart has axis labels. Applies only to radar charts.
//Create worksheet
Workbook workbook = new Workbook();
workbook.LoadFromFile("Sample.xlsx");
Worksheet worksheet = workbook.Worksheets[0];
//Create chart and set range
IChart chart = worksheet.Charts.Add();
chart.DataRange = worksheet.Range["A1:C2"];
//Set chart type
chart.ChartType = ExcelChartType.Radar;
//Set chart format
IChartFormat format = chart.Series[0].Format.Options;
//Set radar label visibility
format.HasRadarAxisLabels = false;
//Save to file
workbook.SaveToFile("Chart.xlsx");
bool HasRadarAxisLabels { get; set; }
Property Value
IsVaryColor
Vary color for each data point.
//Create worksheet
Workbook workbook = new Workbook();
workbook.LoadFromFile("Sample.xlsx");
Worksheet worksheet = workbook.Worksheets[0];
//Create chart and set range
IChart chart = worksheet.Charts.Add();
chart.DataRange = worksheet.Range["A1:C2"];
//Set chart format
IChartFormat format = chart.Series[0].Format.Options;
//Set vary color
format.IsVaryColor = true;
//Save to file
workbook.SaveToFile("Chart.xlsx");
bool IsVaryColor { get; set; }
Property Value
Overlap
Space between bars ( -100 : 100 ).
//Create worksheet
Workbook workbook = new Workbook();
workbook.LoadFromFile("Sample.xlsx");
Worksheet worksheet = workbook.Worksheets[0];
//Create chart and set range
IChart chart = worksheet.Charts.Add();
chart.DataRange = worksheet.Range["A1:C3"];
//Set chart type
chart.ChartType = ExcelChartType.ColumnStacked;
//Set chart format
IChartFormat format = chart.Series[0].Format.Options;
//Set overlap
format.Overlap = 20;
//Save to file
workbook.SaveToFile("Chart.xlsx");
int Overlap { get; set; }
Property Value
PieSecondSize
Returns or sets the size of the secondary section of either a pie of pie chart or a bar of pie chart,
as a percentage of the size of the primary pie. ( 5 - 200 ).
//Create worksheet
Workbook workbook = new Workbook();
workbook.LoadFromFile("Sample.xlsx");
Worksheet worksheet = workbook.Worksheets[0];
//Create chart and set range
IChart chart = worksheet.Charts.Add();
chart.DataRange = worksheet.Range["A1:F2"];
//Set chart type
chart.ChartType = ExcelChartType.PieOfPie;
//Set chart format
IChartFormat format = chart.Series[0].Format.Options;
//Set second pie size
format.PieSecondSize = 40;
//Save to file
workbook.SaveToFile("Chart.xlsx");
int PieSecondSize { get; set; }
Property Value
PieSeriesLine
Represents series line properties. ( For pie of pie or pie of bar chart types only. ) Read only.
//Create worksheet
Workbook workbook = new Workbook();
workbook.LoadFromFile("Sample.xlsx");
Worksheet worksheet = workbook.Worksheets[0];
//Create chart and set range
IChart chart = worksheet.Charts.Add();
chart.DataRange = worksheet.Range["A1:F2"];
//Set chart type
chart.ChartType = ExcelChartType.PieOfPie;
//Set pie series line border
IChartBorder border = chart.Series[0].Format.Options.PieSeriesLine;
//Set color
border.Color = Color.Red;
//Save to file
workbook.SaveToFile("Chart.xlsx");
IChartBorder PieSeriesLine { get; }
Property Value
SecondDropBar
Returns object that represents second drop bar.
//Create worksheet
Workbook workbook = new Workbook();
workbook.LoadFromFile("Sample.xlsx");
Worksheet worksheet = workbook.Worksheets[0];
//Create chart and set range
IChart chart = worksheet.Charts.Add();
chart.DataRange = worksheet.Range["A1:C3"];
//Set chart type
chart.ChartType = ExcelChartType.Line;
//Set chart first drop bar
IChartDropBar dropBar = chart.Series[0].Format.Options.FirstDropBar;
//Set chart second drop bar
dropBar = chart.Series[0].Format.Options.SecondDropBar;
IChartDropBar SecondDropBar { get; }
Property Value
ShowNegativeBubbles
True to show negative bubbles.
//Create worksheet
Workbook workbook = new Workbook();
workbook.LoadFromFile("Sample.xlsx");
Worksheet worksheet = workbook.Worksheets[0];
//Create chart and set range
IChart chart = worksheet.Charts.Add(ExcelChartType.Bubble3D);
chart.DataRange = worksheet.Range["A1:D2"];
chart.Series[0].Bubbles = worksheet.Range["A2:C3"];
//Set chart format
IChartFormat format = chart.Series[0].Format.Options;
//Set negative bubble visibility
format.ShowNegativeBubbles = true;
//Save to file
workbook.SaveToFile("Chart.xlsx");
bool ShowNegativeBubbles { get; set; }
Property Value
SizeRepresents
Returns or sets what the bubble size represents on a bubble chart.
//Create worksheet
Workbook workbook = new Workbook();
workbook.LoadFromFile("Sample.xlsx");
Worksheet worksheet = workbook.Worksheets[0];
//Create chart and set range
IChart chart = worksheet.Charts.Add(ExcelChartType.Bubble3D);
chart.DataRange = worksheet.Range["A1:C2"];
chart.Series[0].Bubbles = worksheet.Range["A2:C3"];
//Set chart format
IChartFormat format = chart.Series[0].Format.Options;
//Set bubble scale and size represents
format.BubbleScale = 50;
format.SizeRepresents = BubbleSizeType.Width;
//Save to file
workbook.SaveToFile("Chart.xlsx");
BubbleSizeType SizeRepresents { get; set; }
Property Value
SplitType
Returns or sets the way the two sections of either a pie of pie chart or a bar
of pie chart are split.
//Create worksheet
Workbook workbook = new Workbook();
workbook.LoadFromFile("Sample.xlsx");
Worksheet worksheet = workbook.Worksheets[0];
//Create chart and set range
IChart chart = worksheet.Charts.Add();
chart.DataRange = worksheet.Range["A1:F2"];
//Set chart type
chart.ChartType = ExcelChartType.PieOfPie;
//Set chart format
IChartFormat format = chart.Series[0].Format.Options;
//Set split type
format.SplitType = SplitType.Value;
//Save to file
workbook.SaveToFile("Chart.xlsx");
SplitType SplitType { get; set; }
Property Value
SplitValue
Returns or sets the threshold value separating the two sections of either a pie of pie chart or a bar of pie chart.
//Create worksheet
Workbook workbook = new Workbook();
workbook.LoadFromFile("Sample.xlsx");
Worksheet worksheet = workbook.Worksheets[0];
//Create chart and set range
IChart chart = worksheet.Charts.Add();
chart.DataRange = worksheet.Range["A1:F2"];
//Set chart type
chart.ChartType = ExcelChartType.PieOfPie;
//Set chart format
IChartFormat format = chart.Series[0].Format.Options;
//Set split value
format.SplitValue = 20;
//Save to file
workbook.SaveToFile("Chart.xlsx");
int SplitValue { get; set; }