These forums are now read-only. Please visit our new forums to participate in discussion. A new account will be required to post in the new forums. For more info on the switch, see this post. Thank you!

 User Name Remember Me? Password
 FAQ Members List Calendar Search Today's Posts Mark Forums Read

 Using Adjustable Wedge to create a pie chart in AppleScript Thread Tools Search this Thread Display Modes
 realbrick Member 2013-05-23, 09:58 AM I've seen other AppleScript for creating pie charts in OmniGraffle that involved using trigonometry. The Adjustable Wedge object (in the Common stencil under shapes) lets you do it much more simply. The code is below. I put a post describing it here: http://omnigraffletips.blogspot.com/...plescript.html Cheers, - Joseph tell application "OmniGraffle Professional 5" set pieLoc to {50, 50} set pieDiameter to 400 set wedgeValues to {24, 55, 77, 130, 37} set wedgeColors to {{1, 0, 0}, {0, 1, 1}, {1, 0, 1}, {0, 0, 1}, {0, 1, 0}} set wedgeStartAngle to 0 set wedges to {} set sumOfWedgeValues to 0 repeat with wedgeValue in wedgeValues set sumOfWedgeValues to sumOfWedgeValues + wedgeValue end repeat repeat with i from 1 to count of wedgeValues set wedgeDegrees to ((item i of wedgeValues) / sumOfWedgeValues) * 360 set wedgeEndAngle to wedgeStartAngle + wedgeDegrees tell canvas of front window set wedge to make new shape at end of graphics with properties {name:"AdjustableWedge", size:{pieDiameter, pieDiameter}, origin:pieLoc, startAngle:wedgeStartAngle, endAngle:wedgeEndAngle, draws shadow:false, draws stroke:false, fill color:item i of wedgeColors} end tell set end of wedges to wedge set wedgeStartAngle to wedgeEndAngle end repeat assemble wedges end tell Post 1

 Thread Tools Search this Thread Search this Thread: Advanced Search Display Modes Linear Mode

All times are GMT -8. The time now is 10:47 AM.

 -- Omni Style -- Lithographica Contact Us - The Omni Group Forums - Archive - Privacy Statement - Top