Skip to content

GraphItems

app.activeDocument.graphItems

A collection GraphItem objects, which gives you access to all the graph art items in an Illustrator document.


app.activeDocument.graphItems.length

The number of objects in the collection.

Number; read-only.


app.activeDocument.graphItems.parent

The parent of this object.

Object; read-only.


app.activeDocument.graphItems.typename

The class name of the referenced object.

String; read-only.


app.activeDocument.graphItems.getByName(name)

Gets the first element in the collection with the specified name.

ParameterTypeDescription
nameStringName of element to get

GraphItems


app.activeDocument.graphItems.index(itemKey)

Gets an element from the collection.

ParameterTypeDescription
itemKeyString, NumberString or number key

GraphItem


app.activeDocument.graphItems.removeAll()

Deletes all elements in the collection.

Nothing.


// Rotates each graph item in the current document 90 degrees.
// Verify a document with a graph item is open
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); //rotate clockwise 90 degrees
}
redraw();
}
}