Class Series

Class Series

Namespace: Aspose.Cells.Charts
Assembly: Aspose.Cells.dll (25.2.0)

封装表示图表中单个数据系列的对象。

public class Series

继承

objectSeries

继承成员

object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()

示例

//实例化一个 Workbook 对象
Workbook workbook = new Workbook();
//向 Excel 对象添加一个新的工作表
int sheetIndex = workbook.Worksheets.Add();
//通过传递其工作表索引获取新添加的工作表的引用
Worksheet worksheet = workbook.Worksheets[sheetIndex];
//向 "A1" 单元格添加示例值
worksheet.Cells["A1"].PutValue(50);
//向 "A2" 单元格添加示例值
worksheet.Cells["A2"].PutValue(100);
//向 "A3" 单元格添加示例值
worksheet.Cells["A3"].PutValue(150);
//向 "A4" 单元格添加示例值
worksheet.Cells["A4"].PutValue(200);
//向 "B1" 单元格添加示例值
worksheet.Cells["B1"].PutValue(60);
//向 "B2" 单元格添加示例值
worksheet.Cells["B2"].PutValue(32);
//向 "B3" 单元格添加示例值
worksheet.Cells["B3"].PutValue(50);
//向 "B4" 单元格添加示例值
worksheet.Cells["B4"].PutValue(40);
//向 "C1" 单元格添加示例值作为分类数据
worksheet.Cells["C1"].PutValue("Q1");
//向 "C2" 单元格添加示例值作为分类数据
worksheet.Cells["C2"].PutValue("Q2");
//向 "C3" 单元格添加示例值作为分类数据
worksheet.Cells["C3"].PutValue("Y1");
//向 "C4" 单元格添加示例值作为分类数据
worksheet.Cells["C4"].PutValue("Y2");
//向工作表添加图表
int chartIndex = worksheet.Charts.Add(ChartType.Column, 5, 0, 15, 5);
//访问新添加的图表的实例
Chart chart = worksheet.Charts[chartIndex];
//向图表添加 NSeries(图表数据源),范围从 "A1" 单元格到 "B4"
int seriesIndex = chart.NSeries.Add("A1:B4", true);
//为 NSeries 的分类数据设置数据源
chart.NSeries.CategoryData = "C1:C4";
Series series = chart.NSeries[seriesIndex];
//设置系列的值。
series.Values = "=B1:B4";
//更改系列的图表类型。
series.Type = ChartType.Line;
//设置标记属性。
series.Marker.MarkerStyle = ChartMarkerType.Circle;
series.Marker.ForegroundColorSetType = FormattingType.Automatic;
series.Marker.ForegroundColor = System.Drawing.Color.Black;
series.Marker.BackgroundColorSetType = FormattingType.Automatic;

//执行您的业务逻辑

//保存 Excel 文件
workbook.Save("book1.xls");
'实例化一个 Workbook 对象
Dim workbook As Workbook = New Workbook()
'向 Excel 对象添加一个新的工作表
Dim sheetIndex As Int32 = workbook.Worksheets.Add()
'通过传递其工作表索引获取新添加的工作表的引用
Dim worksheet As Worksheet = workbook.Worksheets(sheetIndex)
'向 "A1" 单元格添加示例值
worksheet.Cells("A1").PutValue(50)
'向 "A2" 单元格添加示例值
worksheet.Cells("A2").PutValue(100)
'向 "A3" 单元格添加示例值
worksheet.Cells("A3").PutValue(150)
'向 "A4" 单元格添加示例值
worksheet.Cells("A4").PutValue(200)
'向 "B1" 单元格添加示例值
worksheet.Cells("B1").PutValue(60)
'向 "B2" 单元格添加示例值
worksheet.Cells("B2").PutValue(32)
'向 "B3" 单元格添加示例值
worksheet.Cells("B3").PutValue(50)
'向 "B4" 单元格添加示例值
worksheet.Cells("B4").PutValue(40)
'向 "C1" 单元格添加示例值作为分类数据
worksheet.Cells("C1").PutValue("Q1")
'向 "C2" 单元格添加示例值作为分类数据
worksheet.Cells("C2").PutValue("Q2")
'向 "C3" 单元格添加示例值作为分类数据
worksheet.Cells("C3").PutValue("Y1")
'向 "C4" 单元格添加示例值作为分类数据
worksheet.Cells("C4").PutValue("Y2")
'向工作表添加图表
Dim chartIndex As Int32 = worksheet.Charts.Add(ChartType.Column, 5, 0, 15, 5)
'访问新添加的图表的实例
Dim chart As Chart = worksheet.Charts(chartIndex)
'向图表添加 NSeries(图表数据源),范围从 "A1" 单元格到 "B4"
Dim seriesIndex As Int32 = chart.NSeries.Add("A1:B4", True)
'为 NSeries 的分类数据设置数据源
chart.NSeries.CategoryData = "C1:C4"
Dim series As Series = chart.NSeries(seriesIndex)
'设置系列的值。
series.Values = "=B1:B4"
'更改系列的图表类型。
series.Type = ChartType.Line
'设置标记属性。
series.Marker.MarkerStyle = ChartMarkerType.Circle
series.Marker.ForegroundColorSetType = FormattingType.Automatic
series.Marker.ForegroundColor = System.Drawing.Color.Black
series.Marker.BackgroundColorSetType = FormattingType.Automatic
'保存 Excel 文件
workbook.Save("book1.xls")

属性

Area

表示系列对象的背景区域。

public Area Area { get; }

属性值

Area

Bar3DShapeType

获取或设置与 3D 条形图或柱形图一起使用的 3D 形状类型。

public Bar3DShapeType Bar3DShapeType { get; set; }

属性值

Bar3DShapeType

Border

表示系列对象的边框。

public Line Border { get; }

属性值

Line

BubbleScale

获取或设置指定图表组中气泡的缩放因子。 它可以是从 0(零)到 300 的整数值, 对应于默认大小的百分比。 仅适用于气泡图。

public int BubbleScale { get; set; }

属性值

int

BubbleSizes

获取或设置图表系列的气泡大小值。

public string BubbleSizes { get; set; }

属性值

string

CountOfDataValues

获取数据值的数量。

public int CountOfDataValues { get; }

属性值

int

DataLabels

表示指定 ASeries 的 DataLabels 对象。

public DataLabels DataLabels { get; }

属性值

DataLabels

DisplayName

获取显示在图表图形上的系列名称。

public string DisplayName { get; }

属性值

string

DoughnutHoleSize

返回或设置圆环图组中孔的大小。 孔的大小以图表大小的百分比表示,介于 10% 和 90% 之间。

public int DoughnutHoleSize { get; set; }

属性值

int

DownBars

返回一个 Aspose.Cells.Charts.DropBars 对象,表示折线图上的下条。 仅适用于折线图。

public DropBars DownBars { get; }

属性值

DropBars

DropLines

返回一个 Aspose.Cells.Drawing.Line 对象,表示折线图或面积图中系列的下线。 仅适用于折线图或面积图。

public Line DropLines { get; }

属性值

Line

Explosion

表示从饼图中心的开放饼切片的距离,以饼直径的百分比表示。

public int Explosion { get; set; }

属性值

int

FirstSliceAngle

获取或设置第一个饼图或圆环图切片的角度,单位为度(从垂直方向顺时针)。 仅适用于饼图、3D 饼图和圆环图,范围为 0 到 360。

public short FirstSliceAngle { get; set; }

属性值

short

GapWidth

返回或设置条形或柱形簇之间的间隔,作为条形或柱形宽度的百分比。 此属性的值必须介于 0 和 500 之间。

public short GapWidth { get; set; }

属性值

short

Has3DEffect

如果系列具有三维外观,则为 true。 仅适用于气泡图。

public bool Has3DEffect { get; set; }

属性值

bool

HasDropLines

如果图表具有下线,则为 true。 仅适用于折线图或面积图。

public bool HasDropLines { get; set; }

属性值

bool

HasHiLoLines

如果折线图具有高低线,则为 true。 仅适用于折线图。

public bool HasHiLoLines { get; set; }

属性值

bool

HasLeaderLines

如果系列具有引导线,则为 true。

public bool HasLeaderLines { get; set; }

属性值

bool

HasRadarAxisLabels

如果雷达图具有分类轴标签,则为 true。仅适用于雷达图。

public bool HasRadarAxisLabels { get; set; }

属性值

bool

HasSeriesLines

如果堆叠柱形图或条形图具有系列线,或者饼图或条形图具有连接两部分的连接线,则为 true。 仅适用于堆叠柱形图、条形图、饼图或条形图。

public bool HasSeriesLines { get; set; }

属性值

bool

HasUpDownBars

如果折线图具有上下条,则为 true。 仅适用于折线图。

public bool HasUpDownBars { get; set; }

属性值

bool

HiLoLines

返回一个 HiLoLines 对象,表示折线图中系列的高低线。 仅适用于折线图。

public Line HiLoLines { get; }

属性值

Line

IsAutoSplit

指示阈值是否为自动。

public bool IsAutoSplit { get; }

属性值

bool

IsColorVaried

表示点的颜色是否变化。 图表必须只包含一个系列。

public bool IsColorVaried { get; set; }

属性值

bool

IsFiltered

指示系列是否被选中或过滤。true 表示该系列被过滤,将不会在图表上显示。

public bool IsFiltered { get; set; }

属性值

bool

IsVerticalValues

指示数据源是否为垂直。

public bool IsVerticalValues { get; }

属性值

bool

LayoutProperties

表示布局的属性。

public SeriesLayoutProperties LayoutProperties { get; }

属性值

SeriesLayoutProperties

LeaderLines

表示图表上的引导线。引导线将数据标签连接到数据点。 该对象不是集合;没有表示单个引导线的对象。

public Line LeaderLines { get; }

属性值

Line

LegendEntry

根据该系列获取图例条目。

public LegendEntry LegendEntry { get; }

属性值

LegendEntry

Marker

获取 Aspose.Cells.Charts.Series.Marker?text=marker。

public Marker Marker { get; }

属性值

Marker

Name

获取或设置数据系列的名称。

public string Name { get; set; }

示例

//引用单元格的名称
chart.NSeries[0].Name = "=A1";

//设置字符串作为名称
chart.NSeries[0].Name = "第一系列";
'引用单元格的名称
chart.NSeries[0].Name = "=A1"

'设置字符串作为名称
chart.NSeries[0].Name = "第一系列"

Overlap

指定条形和柱形的位置。 可以是 -100 到 100 之间的值。 仅适用于 2D 条形图和 2D 柱形图。

public short Overlap { get; set; }

属性值

short

PlotOnSecondAxis

指示该系列是否绘制在第二个值轴上。

public bool PlotOnSecondAxis { get; set; }

属性值

bool

Points

获取图表中系列的点的集合。

public ChartPointCollection Points { get; }

属性值

ChartPointCollection

备注

当图表为饼图或条形图时,最后一个点是第一个饼图中的其他点。

SecondPlotSize

返回或设置饼图或条形图的第二部分的大小, 作为主饼图大小的百分比。 可以是 5 到 200 之间的值。

public short SecondPlotSize { get; set; }

属性值

short

SeriesLines

返回一个 SeriesLines 对象,表示堆叠条形图或堆叠柱形图的系列线。 仅适用于堆叠条形图和堆叠柱形图。

public Line SeriesLines { get; }

属性值

Line

Shadow

如果系列具有阴影,则为 true。

public bool Shadow { get; set; }

属性值

bool

ShapeProperties

获取 Aspose.Cells.Drawing.ShapePropertyCollection 对象,该对象保存系列的视觉形状属性。

public ShapePropertyCollection ShapeProperties { get; }

属性值

ShapePropertyCollection

ShowNegativeBubbles

如果图表组显示负气泡,则为 true。仅适用于气泡图。

public bool ShowNegativeBubbles { get; set; }

属性值

bool

SizeRepresents

获取或设置气泡图中气泡大小所代表的内容。

public BubbleSizeRepresents SizeRepresents { get; set; }

属性值

BubbleSizeRepresents

备注

BubbleSizeRepresents.SizeIsArea 意味着 Aspose.Cells.Charts.Series.BubbleSizes 的值是气泡的面积。 BubbleSizeRepresents.SizeIsWidth 意味着 Aspose.Cells.Charts.Series.BubbleSizes 的值是气泡的宽度。

Smooth

表示曲线平滑。 如果为折线图或散点图启用了曲线平滑,则为 true。 仅适用于通过线连接的折线图和散点图。

public bool Smooth { get; set; }

属性值

bool

SplitType

返回或设置值,以确定哪些数据点位于饼图或条形图的第二部分上。

public ChartSplitType SplitType { get; set; }

属性值

ChartSplitType

SplitValue

返回或设置用于确定哪些数据点位于饼图或条形图的第二部分的值。

public double SplitValue { get; set; }

属性值

double

TrendLines

返回该系列的所有趋势线。

public TrendlineCollection TrendLines { get; }

属性值

TrendlineCollection

Type

获取或设置数据系列的类型。

public ChartType Type { get; set; }

属性值

ChartType

UpBars

返回一个 DropBars 对象,表示折线图上的上条。 仅适用于折线图。

public DropBars UpBars { get; }

属性值

DropBars

Values

表示此图表系列的 Y 值。

public string Values { get; set; }

属性值

string

ValuesFormatCode

表示 Values 的 NumberList 的格式代码。

public string ValuesFormatCode { get; set; }

属性值

string

XErrorBar

表示系列的 X 方向误差线。

public ErrorBar XErrorBar { get; }

属性值

ErrorBar

XValues

表示图表系列的 x 值。

public string XValues { get; set; }

属性值

string

XValuesFormatCode

表示 X 值的 NumberList 的格式代码。

public string XValuesFormatCode { get; set; }

属性值

string

YErrorBar

表示系列的 Y 方向误差线。

public ErrorBar YErrorBar { get; }

属性值

ErrorBar

方法

Move(int)

向上或向下移动系列。

public void Move(int count)

参数

count int

向上或向下移动的数量。 如果小于零,则移动系列向上; 如果大于零,则移动系列向下。

 中文