Class Series
Namespace: Aspose.Cells.Charts
Assembly: Aspose.Cells.dll (25.2.0)
封装表示图表中单个数据系列的对象。
public class Series
继承
继承成员
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; }
属性值
Bar3DShapeType
获取或设置与 3D 条形图或柱形图一起使用的 3D 形状类型。
public Bar3DShapeType Bar3DShapeType { get; set; }
属性值
Border
表示系列对象的边框。
public Line Border { get; }
属性值
BubbleScale
获取或设置指定图表组中气泡的缩放因子。 它可以是从 0(零)到 300 的整数值, 对应于默认大小的百分比。 仅适用于气泡图。
public int BubbleScale { get; set; }
属性值
BubbleSizes
获取或设置图表系列的气泡大小值。
public string BubbleSizes { get; set; }
属性值
CountOfDataValues
获取数据值的数量。
public int CountOfDataValues { get; }
属性值
DataLabels
表示指定 ASeries 的 DataLabels 对象。
public DataLabels DataLabels { get; }
属性值
DisplayName
获取显示在图表图形上的系列名称。
public string DisplayName { get; }
属性值
DoughnutHoleSize
返回或设置圆环图组中孔的大小。 孔的大小以图表大小的百分比表示,介于 10% 和 90% 之间。
public int DoughnutHoleSize { get; set; }
属性值
DownBars
返回一个 Aspose.Cells.Charts.DropBars 对象,表示折线图上的下条。 仅适用于折线图。
public DropBars DownBars { get; }
属性值
DropLines
返回一个 Aspose.Cells.Drawing.Line 对象,表示折线图或面积图中系列的下线。 仅适用于折线图或面积图。
public Line DropLines { get; }
属性值
Explosion
表示从饼图中心的开放饼切片的距离,以饼直径的百分比表示。
public int Explosion { get; set; }
属性值
FirstSliceAngle
获取或设置第一个饼图或圆环图切片的角度,单位为度(从垂直方向顺时针)。 仅适用于饼图、3D 饼图和圆环图,范围为 0 到 360。
public short FirstSliceAngle { get; set; }
属性值
GapWidth
返回或设置条形或柱形簇之间的间隔,作为条形或柱形宽度的百分比。 此属性的值必须介于 0 和 500 之间。
public short GapWidth { get; set; }
属性值
Has3DEffect
如果系列具有三维外观,则为 true。 仅适用于气泡图。
public bool Has3DEffect { get; set; }
属性值
HasDropLines
如果图表具有下线,则为 true。 仅适用于折线图或面积图。
public bool HasDropLines { get; set; }
属性值
HasHiLoLines
如果折线图具有高低线,则为 true。 仅适用于折线图。
public bool HasHiLoLines { get; set; }
属性值
HasLeaderLines
如果系列具有引导线,则为 true。
public bool HasLeaderLines { get; set; }
属性值
HasRadarAxisLabels
如果雷达图具有分类轴标签,则为 true。仅适用于雷达图。
public bool HasRadarAxisLabels { get; set; }
属性值
HasSeriesLines
如果堆叠柱形图或条形图具有系列线,或者饼图或条形图具有连接两部分的连接线,则为 true。 仅适用于堆叠柱形图、条形图、饼图或条形图。
public bool HasSeriesLines { get; set; }
属性值
HasUpDownBars
如果折线图具有上下条,则为 true。 仅适用于折线图。
public bool HasUpDownBars { get; set; }
属性值
HiLoLines
返回一个 HiLoLines 对象,表示折线图中系列的高低线。 仅适用于折线图。
public Line HiLoLines { get; }
属性值
IsAutoSplit
指示阈值是否为自动。
public bool IsAutoSplit { get; }
属性值
IsColorVaried
表示点的颜色是否变化。 图表必须只包含一个系列。
public bool IsColorVaried { get; set; }
属性值
IsFiltered
指示系列是否被选中或过滤。true 表示该系列被过滤,将不会在图表上显示。
public bool IsFiltered { get; set; }
属性值
IsVerticalValues
指示数据源是否为垂直。
public bool IsVerticalValues { get; }
属性值
LayoutProperties
表示布局的属性。
public SeriesLayoutProperties LayoutProperties { get; }
属性值
LeaderLines
表示图表上的引导线。引导线将数据标签连接到数据点。 该对象不是集合;没有表示单个引导线的对象。
public Line LeaderLines { get; }
属性值
LegendEntry
根据该系列获取图例条目。
public LegendEntry LegendEntry { get; }
属性值
Marker
获取 Aspose.Cells.Charts.Series.Marker?text=marker。
public Marker Marker { get; }
属性值
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; }
属性值
PlotOnSecondAxis
指示该系列是否绘制在第二个值轴上。
public bool PlotOnSecondAxis { get; set; }
属性值
Points
获取图表中系列的点的集合。
public ChartPointCollection Points { get; }
属性值
备注
当图表为饼图或条形图时,最后一个点是第一个饼图中的其他点。
SecondPlotSize
返回或设置饼图或条形图的第二部分的大小, 作为主饼图大小的百分比。 可以是 5 到 200 之间的值。
public short SecondPlotSize { get; set; }
属性值
SeriesLines
返回一个 SeriesLines 对象,表示堆叠条形图或堆叠柱形图的系列线。 仅适用于堆叠条形图和堆叠柱形图。
public Line SeriesLines { get; }
属性值
Shadow
如果系列具有阴影,则为 true。
public bool Shadow { get; set; }
属性值
ShapeProperties
获取 Aspose.Cells.Drawing.ShapePropertyCollection 对象,该对象保存系列的视觉形状属性。
public ShapePropertyCollection ShapeProperties { get; }
属性值
ShowNegativeBubbles
如果图表组显示负气泡,则为 true。仅适用于气泡图。
public bool ShowNegativeBubbles { get; set; }
属性值
SizeRepresents
获取或设置气泡图中气泡大小所代表的内容。
public BubbleSizeRepresents SizeRepresents { get; set; }
属性值
备注
BubbleSizeRepresents.SizeIsArea 意味着 Aspose.Cells.Charts.Series.BubbleSizes 的值是气泡的面积。 BubbleSizeRepresents.SizeIsWidth 意味着 Aspose.Cells.Charts.Series.BubbleSizes 的值是气泡的宽度。
Smooth
表示曲线平滑。 如果为折线图或散点图启用了曲线平滑,则为 true。 仅适用于通过线连接的折线图和散点图。
public bool Smooth { get; set; }
属性值
SplitType
返回或设置值,以确定哪些数据点位于饼图或条形图的第二部分上。
public ChartSplitType SplitType { get; set; }
属性值
SplitValue
返回或设置用于确定哪些数据点位于饼图或条形图的第二部分的值。
public double SplitValue { get; set; }
属性值
TrendLines
返回该系列的所有趋势线。
public TrendlineCollection TrendLines { get; }
属性值
Type
获取或设置数据系列的类型。
public ChartType Type { get; set; }
属性值
UpBars
返回一个 DropBars 对象,表示折线图上的上条。 仅适用于折线图。
public DropBars UpBars { get; }
属性值
Values
表示此图表系列的 Y 值。
public string Values { get; set; }
属性值
ValuesFormatCode
表示 Values 的 NumberList 的格式代码。
public string ValuesFormatCode { get; set; }
属性值
XErrorBar
表示系列的 X 方向误差线。
public ErrorBar XErrorBar { get; }
属性值
XValues
表示图表系列的 x 值。
public string XValues { get; set; }
属性值
XValuesFormatCode
表示 X 值的 NumberList 的格式代码。
public string XValuesFormatCode { get; set; }
属性值
YErrorBar
表示系列的 Y 方向误差线。
public ErrorBar YErrorBar { get; }
属性值
方法
Move(int)
向上或向下移动系列。
public void Move(int count)
参数
count
int
向上或向下移动的数量。 如果小于零,则移动系列向上; 如果大于零,则移动系列向下。