TrendlineCollection
内容
[
隐藏
]TrendlineCollection class
代表所有的集合Trendline
指定数据系列的对象。
public class TrendlineCollection : CollectionBase<Trendline>
特性
姓名 | 描述 |
---|---|
Capacity { get; set; } | |
Count { get; } | |
Item { get; } | 得到一个对象的索引。 |
Item { get; set; } |
方法
姓名 | 描述 |
---|---|
Add(TrendlineType) | 添加一个具有指定类型的此集合的对象。 |
Add(TrendlineType, string) | 添加一个具有指定类型和名称的此集合的对象。 |
BinarySearch(Trendline) | |
BinarySearch(Trendline, IComparer<Trendline>) | |
BinarySearch(int, int, Trendline, IComparer<Trendline>) | |
Clear() | |
Contains(Trendline) | |
CopyTo(Trendline[]) | |
CopyTo(Trendline[], int) | |
CopyTo(int, Trendline[], int, int) | |
Exists(Predicate<Trendline>) | |
Find(Predicate<Trendline>) | |
FindAll(Predicate<Trendline>) | |
FindIndex(Predicate<Trendline>) | |
FindIndex(int, Predicate<Trendline>) | |
FindIndex(int, int, Predicate<Trendline>) | |
FindLast(Predicate<Trendline>) | |
FindLastIndex(Predicate<Trendline>) | |
FindLastIndex(int, Predicate<Trendline>) | |
FindLastIndex(int, int, Predicate<Trendline>) | |
GetEnumerator() | |
IndexOf(Trendline) | |
IndexOf(Trendline, int) | |
IndexOf(Trendline, int, int) | |
LastIndexOf(Trendline) | |
LastIndexOf(Trendline, int) | |
LastIndexOf(Trendline, int, int) | |
RemoveAt(int) |
例子
[C#]
//实例化一个工作簿对象
Workbook workbook = new Workbook();
//向Excel对象添加一个新的工作表
int sheetIndex = workbook.Worksheets.Add();
//通过传入工作表的索引来获取新添加的工作表的引用
Worksheet worksheet = workbook.Worksheets[sheetIndex];
worksheet.Cells["A1"].PutValue(50);
worksheet.Cells["A2"].PutValue(100);
worksheet.Cells["A3"].PutValue(150);
worksheet.Cells["A4"].PutValue(200);
worksheet.Cells["B1"].PutValue(60);
worksheet.Cells["B2"].PutValue(32);
worksheet.Cells["B3"].PutValue(50);
worksheet.Cells["B4"].PutValue(40);
//向工作表添加图表
int chartIndex = workbook.Worksheets[0].Charts.Add(ChartType.Column, 3, 3, 15, 10);
Chart chart = workbook.Worksheets[0].Charts[chartIndex];
chart.NSeries.Add("A1:a3", true);
chart.NSeries[0].TrendLines.Add(TrendlineType.Linear, "MyTrendLine");
Trendline line = chart.NSeries[0].TrendLines[0];
line.DisplayEquation = true;
line.DisplayRSquared = true;
line.Color = Color.Red;
[Visual Basic]
'实例化工作簿对象
Dim workbook As Workbook = New Workbook()
'向 Excel 对象添加新工作表
Dim sheetIndex As Int32 = workbook.Worksheets.Add()
'通过传入工作表的索引来获取新添加的工作表的引用
Dim worksheet As Worksheet = workbook.Worksheets(sheetIndex)
worksheet.Cells("A1").PutValue(50)
worksheet.Cells("A2").PutValue(100)
worksheet.Cells("A3").PutValue(150)
worksheet.Cells("A4").PutValue(200)
worksheet.Cells("B1").PutValue(60)
worksheet.Cells("B2").PutValue(32)
worksheet.Cells("B3").PutValue(50)
worksheet.Cells("B4").PutValue(40)
'将图表添加到工作表
Dim chartIndex As Integer = workbook.Worksheets(0).Charts.Add(ChartType.Column,3,3,15,10)
Dim chart As Chart = workbook.Worksheets(0).Charts(chartIndex)
chart.NSeries.Add("A1:a3", True)
chart.NSeries(0).TrendLines.Add(TrendlineType.Linear, "MyTrendLine")
Dim line As Trendline = chart.NSeries(0).TrendLines(0)
line.DisplayEquation = True
line.DisplayRSquared = True
line.Color = Color.Red
也可以看看
- class CollectionBase<T>
- class Trendline
- 命名空间 Aspose.Cells.Charts
- 部件 Aspose.Cells