Re: Illustrator 10 Graph automation
Re: Illustrator 10 Graph automation
- Subject: Re: Illustrator 10 Graph automation
- From: Shane Stanley <email@hidden>
- Date: Tue, 11 Jun 2002 08:16:56 +1000
On 11/6/02 2:44 AM +1000, john mead, email@hidden, wrote:
>
Can someone please point me at an example applescript
>
that creates a graph in Illustrator 10? Any style of
>
graph with whatever data would be fine. I'm just
>
looking for a starting point.
The built-in graphing facility is not scriptable, although you can script
AI's variables and modify a template that way. Or you can just draw graphs
natively:
on drawGraph(theWidth, theHeight, tickGap, theNumbers)
set fullPath to {}
set pointCount to count of items of theNumbers
repeat with i from 1 to pointCount
set end of fullPath to {(i - 1), (item i of theNumbers) as real}
end repeat
tell application "Adobe Illustrator 10"
activate
make new document at beginning with properties {color space:CMYK}
tell document 1
make new path item at beginning with properties {filled:false,
stroked:true, stroke color:{cyan:0, magenta:100, yellow:100, black:15},
entire path:fullPath}
set thePlot to result
scale thePlot horizontal scale theWidth / i * 100 vertical scale
theHeight / (height of thePlot) * 80 about document origin
make new path item at beginning with properties {filled:false,
stroked:true, stroke color:{gray value:100}, entire path:{{0, 0}, {0,
theHeight}}}
make new path item at beginning with properties {filled:false,
stroked:true, stroke color:{gray value:100}, entire path:{{0, 0}, {theWidth,
0}}}
repeat with i from 1 to pointCount div tickGap
make new path item at beginning with properties {filled:false,
stroked:true, stroke color:{gray value:100}, entire path:{{((i * tickGap) -
1) * theWidth / pointCount, 0}, {((i * tickGap) - 1) * theWidth /
pointCount, -theHeight / 20}}}
end repeat
end tell
end tell
end drawGraph
drawGraph(200, 120, 5, {3, 5, 4, 6, 8, 2, 3, 6, 2, 6, 4, 3, 2, 3, 4, 8, 5,
4, 7, 20, 21})
--
Shane Stanley, email@hidden
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.