Class ChartPointCollection
Class ChartPointCollection
Namespace: Aspose.Cells.Charts
Assembly: Aspose.Cells.dll (25.2.0)
แสดงถึงคอลเลกชันที่ประกอบด้วยจุดทั้งหมดในหนึ่งซีรีส์
public class ChartPointCollection
การสืบทอด
สมาชิกที่สืบทอด
object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()
ตัวอย่าง
//การสร้างวัตถุ Workbook
Workbook workbook = new Workbook();
//การเข้าถึงอ้างอิงของแผ่นงานแรก
Worksheet worksheet = workbook.Worksheets[0];
//การเพิ่มค่าตัวอย่างลงในเซลล์ "A1"
worksheet.Cells["A1"].PutValue(50);
//การเพิ่มค่าตัวอย่างลงในเซลล์ "A2"
worksheet.Cells["A2"].PutValue(100);
//การเพิ่มค่าตัวอย่างลงในเซลล์ "A3"
worksheet.Cells["A3"].PutValue(150);
//การเพิ่มค่าตัวอย่างลงในเซลล์ "B1"
worksheet.Cells["B1"].PutValue(60);
//การเพิ่มค่าตัวอย่างลงในเซลล์ "B2"
worksheet.Cells["B2"].PutValue(32);
//การเพิ่มค่าตัวอย่างลงในเซลล์ "B3"
worksheet.Cells["B3"].PutValue(50);
//การเพิ่มกราฟลงในแผ่นงาน
int chartIndex = worksheet.Charts.Add(ChartType.PieExploded, 5, 0, 25, 10);
//การเข้าถึงอินสแตนซ์ของกราฟที่เพิ่งเพิ่ม
Chart chart = worksheet.Charts[chartIndex];
//การเพิ่ม NSeries (แหล่งข้อมูลกราฟ) ลงในกราฟตั้งแต่เซลล์ "A1" ถึง "B3"
chart.NSeries.Add("A1:B3", true);
//แสดงป้ายข้อมูล
chart.NSeries[0].DataLabels.ShowValue = true;
ChartPointCollection points = chart.NSeries[0].Points;
for (int i = 0; i < points.Count; i++)
{
//รับข้อมูลจุดข้อมูล
ChartPoint point = points[i];
//ตั้งค่าการระเบิด
point.Explosion = 15;
//ตั้งค่าสีขอบ
point.Border.Color = System.Drawing.Color.Red;
}
//การบันทึกไฟล์ Excel
workbook.Save("book1.xls");
'การสร้างวัตถุ Workbook
Dim workbook As Workbook = New Workbook()
'การเข้าถึงอ้างอิงของแผ่นงานแรก
Dim worksheet As Worksheet = workbook.Worksheets(0)
'การเพิ่มค่าตัวอย่างลงในเซลล์ "A1"
worksheet.Cells("A1").PutValue(50)
'การเพิ่มค่าตัวอย่างลงในเซลล์ "A2"
worksheet.Cells("A2").PutValue(100)
'การเพิ่มค่าตัวอย่างลงในเซลล์ "A3"
worksheet.Cells("A3").PutValue(150)
'การเพิ่มค่าตัวอย่างลงในเซลล์ "B1"
worksheet.Cells("B1").PutValue(60)
'การเพิ่มค่าตัวอย่างลงในเซลล์ "B2"
worksheet.Cells("B2").PutValue(32)
'การเพิ่มค่าตัวอย่างลงในเซลล์ "B3"
worksheet.Cells("B3").PutValue(50)
'การเพิ่มกราฟลงในแผ่นงาน
Dim chartIndex As Integer = worksheet.Charts.Add(ChartType.PieExploded, 5, 0, 25, 10)
'การเข้าถึงอินสแตนซ์ของกราฟที่เพิ่งเพิ่ม
Dim chart As Chart = worksheet.Charts(chartIndex)
'การเพิ่ม NSeries (แหล่งข้อมูลกราฟ) ลงในกราฟตั้งแต่เซลล์ "A1" ถึง "B3"
chart.NSeries.Add("A1:B3", True)
'แสดงป้ายข้อมูล
chart.NSeries(0).DataLabels.ShowValue = True
Dim points As ChartPointCollection = chart.NSeries(0).Points
For i As Integer = 0 To points.Count - 1
'รับข้อมูลจุดข้อมูล
Dim point As ChartPoint = points(i)
'ตั้งค่าการระเบิด
point.Explosion = 15
'ตั้งค่าสีขอบ
point.Border.Color = System.Drawing.Color.Red
Next i
'การบันทึกไฟล์ Excel
workbook.Save("book1.xls")
คุณสมบัติ
Count
รับจำนวนของจุดกราฟ
public int Count { get; }
ค่า Property
this[int]
รับองค์ประกอบ Aspose.Cells.Charts.ChartPoint ที่ตำแหน่งดัชนีที่ระบุในซีรีส์
public ChartPoint this[int index] { get; }
ค่า Property
วิธีการ
Clear()
ลบการตั้งค่าทั้งหมดของจุดกราฟ
public void Clear()
GetEnumerator()
คืนค่าตัวนับสำหรับ Aspose.Cells.Charts.ChartPointCollection ทั้งหมด
public IEnumerator GetEnumerator()
คืนค่า
RemoveAt(int)
ลบจุดที่ตำแหน่งดัชนีของซีรีส์
public void RemoveAt(int index)
พารามิเตอร์
index
int
ดัชนีของจุด