GraphItems
GraphItems
Section titled “GraphItems”app.activeDocument.graphItems
一个 GraphItem 对象的集合,它允许你访问 Illustrator 文档中的所有图表艺术项。
GraphItems.length
Section titled “GraphItems.length”app.activeDocument.graphItems.length
集合中的对象数量。
数字;只读。
GraphItems.parent
Section titled “GraphItems.parent”app.activeDocument.graphItems.parent
此对象的父对象。
对象;只读。
GraphItems.typename
Section titled “GraphItems.typename”app.activeDocument.graphItems.typename
引用对象的类名。
字符串;只读。
GraphItems.getByName()
Section titled “GraphItems.getByName()”app.activeDocument.graphItems.getByName(name)
获取集合中具有指定名称的第一个元素。
参数 | 类型 | 描述 |
---|---|---|
name | 字符串 | 要获取的元素名称 |
GraphItems.index()
Section titled “GraphItems.index()”app.activeDocument.graphItems.index(itemKey)
从集合中获取一个元素。
参数 | 类型 | 描述 |
---|---|---|
itemKey | 字符串, 数字 | 字符串或数字键 |
GraphItems.removeAll()
Section titled “GraphItems.removeAll()”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(); }}