pie chart
[1/9] 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
[2/9] from: carl::cybercraft::co::nz at: 4-Jun-2006 18:10
On Sunday, 4-June-2006 at 15:28:46 Rosemary de Dear wrote,
>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
It looks like the flood command was removed from the recent version...
New docs: http://www.rebol.com/docs/draw-ref.html
Old docs: http://www.rebol.com/docs/draw.html
and I can't see any likely-looking replacement. :-(
A possible solution - make your circle from a lot of filled, thin triangles? (That said,
given the extra power of AGG, 'triangles' with one curverd side are probably possible.)
-- Carl.
[3/9] from: gabriele:colellachiara at: 4-Jun-2006 11:36
Hi Carl,
On Sunday, June 4, 2006, 8:10:52 AM, you wrote:
CR> A possible solution - make your circle from a lot of
CR> filled, thin triangles? (That said, given the extra power of
CR> AGG, 'triangles' with one curverd side are probably possible.)
Open the Viewtop, click on REBOL.com/Tests then on Arc angle.
Regards,
Gabriele.
--
Gabriele Santilli <gabriele-rebol.com> --- http://www.rebol.com/
Colella Chiara software division --- http://www.colellachiara.com/
[4/9] from: carl::cybercraft::co::nz at: 4-Jun-2006 21:59
On Sunday, 4-June-2006 at 11:36:45 Gabriele Santilli wrote,
>Hi Carl,
>
>On Sunday, June 4, 2006, 8:10:52 AM, you wrote:
>
>CR> A possible solution - make your circle from a lot of
>CR> filled, thin triangles? (That said, given the extra power of
>CR> AGG, 'triangles' with one curverd side are probably possible.)
>
>Open the Viewtop, click on REBOL.com/Tests then on Arc angle.
Yo, PacMan!
There you go, Rosemary.
-- Carl.
[5/9] from: rcm:formix:au at: 5-Jun-2006 16:20
Thanks Carl and Gabriele,
The "Arc Angel" is a honey.
Regards, Rosemary
--
Formix Australia - www.formix.com.au
613 9354 9585
PO Box 261 Nth Carlton Vic 3054
[6/9] from: chalz::earthlink::net at: 5-Jun-2006 3:30
When I click on the icon for "Arc Angle", I keep getting a pop-up that
says "Missing file: http://www.rebol.net/tests/arc-angle.r [OK]" Several
others give me a similar error, but not all.
On Sun, 04 Jun 2006 05:36:45 -0400, Gabriele Santilli
<gabriele-colellachiara.com> wrote:
[7/9] from: gabriele::colellachiara::com at: 5-Jun-2006 13:20
Hi Charles,
On Monday, June 5, 2006, 9:30:51 AM, you wrote:
C> When I click on the icon for "Arc Angle", I keep getting a pop-up that
C> says "Missing file: http://www.rebol.net/tests/arc-angle.r [OK]" Several
C> others give me a similar error, but not all.
Make sure the Viewtop is connected (lower left corner). If you
haven't selected "Auto connect on startup" in the prefs, you need
to manually make it "connect" to the reb.
Regards,
Gabriele.
--
Gabriele Santilli <gabriele-rebol.com> --- http://www.rebol.com/
Colella Chiara software division --- http://www.colellachiara.com/
[8/9] from: rcm:formix:au at: 6-Jun-2006 16:11
A new pie chart.
rebol [title: "Pie Chart"]
data: [18 red 22 blue 15 green 20 yellow 10 purple]
sum: 0
foreach [val color] data [sum: sum + val]
plot: copy [circle 100x100 90]
total: 0
foreach [val color] data [
angle: 360 * val / sum
append plot reduce [
'fill-pen color
'arc 100x100 90x90 total angle 'closed
total: total + angle]
]
view layout [
box 200x200 white effect reduce ['draw plot]
]
--
Formix Australia - www.formix.com.au
613 9354 9585
PO Box 261 Nth Carlton Vic 3054
[9/9] from: chalz::earthlink::net at: 6-Jun-2006 5:20
Hm. It was connected. I just tried again now, though, and it works
fine. Incidentally, a very neat demo.