Class ChartPointCollection

Class ChartPointCollection

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

Đại diện cho một bộ sưu tập chứa tất cả các điểm trong một chuỗi.

public class ChartPointCollection

Kế thừa

objectChartPointCollection

Các thành viên kế thừa

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

//Lấy tham chiếu của bảng tính đầu tiên
Worksheet worksheet = workbook.Worksheets[0];

//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 ô "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 biểu đồ vào bảng tính
int chartIndex = worksheet.Charts.Add(ChartType.PieExploded, 5, 0, 25, 10);

//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 "B3"
chart.NSeries.Add("A1:B3", true);

//Hiển thị nhãn dữ liệu 
chart.NSeries[0].DataLabels.ShowValue = true;

ChartPointCollection points = chart.NSeries[0].Points;

for (int i = 0; i < points.Count; i++)
{
    //Lấy điểm dữ liệu
    ChartPoint point = points[i];
    //Thiết lập độ nổ của biểu đồ
    point.Explosion = 15;
    //Thiết lập màu viền
    point.Border.Color = System.Drawing.Color.Red;
}

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

'Lấy tham chiếu của bảng tính đầu tiên
Dim worksheet As Worksheet = workbook.Worksheets(0)

'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 ô "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 biểu đồ vào bảng tính
Dim chartIndex As Integer = worksheet.Charts.Add(ChartType.PieExploded, 5, 0, 25, 10)

'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 "B3"
chart.NSeries.Add("A1:B3", True)

'Hiển thị nhãn dữ liệu 
chart.NSeries(0).DataLabels.ShowValue = True

Dim points As ChartPointCollection = chart.NSeries(0).Points

For i As Integer = 0 To points.Count - 1
    'Lấy điểm dữ liệu
    Dim point As ChartPoint = points(i)
    'Thiết lập độ nổ của biểu đồ
    point.Explosion = 15
    'Thiết lập màu viền
    point.Border.Color = System.Drawing.Color.Red
Next i

'Lưu tệp Excel
workbook.Save("book1.xls")

Thuộc tính

Count

Lấy số lượng của điểm biểu đồ.

public int Count { get; }

Giá trị thuộc tính

int

this[int]

Lấy phần tử Aspose.Cells.Charts.ChartPoint tại chỉ số được chỉ định trong chuỗi.

public ChartPoint this[int index] { get; }

Giá trị thuộc tính

ChartPoint

Phương thức

Clear()

Xóa tất cả các thiết lập của các điểm biểu đồ.

public void Clear()

GetEnumerator()

Trả về một bộ liệt kê cho toàn bộ Aspose.Cells.Charts.ChartPointCollection.

public IEnumerator GetEnumerator()

Trả về

IEnumerator

RemoveAt(int)

Xóa điểm tại chỉ số của chuỗi.

public void RemoveAt(int index)

Tham số

index int

Chỉ số của điểm.

 Tiếng Việt