Class SeriesCollection
Namespace: Aspose.Cells.Charts
Assembly: Aspose.Cells.dll (25.2.0)
Bao gồm một tập hợp các đối tượng Aspose.Cells.Charts.Series.
public class SeriesCollection : CollectionBase<series>, IList<series>, ICollection<series>, IEnumerable<series>, ICollection, IEnumerable
Kế thừa
object ← CollectionBase<series> ← SeriesCollection
Triển khai
IList<series>, ICollection<series>, IEnumerable<series>, ICollection, IEnumerable
Thành viên kế thừa
CollectionBase<series>.BinarySearch(Series), CollectionBase<series>.BinarySearch(Series, IComparer<series>), CollectionBase<series>.BinarySearch(int, int, Series, IComparer<series>), CollectionBase<series>.Contains(Series), CollectionBase<series>.CopyTo(Series[]), CollectionBase<series>.CopyTo(Series[], int), CollectionBase<series>.CopyTo(int, Series[], int, int), CollectionBase<series>.Exists(Predicate<series>), CollectionBase<series>.Find(Predicate<series>), CollectionBase<series>.FindAll(Predicate<series>), CollectionBase<series>.FindIndex(Predicate<series>), CollectionBase<series>.FindIndex(int, Predicate<series>), CollectionBase<series>.FindIndex(int, int, Predicate<series>), CollectionBase<series>.FindLast(Predicate<series>), CollectionBase<series>.FindLastIndex(Predicate<series>), CollectionBase<series>.FindLastIndex(int, Predicate<series>), CollectionBase<series>.FindLastIndex(int, int, Predicate<series>), CollectionBase<series>.IndexOf(Series), CollectionBase<series>.IndexOf(Series, int), CollectionBase<series>.IndexOf(Series, int, int), CollectionBase<series>.LastIndexOf(Series), CollectionBase<series>.LastIndexOf(Series, int), CollectionBase<series>.LastIndexOf(Series, int, int), CollectionBase<series>.GetEnumerator(), CollectionBase<series>.Clear(), CollectionBase<series>.RemoveAt(int), CollectionBase<series>.OnClearComplete(), CollectionBase<series>.OnClear(), CollectionBase<series>.Capacity, CollectionBase<series>.Count, CollectionBase<series>.InnerList, CollectionBase<series>.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 mới được thêm bằng cách truyền chỉ số bảng
Worksheet worksheet = workbook.Worksheets[sheetIndex];
//Thêm một giá trị mẫu vào ô "A1"
worksheet.Cells["A1"].PutValue(50);
//Thêm một giá trị mẫu vào ô "A2"
worksheet.Cells["A2"].PutValue(100);
//Thêm một giá trị mẫu vào ô "A3"
worksheet.Cells["A3"].PutValue(150);
//Thêm một giá trị mẫu vào ô "A4"
worksheet.Cells["A4"].PutValue(200);
//Thêm một giá trị mẫu vào ô "B1"
worksheet.Cells["B1"].PutValue(60);
//Thêm một giá trị mẫu vào ô "B2"
worksheet.Cells["B2"].PutValue(32);
//Thêm một giá trị mẫu vào ô "B3"
worksheet.Cells["B3"].PutValue(50);
//Thêm một giá trị mẫu vào ô "B4"
worksheet.Cells["B4"].PutValue(40);
//Thêm một giá trị mẫu vào ô "C1" như dữ liệu danh mục
worksheet.Cells["C1"].PutValue("Q1");
//Thêm một giá trị mẫu vào ô "C2" như dữ liệu danh mục
worksheet.Cells["C2"].PutValue("Q2");
//Thêm một giá trị mẫu vào ô "C3" như dữ liệu danh mục
worksheet.Cells["C3"].PutValue("Y1");
//Thêm một giá trị mẫu vào ô "C4" như dữ liệu danh mục
worksheet.Cells["C4"].PutValue("Y2");
//Thêm một biểu đồ vào bảng tính
int chartIndex = worksheet.Charts.Add(ChartType.Column, 5, 0, 15, 5);
//Truy cập vào thể hiện của biểu đồ mới được thêm
Chart chart = worksheet.Charts[chartIndex];
//Thêm NSeries (nguồn dữ liệu biểu đồ) vào biểu đồ từ ô "A1" đến "B4"
chart.NSeries.Add("A1:B4", true);
//Thiết lập nguồn dữ liệu cho dữ liệu danh mục của NSeries
chart.NSeries.CategoryData = "C1:C4";
//Lưu tệp Excel
workbook.Save("book1.xls");
'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 Integer = workbook.Worksheets.Add()
'Lấy tham chiếu của bảng tính mới được thêm bằng cách truyền chỉ số bảng
Dim worksheet As Worksheet = workbook.Worksheets(sheetIndex)
'Thêm một giá trị mẫu vào ô "A1"
worksheet.Cells("A1").PutValue(50)
'Thêm một giá trị mẫu vào ô "A2"
worksheet.Cells("A2").PutValue(100)
'Thêm một giá trị mẫu vào ô "A3"
worksheet.Cells("A3").PutValue(150)
'Thêm một giá trị mẫu vào ô "A4"
worksheet.Cells("A4").PutValue(200)
'Thêm một giá trị mẫu vào ô "B1"
worksheet.Cells("B1").PutValue(60)
'Thêm một giá trị mẫu vào ô "B2"
worksheet.Cells("B2").PutValue(32)
'Thêm một giá trị mẫu vào ô "B3"
worksheet.Cells("B3").PutValue(50)
'Thêm một giá trị mẫu vào ô "B4"
worksheet.Cells("B4").PutValue(40)
'Thêm một giá trị mẫu vào ô "C1" như dữ liệu danh mục
worksheet.Cells("C1").PutValue("Q1")
'Thêm một giá trị mẫu vào ô "C2" như dữ liệu danh mục
worksheet.Cells("C2").PutValue("Q2")
'Thêm một giá trị mẫu vào ô "C3" như dữ liệu danh mục
worksheet.Cells("C3").PutValue("Y1")
'Thêm một giá trị mẫu vào ô "C4" như dữ liệu danh mục
worksheet.Cells("C4").PutValue("Y2")
'Thêm một biểu đồ vào bảng tính
Dim chartIndex As Integer = worksheet.Charts.Add(ChartType.Column, 5, 0, 15, 5)
'Truy cập vào thể hiện của biểu đồ mới được thêm
Dim chart As Chart = worksheet.Charts(chartIndex)
'Thêm NSeries (nguồn dữ liệu biểu đồ) vào biểu đồ từ ô "A1" đến "B4"
chart.NSeries.Add("A1:B4", True)
'Thiết lập nguồn dữ liệu cho dữ liệu danh mục của NSeries
chart.NSeries.CategoryData = "C1:C4"
'Lưu tệp Excel
workbook.Save("book1.xls")
Thuộc tính
CategoryData
Lấy hoặc thiết lập phạm vi các giá trị trục danh mục. Nó có thể là một phạm vi ô (chẳng hạn như, “d1:e10”), hoặc một chuỗi giá trị (chẳng hạn như,"{2,6,8,10}").
public string CategoryData { get; set; }
Giá trị thuộc tính
IsColorVaried
Biểu thị xem màu của các điểm có khác nhau hay không.
public bool IsColorVaried { get; set; }
Giá trị thuộc tính
SecondCategoryData
Lấy hoặc thiết lập phạm vi các giá trị trục danh mục thứ hai. Nó có thể là một phạm vi ô (chẳng hạn như, “d1:e10”), hoặc một chuỗi giá trị (chẳng hạn như,"{2,6,8,10}"). Chỉ có tác dụng khi một số ASeries vẽ trên trục thứ hai.
public string SecondCategoryData { get; set; }
Giá trị thuộc tính
this[int]
Lấy phần tử Aspose.Cells.Charts.Series tại chỉ số được chỉ định.
public Series this[int index] { get; }
Giá trị thuộc tính
Phương thức
Add(string, bool)
Thêm tập hợp Aspose.Cells.Charts.Series vào biểu đồ.
public int Add(string area, bool isVertical)
Tham số
area
string
Chỉ định các giá trị từ đó vẽ các chuỗi dữ liệu
isVertical
bool
Chỉ định xem có vẽ chuỗi từ một phạm vi giá trị ô theo hàng hay theo cột.
Trả về
Trả về chỉ số đầu tiên của ASeries đã thêm vào NSeries.
Nhận xét
Nếu thiết lập dữ liệu trên các ô liên tiếp, sử dụng dấu hai chấm để phân tách chúng. Ví dụ, $C$2:$C$5.
Nếu thiết lập dữ liệu trên các ô không liên tiếp, sử dụng dấu phẩy để phân tách chúng. Ví dụ: ($C$2,$D$5).
Add(string, bool, bool)
Thêm tập hợp Aspose.Cells.Charts.Series vào biểu đồ.
public int Add(string area, bool isVertical, bool checkLabels)
Tham số
area
string
Chỉ định các giá trị từ đó vẽ các chuỗi dữ liệu
isVertical
bool
Chỉ định xem có vẽ chuỗi từ một phạm vi giá trị ô theo hàng hay theo cột.
checkLabels
bool
Chỉ ra xem phạm vi có chứa tên của chuỗi hay không
Trả về
Trả về chỉ số đầu tiên của ASeries đã thêm vào NSeries.
Nhận xét
Nếu thiết lập dữ liệu trên các ô liên tiếp, sử dụng dấu hai chấm để phân tách chúng. Ví dụ, $C$2:$C$5.
Nếu thiết lập dữ liệu trên các ô không liên tiếp, sử dụng dấu phẩy để phân tách chúng. Ví dụ: ($C$2,$D$5).
AddR1C1(string, bool)
Thêm tập hợp Aspose.Cells.Charts.Series vào biểu đồ.
public int AddR1C1(string area, bool isVertical)
Tham số
area
string
Chỉ định các giá trị từ đó vẽ các chuỗi dữ liệu
isVertical
bool
Chỉ định xem có vẽ chuỗi từ một phạm vi giá trị ô theo hàng hay theo cột.
Trả về
Trả về chỉ số đầu tiên của ASeries đã thêm vào NSeries.
Nhận xét
Nếu thiết lập dữ liệu trên các ô liên tiếp, sử dụng dấu hai chấm để phân tách chúng. Ví dụ, R[1]C[1]:R[3]C[2].
Nếu thiết lập dữ liệu trên các ô không liên tiếp, sử dụng dấu phẩy để phân tách chúng. Ví dụ,(R[1]C[1],R[3]C[2]).
Clear()
Xóa tập hợp
public void Clear()
GetSeriesByOrder(int)
Lấy phần tử Aspose.Cells.Charts.Series theo thứ tự.
public Series GetSeriesByOrder(int order)
Tham số
order
int
Thứ tự của chuỗi
Trả về
Phần tử chuỗi
RemoveAt(int)
Xóa một chuỗi tại chỉ số cụ thể.
public void RemoveAt(int index)
Tham số
index
int
Chỉ số.
SetSeriesNames(int, string, bool)
Thiết lập tên cho tất cả các chuỗi trong biểu đồ.
public void SetSeriesNames(int startIndex, string area, bool isVertical)
Tham số
startIndex
int
Chỉ số của chuỗi đầu tiên mà bạn muốn thiết lập tên.
area
string
Chỉ định khu vực cho tên chuỗi.
isVertical
bool
>Chỉ định xem có vẽ chuỗi từ một phạm vi giá trị ô theo hàng hay theo cột.
Nhận xét
Nếu chỉ số bắt đầu lớn hơn số lượng chuỗi, nó sẽ trả về và không làm gì cả.
Nếu thiết lập dữ liệu trên các ô liên tiếp, sử dụng dấu hai chấm để phân tách chúng. Ví dụ, $C$2:$C$5.
Nếu thiết lập dữ liệu trên các ô không liên tiếp, sử dụng dấu phẩy để phân tách chúng. Ví dụ, ($C$2,$D$5).
SwapSeries(int, int)
Thay đổi trực tiếp thứ tự của hai chuỗi.
public void SwapSeries(int sourceIndex, int destIndex)
Tham số
sourceIndex
int
Chỉ số hiện tại
destIndex
int
Chỉ số đích