Table of Contents

Interface IChartSerieDataFormat

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

Represents formatting options for the series data.

public interface IChartSerieDataFormat : IChartFillBorder
Inherited Members

Properties

AreaProperties

Returns object, that represents aera properties. Read only. The following code illustrates how to access AreaProperties properties and set color to IChartInterior.ForegroundColorIndex property:

//Create worksheet
Workbook workbook = new Workbook();
workbook.LoadFromFile("Sample.xlsx");
Worksheet worksheet = workbook.Worksheets[0];

//Create chart
IChart chart = worksheet.Charts.Add();

//Set range
chart.DataRange = worksheet.Range["A1:C2"];

//Set interior
IChartInterior interior = chart.Series[0].Format.AreaProperties;

//Set color
interior.ForegroundColor = Color.Red;

//Save to file
workbook.SaveToFile("Chart.xlsx");
IChartInterior AreaProperties { get; }

Property Value

IChartInterior

BarTopType

Represents the top data format. The following code illustrates how to set ExcelTopFormat.Sharp to BarShapeTop property:

//Create worksheet
Workbook workbook = new Workbook();
workbook.LoadFromFile("Sample.xlsx");
Worksheet worksheet = workbook.Worksheets[0];

//Create chart
IChart chart = worksheet.Charts.Add();

//Set range
chart.DataRange = worksheet.Range["A1:C2"];

//Set chart type
chart.ChartType = ExcelChartType.Bar3DStacked;

//Set Bar shape base
chart.Series[0].Format.BarTopType = TopFormatType.Sharp;

//Save to file
workbook.SaveToFile("Chart.xlsx");
TopFormatType BarTopType { get; set; }

Property Value

TopFormatType

BarType

Represents the base data format. The following code illustrates how to set BaseFormatType.Circle to BarShapeBase:

//Create worksheet
Workbook workbook = new Workbook();
workbook.LoadFromFile("Sample.xlsx");
Worksheet worksheet = workbook.Worksheets[0];

//Create chart
IChart chart = worksheet.Charts.Add();

//Set range
chart.DataRange = worksheet.Range["A1:C2"];

//Set chart type
chart.ChartType = ExcelChartType.Bar3DStacked;

//Set Bar shape base
chart.Series[0].Format.BarType = BaseFormatType.Circle;

//Save to file
workbook.SaveToFile("Chart.xlsx");
BaseFormatType BarType { get; set; }

Property Value

BaseFormatType

Is3DBubbles

True to draw bubbles with 3D effects. The following code illustrates how Is3DBubbles property can be used:

//Create worksheet
Workbook workbook = new Workbook();
workbook.LoadFromFile("Sample.xlsx");
Worksheet worksheet = workbook.Worksheets[0];

//Create chart
IChart chart = worksheet.Charts.Add();

//Set range
chart.DataRange = worksheet.Range["A1:C2"];

//Set chart type
chart.ChartType = ExcelChartType.Bubble3D;

//Set serie format
IChartSerieDataFormat format = chart.Series[0].Format;

//Check type
Console.WriteLine(format.Is3DBubbles);

//Save to file
workbook.SaveToFile("Chart.xlsx");
bool Is3DBubbles { get; set; }

Property Value

bool

IsAutoMarker

Automatic color. The following code illustrates how IsAutoMarker property can be used:

//Create worksheet
Workbook workbook = new Workbook();
workbook.LoadFromFile("Sample.xlsx");
Worksheet worksheet = workbook.Worksheets[0];

//Create chart
IChart chart = worksheet.Charts.Add();

//Set range
chart.DataRange = worksheet.Range["A1:F2"];

//Set chart type
chart.ChartType = ExcelChartType.LineMarkers;

//Set serie data format
IChartSerieDataFormat format = chart.Series[0].DataPoints.DefaultDataPoint.DataFormat;

//Check auto marker
Console.Write(format.IsAutoMarker);

//Save to file
workbook.SaveToFile("Chart.xlsx");
bool IsAutoMarker { get; set; }

Property Value

bool

IsMarkerSupported

Indicates whether marker is supported by this chart/series. The following code illustrates how set ExcelTreeMapLabelOption.Banner to TreeMapLabelOption:

//Create worksheet
Workbook workbook = new Workbook();
workbook.LoadFromFile("Sample.xlsx");
Worksheet worksheet = workbook.Worksheets[0];

//Create chart
IChart chart = worksheet.Charts.Add();

//Set range
chart.DataRange = worksheet.Range["A1:C2"];

//Set chart type
chart.ChartType = ExcelChartType.Pie;

//Set serie format
IChartSerieDataFormat format = chart.Series[0].Format;

//Check marker support
Console.WriteLine(format.IsMarkerSupported);

//Save to file
workbook.SaveToFile("Chart.xlsx");
bool IsMarkerSupported { get; }

Property Value

bool

MarkerBackgroundColor

Foreground color: RGB value (high byte = 0). The following code illustrates how to set color to markers in charts:

//Create worksheet
Workbook workbook = new Workbook();
workbook.LoadFromFile("Sample.xlsx");
Worksheet worksheet = workbook.Worksheets[0];

//Create chart
IChart chart = worksheet.Charts.Add();

//Set range
chart.DataRange = worksheet.Range["A1:C2"];

//Set chart type
chart.ChartType = ExcelChartType.Line;

//Set serie format
IChartSerieDataFormat format = chart.Series[0].Format;

//Set marker style
format.MarkerStyle = ChartMarkerType.Circle;

//Set color
format.MarkerBackgroundColor = Color.Red;
format.MarkerForegroundColor = Color.Black;

//Save to file
workbook.SaveToFile("Chart.xlsx");
Color MarkerBackgroundColor { get; set; }

Property Value

Color

MarkerBackgroundKnownColor

Index to color of marker XlsFill. The following code illustrates how to set a color from ExcelColors enumeration to marker applied:

//Create worksheet
Workbook workbook = new Workbook();
workbook.LoadFromFile("Sample.xlsx");
Worksheet worksheet = workbook.Worksheets[0];

//Create chart
IChart chart = worksheet.Charts.Add();

//Set range
chart.DataRange = worksheet.Range["A1:C2"];

//Set chart type
chart.ChartType = ExcelChartType.Line;

//Set serie format
IChartSerieDataFormat format = chart.Series[0].Format;

//Set marker style
format.MarkerStyle = ChartMarkerType.Circle;

//Set color
format.MarkerBackgroundKnownColor = ExcelColors.Red;
format.MarkerForegroundKnownColor = ExcelColors.Black;

//Save to file
workbook.SaveToFile("Chart.xlsx");
ExcelColors MarkerBackgroundKnownColor { get; set; }

Property Value

ExcelColors

MarkerForegroundColor

Background color: RGB value (high byte = 0). The following code illustrates how to set color for markers in charts:

//Create worksheet
Workbook workbook = new Workbook();
workbook.LoadFromFile("Sample.xlsx");
Worksheet worksheet = workbook.Worksheets[0];

//Create chart
IChart chart = worksheet.Charts.Add();

//Set range
chart.DataRange = worksheet.Range["A1:C2"];

//Set chart type
chart.ChartType = ExcelChartType.Line;

//Set serie format
IChartSerieDataFormat format = chart.Series[0].Format;

//Set marker style
format.MarkerStyle = ChartMarkerType.Circle;

//Set color
format.MarkerBackgroundColor = Color.Red;
format.MarkerForegroundColor = Color.Black;

//Save to file
workbook.SaveToFile("Chart.xlsx");
Color MarkerForegroundColor { get; set; }

Property Value

Color

MarkerForegroundKnownColor

Index to color of marker border. The following code illustrates how to set a color from ExcelColors enumeration to marker applied:

//Create worksheet
Workbook workbook = new Workbook();
workbook.LoadFromFile("Sample.xlsx");
Worksheet worksheet = workbook.Worksheets[0];

//Create chart
IChart chart = worksheet.Charts.Add();

//Set range
chart.DataRange = worksheet.Range["A1:C2"];

//Set chart type
chart.ChartType = ExcelChartType.Line;

//Set serie format
IChartSerieDataFormat format = chart.Series[0].Format;

//Set marker style
format.MarkerStyle = ChartMarkerType.Circle;

//Set color
format.MarkerBackgroundKnownColor = ExcelColors.Red;
format.MarkerForegroundKnownColor = ExcelColors.Black;

//Save to file
workbook.SaveToFile("Chart.xlsx");
ExcelColors MarkerForegroundKnownColor { get; set; }

Property Value

ExcelColors

MarkerSize

Size of line markers. The following code illustrates how to set MarkerSize for applied markers in charts:

//Create worksheet
Workbook workbook = new Workbook();
workbook.LoadFromFile("Sample.xlsx");
Worksheet worksheet = workbook.Worksheets[0];

//Create chart
IChart chart = worksheet.Charts.Add();

//Set range
chart.DataRange = worksheet.Range["A1:C2"];

//Set chart type
chart.ChartType = ExcelChartType.Line;

//Set serie format
IChartSerieDataFormat format = chart.Series[0].Format;

//Set marker style
format.MarkerStyle = ChartMarkerType.Circle;

//Set marker size
format.MarkerSize = 10;

//Save to file
workbook.SaveToFile("Chart.xlsx");
int MarkerSize { get; set; }

Property Value

int

MarkerStyle

Type of marker. The following code illustrates how marker style can be applied to charts:

//Create worksheet
Workbook workbook = new Workbook();
workbook.LoadFromFile("Sample.xlsx");
Worksheet worksheet = workbook.Worksheets[0];

//Create chart
IChart chart = worksheet.Charts.Add();

//Set range
chart.DataRange = worksheet.Range["A1:C2"];

//Set chart type
chart.ChartType = ExcelChartType.Line;

//Set serie format
IChartSerieDataFormat format = chart.Series[0].Format;

//Set marker style
format.MarkerStyle = ChartMarkerType.Star;

//Save to file
workbook.SaveToFile("Chart.xlsx");
ChartMarkerType MarkerStyle { get; set; }

Property Value

ChartMarkerType

Options

Gets common serie options. Read-only. The following code illustrates how IChartFormat.GapWidth can be set by accessing CommonSerieOptions property:

//Create worksheet
Workbook workbook = new Workbook();
workbook.LoadFromFile("Sample.xlsx");
Worksheet worksheet = workbook.Worksheets[0];

//Create chart
IChart chart = worksheet.Charts.Add();

//Set range
chart.DataRange = worksheet.Range["A1:C2"];

//Set chart type
chart.ChartType = ExcelChartType.Column3DStacked;

//Set options
IChartFormat options = chart.Series[0].Format.Options;

//Set Gap width
options.GapWidth = 400;

//Save to file
workbook.SaveToFile("Chart.xlsx");
IChartFormat Options { get; }

Property Value

IChartFormat

Percent

Distance of pie slice from center of pie. The following code illustrates how to set Percent property:

//Create worksheet
Workbook workbook = new Workbook();
workbook.LoadFromFile("Sample.xlsx");
Worksheet worksheet = workbook.Worksheets[0];

//Create chart
IChart chart = worksheet.Charts.Add();

//Set range
chart.DataRange = worksheet.Range["A1:C2"];

//Set chart type
chart.ChartType = ExcelChartType.Pie;

//Set percent
chart.Series[0].Format.Percent = 30;

//Save to file
workbook.SaveToFile("Chart.xlsx");
int Percent { get; set; }

Property Value

int