Interface IChartInterior
Represents the chart interior. Interior of chart is supported in Chart area and Plot area only.
public interface IChartInterior
Properties
BackgroundColor
Background color (RGB).
//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["B2:C6"];
//Set chart type
chart.ChartType = ExcelChartType.Cone3DClustered;
//Set the backgroundColor color of the chart
chart.ChartArea.Interior.BackgroundColor = Color.Pink;
//Save to file
workbook.SaveToFile("Chart.xlsx");
Color BackgroundColor { get; set; }
Property Value
BackgroundKnownColor
Background color index.
//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["B2:C6"];
//Set chart type
chart.ChartType = ExcelChartType.Cone3DClustered;
//Set the index of background color
chart.ChartArea.Interior.BackgroundKnownColor = ExcelColors.Red;
//Save to file
workbook.SaveToFile("Chart.xlsx");
ExcelColors BackgroundKnownColor { get; set; }
Property Value
ForegroundColor
Foreground color (RGB).
//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["B2:C6"];
//Set chart type
chart.ChartType = ExcelChartType.Cone3DClustered;
//Set the foreground color of the chart
chart.ChartArea.Interior.ForegroundColor = Color.Blue;
//Save to file
workbook.SaveToFile("Chart.xlsx");
Color ForegroundColor { get; set; }
Property Value
ForegroundKnownColor
Index of foreground color.
//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["B2:C6"];
//Set chart type
chart.ChartType = ExcelChartType.Cone3DClustered;
//Set the index of foreground color
chart.ChartArea.Interior.ForegroundKnownColor = ExcelColors.Red;
//Save to file
workbook.SaveToFile("Chart.xlsx");
ExcelColors ForegroundKnownColor { get; set; }
Property Value
Pattern
Area pattern.
//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["B2:C6"];
//Set chart type
chart.ChartType = ExcelChartType.Cone3DClustered;
//Set the pattern of the chart
chart.ChartArea.Interior.Pattern = ExcelPatternType.Angle;
//Save to file
workbook.SaveToFile("Chart.xlsx");
ExcelPatternType Pattern { get; set; }
Property Value
SwapColorsOnNegative
Foreground and background are swapped when the data value is negative.
//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["B2:C6"];
//Set chart type
chart.ChartType = ExcelChartType.Cone3DClustered;
//True if foreground and background colors are swapped when the data value is negative
chart.Series[0].Format.Interior.SwapColorsOnNegative = true;
//Save to file
workbook.SaveToFile("Chart.xlsx");
bool SwapColorsOnNegative { get; set; }
Property Value
UseDefaultFormat
If true - use automatic format; otherwise custom.
//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["B2:C6"];
//Set chart type
chart.ChartType = ExcelChartType.Cone3DClustered;
//True to use default format for interior
chart.ChartArea.Interior.UseDefaultFormat = true;
//Save to file
workbook.SaveToFile("Chart.xlsx");
bool UseDefaultFormat { get; set; }