Class TrendlineCollection

Class TrendlineCollection

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

Đại diện cho một tập hợp tất cả các đối tượng Aspose.Cells.Charts.Trendline cho chuỗi dữ liệu được chỉ định.

public class TrendlineCollection : CollectionBase<trendline>, IList<trendline>, ICollection<trendline>, IEnumerable<trendline>, ICollection, IEnumerable

Kế thừa

objectCollectionBase<trendline>TrendlineCollection

Triển khai

IList<trendline>, ICollection<trendline>, IEnumerable<trendline>, ICollection, IEnumerable

Thành viên kế thừa

CollectionBase<trendline>.BinarySearch(Trendline), CollectionBase<trendline>.BinarySearch(Trendline, IComparer<trendline>), CollectionBase<trendline>.BinarySearch(int, int, Trendline, IComparer<trendline>), CollectionBase<trendline>.Contains(Trendline), CollectionBase<trendline>.CopyTo(Trendline[]), CollectionBase<trendline>.CopyTo(Trendline[], int), CollectionBase<trendline>.CopyTo(int, Trendline[], int, int), CollectionBase<trendline>.Exists(Predicate<trendline>), CollectionBase<trendline>.Find(Predicate<trendline>), CollectionBase<trendline>.FindAll(Predicate<trendline>), CollectionBase<trendline>.FindIndex(Predicate<trendline>), CollectionBase<trendline>.FindIndex(int, Predicate<trendline>), CollectionBase<trendline>.FindIndex(int, int, Predicate<trendline>), CollectionBase<trendline>.FindLast(Predicate<trendline>), CollectionBase<trendline>.FindLastIndex(Predicate<trendline>), CollectionBase<trendline>.FindLastIndex(int, Predicate<trendline>), CollectionBase<trendline>.FindLastIndex(int, int, Predicate<trendline>), CollectionBase<trendline>.IndexOf(Trendline), CollectionBase<trendline>.IndexOf(Trendline, int), CollectionBase<trendline>.IndexOf(Trendline, int, int), CollectionBase<trendline>.LastIndexOf(Trendline), CollectionBase<trendline>.LastIndexOf(Trendline, int), CollectionBase<trendline>.LastIndexOf(Trendline, int, int), CollectionBase<trendline>.GetEnumerator(), CollectionBase<trendline>.Clear(), CollectionBase<trendline>.RemoveAt(int), CollectionBase<trendline>.OnClearComplete(), CollectionBase<trendline>.OnClear(), CollectionBase<trendline>.Capacity, CollectionBase<trendline>.Count, CollectionBase<trendline>.InnerList, CollectionBase<trendline>.this[int], object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()

Ví dụ

//Khởi tạo một đối tượng Workbook
Workbook workbook = new Workbook();
//Thêm một bảng tính mới vào đối tượng Excel
int sheetIndex = workbook.Worksheets.Add();
//Lấy tham chiếu của bảng tính vừa thêm bằng cách truyền chỉ số bảng tính của nó
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);

//Thêm một biểu đồ vào bảng tính
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;
'Khởi tạo một đối tượng Workbook
Dim workbook As Workbook = New Workbook()
'Thêm một bảng tính mới vào đối tượng Excel
Dim sheetIndex As Int32 = workbook.Worksheets.Add()
'Lấy tham chiếu của bảng tính vừa thêm bằng cách truyền chỉ số bảng tính của nó
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)

'Thêm một biểu đồ vào bảng tính
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

Thuộc tính

this[int]

Lấy một đối tượng Aspose.Cells.Charts.Trendline theo chỉ số của nó.

public Trendline this[int index] { get; }

Giá trị thuộc tính

Trendline

Phương thức

Add(TrendlineType)

Thêm một đối tượng Aspose.Cells.Charts.Trendline vào tập hợp này với loại đã chỉ định.

public int Add(TrendlineType type)

Tham số

type TrendlineType

Loại trendline.

Trả về

int

Chỉ số của đối tượng Aspose.Cells.Charts.Trendline.

Add(TrendlineType, string)

Thêm một đối tượng Aspose.Cells.Charts.Trendline vào tập hợp này với loại và tên đã chỉ định.

public int Add(TrendlineType type, string name)

Tham số

type TrendlineType

Loại trendline.

name string

Tên trendline.

Trả về

int

Chỉ số của đối tượng Aspose.Cells.Charts.Trendline.

 Tiếng Việt