跳转到内容

GraphItems

app.activeDocument.graphItems

一个 GraphItem 对象的集合,它允许你访问 Illustrator 文档中的所有图表艺术项。


app.activeDocument.graphItems.length

集合中的对象数量。

数字;只读。


app.activeDocument.graphItems.parent

此对象的父对象。

对象;只读。


app.activeDocument.graphItems.typename

引用对象的类名。

字符串;只读。


app.activeDocument.graphItems.getByName(name)

获取集合中具有指定名称的第一个元素。

参数类型描述
name字符串要获取的元素名称

GraphItems


app.activeDocument.graphItems.index(itemKey)

从集合中获取一个元素。

参数类型描述
itemKey字符串, 数字字符串或数字键

GraphItem


app.activeDocument.graphItems.removeAll()

删除集合中的所有元素。

无。


// 将当前文档中的每个图表项旋转 90 度。
// 验证是否打开了包含图表项的文档
var ok = false;
if (documents.length > 0) {
var docRef = activeDocument;
var iCount = docRef.graphItems.length;
if (iCount > 0) {
ok = true;
for (var i = 0; i < iCount; i++) {
var graphRef = docRef.graphItems[i];
graphRef.selected = true;
graphRef.rotate(90); // 顺时针旋转 90 度
}
redraw();
}
}