Class SeriesCollection

Class SeriesCollection

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

รวมกลุ่มของวัตถุ Aspose.Cells.Charts.Series

public class SeriesCollection : CollectionBase<series>, IList<series>, ICollection<series>, IEnumerable<series>, ICollection, IEnumerable

การสืบทอด

objectCollectionBase<series>SeriesCollection

การนำไปใช้

IList<series>, ICollection<series>, IEnumerable<series>, ICollection, IEnumerable

สมาชิกที่สืบทอด

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()

ตัวอย่าง

//การสร้างวัตถุ 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"
chart.NSeries.Add("A1:B4", true);
//การตั้งค่าแหล่งข้อมูลสำหรับข้อมูลหมวดหมู่ของ NSeries
chart.NSeries.CategoryData = "C1:C4";
//การบันทึกไฟล์ Excel
workbook.Save("book1.xls");
'การสร้างวัตถุ Workbook
Dim workbook As Workbook = New Workbook()
'การเพิ่มแผ่นงานใหม่ไปยังวัตถุ Excel
Dim sheetIndex As Integer = 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 Integer = worksheet.Charts.Add(ChartType.Column, 5, 0, 15, 5)
'การเข้าถึงอินสแตนซ์ของแผนภูมิที่เพิ่งเพิ่ม
Dim chart As Chart = worksheet.Charts(chartIndex)
'การเพิ่ม NSeries (แหล่งข้อมูลแผนภูมิ) ไปยังแผนภูมิที่มีช่วงจากเซลล์ "A1" ถึง "B4"
chart.NSeries.Add("A1:B4", True)
'การตั้งค่าแหล่งข้อมูลสำหรับข้อมูลหมวดหมู่ของ NSeries
chart.NSeries.CategoryData = "C1:C4"
'การบันทึกไฟล์ Excel
workbook.Save("book1.xls")

คุณสมบัติ

CategoryData

รับหรือกำหนดช่วงของค่าของแกนหมวดหมู่ สามารถเป็นช่วงของเซลล์ (เช่น “d1:e10”) หรือชุดค่าต่างๆ (เช่น “{2,6,8,10}”)

public string CategoryData { get; set; }

ค่าของคุณสมบัติ

string

IsColorVaried

แสดงให้เห็นว่าสีของจุดมีความหลากหลายหรือไม่

public bool IsColorVaried { get; set; }

ค่าของคุณสมบัติ

bool

SecondCategoryData

รับหรือกำหนดช่วงของค่าของแกนหมวดหมู่ที่สอง สามารถเป็นช่วงของเซลล์ (เช่น “d1:e10”) หรือชุดค่าต่างๆ (เช่น “{2,6,8,10}”) มีผลเฉพาะเมื่อ ASeries บางตัวถูกวาดบนแกนที่สอง

public string SecondCategoryData { get; set; }

ค่าของคุณสมบัติ

string

this[int]

รับองค์ประกอบ Aspose.Cells.Charts.Series ที่ตำแหน่งดัชนีที่ระบุ

public Series this[int index] { get; }

ค่าของคุณสมบัติ

Series

วิธีการ

Add(string, bool)

เพิ่มกลุ่ม Aspose.Cells.Charts.Series ไปยังแผนภูมิ

public int Add(string area, bool isVertical)

พารามิเตอร์

area string

กำหนดค่าจากที่ใช้ในการวาดชุดข้อมูล

isVertical bool

กำหนดว่าจะแสดงชุดข้อมูลจากช่วงของค่าของเซลล์ตามแถวหรือคอลัมน์

คืนค่า

int

คืนค่าดัชนีแรกของ ASeries ที่เพิ่มใน NSeries

หมายเหตุ


หากตั้งค่าข้อมูลในเซลล์ที่ต่อเนื่องกัน ให้ใช้เครื่องหมายสองจุดเพื่อแยก เช่น $C$2:$C$5
หากตั้งค่าข้อมูลในเซลล์ที่ไม่ต่อเนื่องกัน ให้ใช้เครื่องหมายจุลภาคเพื่อแยก เช่น ($C$2,$D$5)

Add(string, bool, bool)

เพิ่มกลุ่ม Aspose.Cells.Charts.Series ไปยังแผนภูมิ

public int Add(string area, bool isVertical, bool checkLabels)

พารามิเตอร์

area string

กำหนดค่าจากที่ใช้ในการวาดชุดข้อมูล

isVertical bool

กำหนดว่าจะแสดงชุดข้อมูลจากช่วงของค่าของเซลล์ตามแถวหรือคอลัมน์

checkLabels bool

ระบุว่าช่วงนั้นมีชื่อชุดข้อมูลหรือไม่

คืนค่า

int

คืนค่าดัชนีแรกของ ASeries ที่เพิ่มใน NSeries

หมายเหตุ


หากตั้งค่าข้อมูลในเซลล์ที่ต่อเนื่องกัน ให้ใช้เครื่องหมายสองจุดเพื่อแยก เช่น $C$2:$C$5
หากตั้งค่าข้อมูลในเซลล์ที่ไม่ต่อเนื่องกัน ให้ใช้เครื่องหมายจุลภาคเพื่อแยก เช่น ($C$2,$D$5)

AddR1C1(string, bool)

เพิ่มกลุ่ม Aspose.Cells.Charts.Series ไปยังแผนภูมิ

public int AddR1C1(string area, bool isVertical)

พารามิเตอร์

area string

กำหนดค่าจากที่ใช้ในการวาดชุดข้อมูล

isVertical bool

กำหนดว่าจะแสดงชุดข้อมูลจากช่วงของค่าของเซลล์ตามแถวหรือคอลัมน์

คืนค่า

int

คืนค่าดัชนีแรกของ ASeries ที่เพิ่มใน NSeries

หมายเหตุ


หากตั้งค่าข้อมูลในเซลล์ที่ต่อเนื่องกัน ให้ใช้เครื่องหมายสองจุดเพื่อแยก เช่น R[1]C[1]:R[3]C[2]
หากตั้งค่าข้อมูลในเซลล์ที่ไม่ต่อเนื่องกัน ให้ใช้เครื่องหมายจุลภาคเพื่อแยก เช่น (R[1]C[1],R[3]C[2])

Clear()

ล้างกลุ่ม

public void Clear()

GetSeriesByOrder(int)

รับองค์ประกอบ Aspose.Cells.Charts.Series ตามลำดับ

public Series GetSeriesByOrder(int order)

พารามิเตอร์

order int

ลำดับของชุดข้อมูล

คืนค่า

Series

องค์ประกอบชุดข้อมูล

RemoveAt(int)

ลบชุดข้อมูลที่ตำแหน่งดัชนีที่ระบุ

public void RemoveAt(int index)

พารามิเตอร์

index int

ดัชนี

SetSeriesNames(int, string, bool)

ตั้งชื่อชุดข้อมูลทั้งหมดในแผนภูมิ

public void SetSeriesNames(int startIndex, string area, bool isVertical)

พารามิเตอร์

startIndex int

ดัชนีของชุดข้อมูลแรกที่คุณต้องการตั้งชื่อ

area string

กำหนดพื้นที่สำหรับชื่อชุดข้อมูล

isVertical bool

>กำหนดว่าจะแสดงชุดข้อมูลจากช่วงของค่าของเซลล์ตามแถวหรือคอลัมน์

หมายเหตุ


หากดัชนีเริ่มต้นมากกว่าจำนวนชุดข้อมูล จะไม่มีการคืนค่าและไม่มีการดำเนินการใดๆ
หากตั้งค่าข้อมูลในเซลล์ที่ต่อเนื่องกัน ให้ใช้เครื่องหมายสองจุดเพื่อแยก เช่น $C$2:$C$5
หากตั้งค่าข้อมูลในเซลล์ที่ไม่ต่อเนื่องกัน ให้ใช้เครื่องหมายจุลภาคเพื่อแยก เช่น ($C$2,$D$5)

SwapSeries(int, int)

เปลี่ยนลำดับของสองชุดข้อมูลโดยตรง

public void SwapSeries(int sourceIndex, int destIndex)

พารามิเตอร์

sourceIndex int

ดัชนีปัจจุบัน

destIndex int

ดัชนีปลายทาง

 แบบไทย