Table of Contents

Interface IChartInterior

Namespace
Spire.Xls.Core
Assembly
Spire.XLS.dll

Represents the chart interior. Interior of chart is supported in Chart area and Plot area only.

public interface IChartInterior

Properties

BackgroundColor

Background color (RGB). The following code illustrates the use of BackgroundColor property:

//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

Color

BackgroundKnownColor

Background color index. The following code illustrates the use of BackgroundKnownColor property:

//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

ExcelColors

ForegroundColor

Foreground color (RGB). The following code illustrates the use of ForegroundColor property:

//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

Color

ForegroundKnownColor

Index of foreground color. The following code illustrates the use of ForegroundKnownColor property:

//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

ExcelColors

Pattern

Area pattern. The following code illustrates the use of Pattern property:

//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

ExcelPatternType

SwapColorsOnNegative

Foreground and background are swapped when the data value is negative. The following code illustrates the use of SwapColorsOnNegative property:

//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

bool

UseDefaultFormat

If true - use automatic format; otherwise custom. The following code illustrates the use of UseDefaultFormat property:

//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; }

Property Value

bool