Class ChartPointCollection
Class ChartPointCollection
Namespace: Aspose.Cells.Charts
Assembly: Aspose.Cells.dll (25.2.0)
1つの系列内のすべてのポイントを含むコレクションを表します。
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];
//「A1」セルから「B3」までの範囲を持つNSeries(チャートデータソース)をチャートに追加
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)
'「A1」セルから「B3」までの範囲を持つNSeries(チャートデータソース)をチャートに追加
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; }
プロパティ値
this[int]
系列内の指定されたインデックスにあるAspose.Cells.Charts.ChartPoint要素を取得します。
public ChartPoint this[int index] { get; }
プロパティ値
メソッド
Clear()
チャートポイントのすべての設定を削除します。
public void Clear()
GetEnumerator()
Aspose.Cells.Charts.ChartPointCollection全体の列挙子を返します。
public IEnumerator GetEnumerator()
戻り値
RemoveAt(int)
系列のインデックスにあるポイントを削除します。
public void RemoveAt(int index)
パラメーター
index
int
ポイントのインデックス。