SeriesCollection
内容
[
隐藏
]SeriesCollection class
封装了一个集合Series
对象.
public class SeriesCollection : CollectionBase<Series>
特性
姓名 | 描述 |
---|---|
Capacity { get; set; } | |
CategoryData { get; set; } | 获取或设置类别轴值的范围。 可以是单元格范围(例如,“d1:e10”)、 或一系列值(例如,“{2,6,8,10}”)。 |
Count { get; } | |
IsColorVaried { get; set; } | 表示点的颜色是否变化。 |
Item { get; } | 获取Series 指定索引处的元素。 |
Item { get; set; } | |
SecondCategoryData { get; set; } | 获取或设置第二类轴值的范围。 可以是单元格范围(例如,“d1:e10”)、 或一系列值(例如,“{2,6,8,10}”)。 仅当某些 ASeries 绘制在第二个轴上时才会产生影响。 |
方法
姓名 | 描述 |
---|---|
Add(string, bool) | 添加SeriesCollection 收集到图表。 |
Add(string, bool, bool) | 添加SeriesCollection 收集到图表。 |
AddR1C1(string, bool) | 添加SeriesCollection 收集到图表。 |
BinarySearch(Series) | |
BinarySearch(Series, IComparer<Series>) | |
BinarySearch(int, int, Series, IComparer<Series>) | |
ChangeSeriesOrder(int, int) | 直接改变两个系列的顺序 |
Clear() | 清除集合 (2 methods) |
Contains(Series) | |
CopyTo(Series[]) | |
CopyTo(Series[], int) | |
CopyTo(int, Series[], int, int) | |
Exists(Predicate<Series>) | |
Find(Predicate<Series>) | |
FindAll(Predicate<Series>) | |
FindIndex(Predicate<Series>) | |
FindIndex(int, Predicate<Series>) | |
FindIndex(int, int, Predicate<Series>) | |
FindLast(Predicate<Series>) | |
FindLastIndex(Predicate<Series>) | |
FindLastIndex(int, Predicate<Series>) | |
FindLastIndex(int, int, Predicate<Series>) | |
GetEnumerator() | |
GetSeriesByOrder(int) | 获取Series 按顺序排列元素。 |
IndexOf(Series) | |
IndexOf(Series, int) | |
IndexOf(Series, int, int) | |
LastIndexOf(Series) | |
LastIndexOf(Series, int) | |
LastIndexOf(Series, int, int) | |
RemoveAt(int) | 删除特定索引处的系列。 (2 methods) |
SetSeriesNames(int, string, bool) | 设置图表中所有系列的名称。 |
例子
[C#]
//实例化一个工作簿对象
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”单元格的图表中
chart.NSeries.Add("A1:B4", true);
//设置NSeries类别数据的数据源
chart.NSeries.CategoryData = "C1:C4";
//保存Excel文件
workbook.Save("book1.xls");
[Visual Basic]
'实例化工作簿对象
Dim workbook As Workbook = New Workbook()
'向 Excel 对象添加新工作表
Dim sheetIndex As Integer = workbook.Worksheets.Add()
'通过传入工作表的索引来获取新添加的工作表的引用
Dim worksheet As Worksheet = workbook.Worksheets(sheetIndex)
'Adding a sample value to "A1" cell
worksheet.Cells("A1").PutValue(50)
'Adding a sample value to "A2" cell
worksheet.Cells("A2").PutValue(100)
'Adding a sample value to "A3" cell
worksheet.Cells("A3").PutValue(150)
'Adding a sample value to "A4" cell
worksheet.Cells("A4").PutValue(200)
'Adding a sample value to "B1" cell
worksheet.Cells("B1").PutValue(60)
'Adding a sample value to "B2" cell
worksheet.Cells("B2").PutValue(32)
'Adding a sample value to "B3" cell
worksheet.Cells("B3").PutValue(50)
'Adding a sample value to "B4" cell
worksheet.Cells("B4").PutValue(40)
'Adding a sample value to "C1" cell as category data
worksheet.Cells("C1").PutValue("Q1")
'Adding a sample value to "C2" cell as category data
worksheet.Cells("C2").PutValue("Q2")
'Adding a sample value to "C3" cell as category data
worksheet.Cells("C3").PutValue("Y1")
'Adding a sample value to "C4" cell as category data
worksheet.Cells("C4").PutValue("Y2")
'将图表添加到工作表
Dim chartIndex As Integer = worksheet.Charts.Add(ChartType.Column, 5, 0, 15, 5)
'访问新添加图表的实例
Dim chart As Chart = worksheet.Charts(chartIndex)
'Adding NSeries (chart data source) to the chart ranging from "A1" cell to "B4"
chart.NSeries.Add("A1:B4", True)
'设置 NSeries 类别数据的数据源
chart.NSeries.CategoryData = "C1:C4"
'保存 Excel 文件
workbook.Save("book1.xls")
也可以看看
- class CollectionBase<T>
- class Series
- 命名空间 Aspose.Cells.Charts
- 部件 Aspose.Cells