Change graph data and objects through script
Copy link to clipboard
Copied
Hi. I'm working on a document where I had to create several pie charts on Illustrator. I then colored each pie's slices with swatches from a custom swatch group. Now I need to change the order of the slices, which would mean manually changing the values that generate the pies and then recoor each slice again.
I've been looking through the Illustrator CC Scripting Reference: Javascript but I haven't found any way to manipulate a GraphItem's objects or the data that generates them.
Is there any way to script any of these two tasks:
1. Sort the data on a graph.
2. Select the individual contents on a graph and alter their properties.
Thank you.
Explore related tutorials & articles
Copy link to clipboard
Copied
you're out of luck, there's no access to the graph data through scripting
Copy link to clipboard
Copied
Bummer. But thank you.
The solution I came up with to at least get some of the work done through a script was to:
- change the graph data manually (I can sort it in Excel or similar) and create a new graph;
- apply a script to get the colors from the original graph into a new swatch group;
- name the colors with the calculated area value of their corresponding slice;
- get a list of these colors, then sort it, which gets them on the same order as the new pir chart slices;
- ungroup the new graph (it stops being a graph, but what the heck) and apply the sorted colors to the slices.
Hope this might be of use to someone.

