Class ChartCollection
Namespace: Aspose.Cells.Charts
Assembly: Aspose.Cells.dll (25.2.0)
封装了一个 Aspose.Cells.Charts.Chart 对象的集合。
public class ChartCollection : CollectionBase<chart>, IList<chart>, ICollection<chart>, IEnumerable<chart>, ICollection, IEnumerable
继承
object ← CollectionBase<chart> ← ChartCollection
实现
IList<chart>, ICollection<chart>, IEnumerable<chart>, ICollection, IEnumerable
继承成员
CollectionBase<chart>.BinarySearch(Chart), CollectionBase<chart>.BinarySearch(Chart, IComparer<chart>), CollectionBase<chart>.BinarySearch(int, int, Chart, IComparer<chart>), CollectionBase<chart>.Contains(Chart), CollectionBase<chart>.CopyTo(Chart[]), CollectionBase<chart>.CopyTo(Chart[], int), CollectionBase<chart>.CopyTo(int, Chart[], int, int), CollectionBase<chart>.Exists(Predicate<chart>), CollectionBase<chart>.Find(Predicate<chart>), CollectionBase<chart>.FindAll(Predicate<chart>), CollectionBase<chart>.FindIndex(Predicate<chart>), CollectionBase<chart>.FindIndex(int, Predicate<chart>), CollectionBase<chart>.FindIndex(int, int, Predicate<chart>), CollectionBase<chart>.FindLast(Predicate<chart>), CollectionBase<chart>.FindLastIndex(Predicate<chart>), CollectionBase<chart>.FindLastIndex(int, Predicate<chart>), CollectionBase<chart>.FindLastIndex(int, int, Predicate<chart>), CollectionBase<chart>.IndexOf(Chart), CollectionBase<chart>.IndexOf(Chart, int), CollectionBase<chart>.IndexOf(Chart, int, int), CollectionBase<chart>.LastIndexOf(Chart), CollectionBase<chart>.LastIndexOf(Chart, int), CollectionBase<chart>.LastIndexOf(Chart, int, int), CollectionBase<chart>.GetEnumerator(), CollectionBase<chart>.Clear(), CollectionBase<chart>.RemoveAt(int), CollectionBase<chart>.OnClearComplete(), CollectionBase<chart>.OnClear(), CollectionBase<chart>.Capacity, CollectionBase<chart>.Count, CollectionBase<chart>.InnerList, CollectionBase<chart>.this[int], object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()
示例
Workbook workbook = new Workbook();
ChartCollection charts = workbook.Worksheets[0].Charts;
Dim workbook as Workbook = new Workbook()
Dim ChartCollection as Charts = workbook.Worksheets(0).Charts
属性
this[int]
获取指定索引处的 Aspose.Cells.Charts.Chart 元素。
public Chart this[int index] { get; }
属性值
this[string]
通过名称获取图表。
public Chart this[string name] { get; }
属性值
备注
默认图表名称为 null。因此,您必须显式设置图表的名称。
方法
Add(ChartType, int, int, int, int)
向集合中添加图表。
public int Add(ChartType type, int upperLeftRow, int upperLeftColumn, int lowerRightRow, int lowerRightColumn)
参数
type
ChartType
图表类型
upperLeftRow
int
左上角行索引。
upperLeftColumn
int
左上角列索引。
lowerRightRow
int
右下角行索引
lowerRightColumn
int
右下角列索引
返回
Aspose.Cells.Charts.Chart 对象索引。
Add(byte[], string, bool, int, int, int, int)
添加带有预设模板的图表。
public int Add(byte[] data, string dataRange, bool isVertical, int topRow, int leftColumn, int rightRow, int bottomColumn)
参数
data
byte[]
图表模板文件(.crtx)的数据。
dataRange
string
指定图表的数据范围
isVertical
bool
指定是否按行或按列绘制系列。
topRow
int
左上角行索引。
leftColumn
int
左上角列索引。
rightRow
int
右下角行索引
bottomColumn
int
右下角列索引
返回
Aspose.Cells.Charts.Chart 对象索引。
Add(ChartType, string, bool, int, int, int, int)
向集合中添加图表。
public int Add(ChartType type, string dataRange, bool isVertical, int topRow, int leftColumn, int rightRow, int bottomColumn)
参数
type
ChartType
图表类型
dataRange
string
指定图表的数据范围
isVertical
bool
指定是否按行或按列绘制系列。
topRow
int
左上角行索引。
leftColumn
int
左上角列索引。
rightRow
int
右下角行索引
bottomColumn
int
右下角列索引
返回
Aspose.Cells.Charts.Chart 对象索引。
AddFloatingChart(ChartType, int, int, int, int)
向集合中添加图表。
public int AddFloatingChart(ChartType type, int left, int top, int width, int height)
参数
type
ChartType
图表类型
left
int
到角落的 x 偏移量
top
int
到角落的 y 偏移量
width
int
图表宽度
height
int
图表高度
返回
Aspose.Cells.Charts.Chart 对象索引。
Clear()
清除所有图表。
public void Clear()
RemoveAt(int)
移除特定索引处的图表。
public void RemoveAt(int index)
参数
index
int
图表索引。