Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] pie chart

From: rcm::formix::com::au at: 4-Jun-2006 15:28

Hello, I've been trying to colour the sections in the pie-chart example (in rebol.com/docs/draw.html ... code is below) but I only get white sections. Can someone tell me how to do this? Regards, Rosemary rebol [] data: [ 18 red 22 blue 15 green 20 yellow 10 purple ] sum: 0 foreach [val color] data [sum: sum + val] plot: copy [ pen black circle 100x100 90 line 100x100 100x10 ] total: 0 foreach [val color] data [ angle: 360 * val / sum total: total + angle xy: 100x100 + as-pair 90 * sine total -90 * cosine total repend plot ['line 100x100 xy] append plot reduce [ 'fill-pen color 'flood 100x100 + 100x100 + (as-pair 90 * sine total - (angle / 2) -90 * cosine total - (angle / 2) ) / 2 ] ] view layout [ box snow 200x200 effect reduce ['draw plot] ] -- Formix Australia - www.formix.com.au 613 9354 9585 PO Box 261 Nth Carlton Vic 3054