Class ChartPointCollection

Class ChartPointCollection

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

Rappresenta una collezione che contiene tutti i punti in una serie.

public class ChartPointCollection

Ereditarietà

objectChartPointCollection

Membri Ereditati

object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()

Esempi

//Creazione di un oggetto Workbook
Workbook workbook = new Workbook();

//Ottenere il riferimento del primo foglio di lavoro
Worksheet worksheet = workbook.Worksheets[0];

//Aggiungere un valore di esempio alla cella "A1"
worksheet.Cells["A1"].PutValue(50);

//Aggiungere un valore di esempio alla cella "A2"
worksheet.Cells["A2"].PutValue(100);

//Aggiungere un valore di esempio alla cella "A3"
worksheet.Cells["A3"].PutValue(150);

//Aggiungere un valore di esempio alla cella "B1"
worksheet.Cells["B1"].PutValue(60);

//Aggiungere un valore di esempio alla cella "B2"
worksheet.Cells["B2"].PutValue(32);

//Aggiungere un valore di esempio alla cella "B3"
worksheet.Cells["B3"].PutValue(50);

//Aggiungere un grafico al foglio di lavoro
int chartIndex = worksheet.Charts.Add(ChartType.PieExploded, 5, 0, 25, 10);

//Accedere all'istanza del grafico appena aggiunto
Chart chart = worksheet.Charts[chartIndex];

//Aggiungere NSeries (sorgente dati del grafico) al grafico che va dalla cella "A1" alla "B3"
chart.NSeries.Add("A1:B3", true);

//Mostra le etichette dei dati 
chart.NSeries[0].DataLabels.ShowValue = true;

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

for (int i = 0; i < points.Count; i++)
{
    //Ottieni il punto dati
    ChartPoint point = points[i];
    //Imposta l'esplosione della torta
    point.Explosion = 15;
    //Imposta il colore del bordo
    point.Border.Color = System.Drawing.Color.Red;
}

//Salvare il file Excel
workbook.Save("book1.xls");

'Creazione di un oggetto Workbook
Dim workbook As Workbook = New Workbook()

'Ottenere il riferimento del primo foglio di lavoro
Dim worksheet As Worksheet = workbook.Worksheets(0)

'Aggiungere un valore di esempio alla cella "A1"
worksheet.Cells("A1").PutValue(50)

'Aggiungere un valore di esempio alla cella "A2"
worksheet.Cells("A2").PutValue(100)

'Aggiungere un valore di esempio alla cella "A3"
worksheet.Cells("A3").PutValue(150)

'Aggiungere un valore di esempio alla cella "B1"
worksheet.Cells("B1").PutValue(60)

'Aggiungere un valore di esempio alla cella "B2"
worksheet.Cells("B2").PutValue(32)

'Aggiungere un valore di esempio alla cella "B3"
worksheet.Cells("B3").PutValue(50)

'Aggiungere un grafico al foglio di lavoro
Dim chartIndex As Integer = worksheet.Charts.Add(ChartType.PieExploded, 5, 0, 25, 10)

'Accedere all'istanza del grafico appena aggiunto
Dim chart As Chart = worksheet.Charts(chartIndex)

'Aggiungere NSeries (sorgente dati del grafico) al grafico che va dalla cella "A1" alla "B3"
chart.NSeries.Add("A1:B3", True)

'Mostra le etichette dei dati 
chart.NSeries(0).DataLabels.ShowValue = True

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

For i As Integer = 0 To points.Count - 1
    'Ottieni il punto dati
    Dim point As ChartPoint = points(i)
    'Imposta l'esplosione della torta
    point.Explosion = 15
    'Imposta il colore del bordo
    point.Border.Color = System.Drawing.Color.Red
Next i

'Salvare il file Excel
workbook.Save("book1.xls")

Proprietà

Count

Ottiene il conteggio del punto del grafico.

public int Count { get; }

Valore della Proprietà

int

this[int]

Ottiene l’elemento Aspose.Cells.Charts.ChartPoint all’indice specificato nella serie.

public ChartPoint this[int index] { get; }

Valore della Proprietà

ChartPoint

Metodi

Clear()

Rimuove tutte le impostazioni dei punti del grafico.

public void Clear()

GetEnumerator()

Restituisce un enumeratore per l’intera Aspose.Cells.Charts.ChartPointCollection.

public IEnumerator GetEnumerator()

Restituisce

IEnumerator

RemoveAt(int)

Rimuove il punto all’indice della serie.

public void RemoveAt(int index)

Parametri

index int

L’indice del punto.

 Italiano