r3wp [groups: 83 posts: 189283]
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

World: r3wp

[!CureCode] web-based bugtracking tool

Henrik
5-Sep-2009
[732]
It would be really lovely to have change log information provided 
via API or plain text, so it can be integrated into a website.
Dockimbel
5-Sep-2009
[733]
Added in todo list. Should be easy to implement.
BrianH
8-Sep-2009
[734]
I had a lot of trouble with comments in CureCode today being hex-decoded, 
when I was just trying to refer to a filename %bar.r. I had to write 
it as %25bar.r, every time, even during revisions. Comments shouldn't 
be hex-decoded.
Dockimbel
8-Sep-2009
[735]
Dehex removed (don't know why it was there).

Tested on ticket #1 (in case you wonder why it popped up in recently 
changed tickets).
BrianH
8-Sep-2009
[736]
That was the reason for all of the revisions to the comment of #1228 
:(
Steeve
22-Sep-2009
[737x3]
I'm First
Nice !!!
Doc, did you draw your "camembers" with rebol ?
i think so ;-)
Dockimbel
22-Sep-2009
[740x2]
Nope, it's Google's Chart API work :-)
http://code.google.com/intl/fr-FR/apis/chart/
Steeve
22-Sep-2009
[742]
Ooooh, what a shame ;-)
Dockimbel
22-Sep-2009
[743]
If there's was a nice lib in Rebol with a cool dialect to do the 
same job as google's charts...
Pekr
22-Sep-2009
[744]
there was only some work done by Ladislav IIRC, but it was for old 
draw IIRC ...
Steeve
22-Sep-2009
[745x4]
pie-chart: func [
    con [block!] ;-- block of overriden constants
    cmd [block!] ;-- commands to draw the pie-chart 
    /local push angle middle bottom pane bout sens
    size back-color start line text
][

    ;-- default constants (overridable by con block)
    size: 300x200       ;--size of the box
    back-color: white   ;-- back color of the drawing

    start: -90          ;-- starting angle of the pie chart (in degrees)
    line: [pen gray line]   ;-- draw block used for lines

    text: [pen none fill-pen gray text vectorial]   ;-- draw block used 
    for texts
    ;--
    do bind con 'size
    pane: make block! 30
    push: func [data][append pane compose data]
    center: size / 2    ; -- center of the pie chart
    radius: to-pair divide min size/x size/y 2.5
    sens: true
    bottom: 0 
   
    foreach [title color percent] cmd [
        if issue? color [color: to-tuple debase/base color 16]

        push [pen back-color fill-pen (color) arc center radius (start) (angle: 
        round/ceiling percent * 360) closed]
        middle: angle / 2 + start
        push line 
        push [

            (center + as-pair radius/x * cosine middle radius/x * sine middle)

            (bout: center + as-pair radius/x + 3 * cosine middle radius/x + 3 
            * sine middle)
        ]
        either 0 <= cosine middle [
            unless sens [bottom: 0 send: true]
            push reduce [
                bout: as-pair center/x + radius/x bout/y
                bout: as-pair bout/x + 8 max bout/y bottom
                bout: as-pair bout/x + 3 bout/y
            ]
            bottom: bout/y + 12
        ][
            if sens [bottom: size/y sens: false]
            push reduce [
                bout: as-pair center/x - radius/x bout/y
                bout: as-pair bout/x - 8 min bout/y bottom
                bout: as-pair bout/x - 3 bout/y
            ]
            bottom: bout/y - 12
            bout: as-pair bout/x - first size-text make face [
                size: 5000x5000
                text: title
            ] bout/y 
        ]
        push text 
        push [(bout + 1x-8 ) (title)]
        start: start + angle
    ] 
    pane
]
Not perfect but it give results.

pie: pie-chart [
    size: 300x200
    start: -80
][
    "block" none 0
    "crash" #ff3030 .04
    "major" #ff6060 .09
    "minor" #ffb850 .44
    "tweak" #ffd850 .03
    "text" #ffd850 .02
    "trivial" #ffd8a0 .31
    "not a bug" pewter .06
]

view layout [
    box 300x200 white effect [draw pie]
]
because of the vectorial text i use, it's not usable everywhere...
it can be replaced by non vectorial text but in that case, the drawing 
can't be translated or scaled
Dockimbel
22-Sep-2009
[749x2]
Nice result, you should publish it on rebol.org.
CureCode/R3 is on a linux server. I guess there are font issues?
Steeve
22-Sep-2009
[751]
it could be bypassed...
Dockimbel
22-Sep-2009
[752]
unless sens [bottom: 0 send: true] <= typo in "send:"?
Steeve
22-Sep-2009
[753x2]
try this on linux...

pie: pie-chart [
    size: 300x200
    start: -80
    text: [pen gray text ]
][
    "block" none 0
    "crash" #ff3030 .04
    "major" #ff6060 .09
    "minor" #ffb850 .44
    "tweak" #ffd850 .03
    "text" #ffd850 .02
    "trivial" #ffd8a0 .31
    "not a bug" pewter .06
]

view layout [
    box 300x200 white effect [draw pie]
]
yes typo
Dockimbel
22-Sep-2009
[755x4]
If you can add barcharts too, that would be nice.
I think that Carl would be interested in such a library.
He asked me once for one that can draw pie and bar charts such as 
those from google.
I think that he would be seduced by the small size and elegancy of 
your code.
Steeve
22-Sep-2009
[759]
it's a first thought, could be optimized i guess...
Dockimbel
22-Sep-2009
[760]
Linux (Ubuntu 8.04 under Vmware) : 
- 1st version: drawing ok, but no text

- 2nd version: no pie chart, no text, only 1 line (first one in list 
maybe)
Steeve
22-Sep-2009
[761x3]
hum...
you tested with R2 ?
would you an R3 version better ?
Dockimbel
22-Sep-2009
[764]
R2 only. I can't use R3 for my projects.
Steeve
22-Sep-2009
[765x3]
New version, i build images from texts, it should work on linux as 
well.
And you can change the font used as well.
pie-chart: func [
    con [block!] ;-- block of overriden constants
    cmd [block!] ;-- commands to draw the pie-chart 
    /local push angle middle bottom pane bout sens
    size back-color start line text font* font
][

    ;-- default constants (overridable by con block)
    size: 300x200       ;--size of the box
    back-color: white   ;-- back color of the pie
	font: make face/font [color: gray size: 12]

    start: -90          	;-- starting angle of the pie chart (in degrees)
    line: [pen gray line]   ;-- draw block used for lines
    ;--
    do bind con 'size
    font/offset: 0x0
    pane: make block! 30
    push: func [data][append pane compose data]
    center: size / 2    ; -- center of the pie chart
    radius: to-pair divide min size/x size/y 2.5
    sens: true
    bottom: 0 
   	font*: font
    foreach [title color percent] cmd [
        if issue? color [color: to-tuple debase/base color 16]

        push [pen back-color fill-pen (color) arc center radius (start) (angle: 
        round/ceiling percent * 360) closed]
        middle: angle / 2 + start
        push line
        push [

            (center + as-pair radius/x * cosine middle radius/x * sine middle)

            (bout: center + as-pair radius/x + 3 * cosine middle radius/x + 3 
            * sine middle)
        ]
        text: to-image make blank-face [

         size: size-text make face [size: 5000x5000 text: title font: font*]
        	text: title
        	font: font*
        	color: none
        ]
        either 0 <= cosine middle [
            unless sens [bottom: 0 sens: true]
            push reduce [
                bout: as-pair center/x + radius/x bout/y
                bout: as-pair bout/x + 8 max bout/y bottom
                bout: as-pair bout/x + 3 bout/y
            ]
            bottom: bout/y + text/size/y
        ][
            if sens [bottom: size/y sens: false]
            push reduce [
                bout: as-pair center/x - radius/x bout/y
                bout: as-pair bout/x - 8 min bout/y bottom
                bout: as-pair bout/x - 3 bout/y
            ]
            bottom: bout/y - text/size/y
            bout: as-pair bout/x - text/size/x bout/y 
        ]

        push [image (text) (bout + as-pair 1 text/size/y / -2 - 0.5 ) black 
        ]
        start: start + angle
    ] 
    pane
]
pie: pie-chart [
    size: 300x200
    start: -80
    font: make font [size: 10]
][
    "block" none 0
    "crash" #ff3030 .04
    "major" #ff6060 .09
    "minor" #ffb850 .44
    "tweak" #ffd850 .03
    "text" #ffd850 .02
    "trivial" #ffd8a0 .31
    "not a bug" pewter .06
]

view layout [
    box 300x200 white effect [draw pie]
]
Dockimbel
22-Sep-2009
[768x2]
It works on Linux. Pie, texts, lines, everything is there.
You should make a library with that code and post it online somewhere 
with short doc/examples (could be rebol.org e.g.).
BrianH
27-Oct-2009
[770x2]
Getting garbage at the top of the page on every page of CureCode 
- more with each view.
This is on http://curecode.org/rebol3/
Graham
27-Oct-2009
[772x4]
It's caused by a missing copy ....
Have to reset Cheyenne ...
The garbage is gzipped data ....
I saw this on my own server a few days ago ...
Maxim
28-Oct-2009
[776]
wow, its getting pretty insane!
Henrik
28-Oct-2009
[777]
I've seen this a lot outside of Curecode. Never figured out what 
it is.
Dockimbel
28-Oct-2009
[778x2]
Looks like Cheyenne is trying to create a new form of ASCII art :-). 
First time I see that on Cheyenne. Will reset the server at once.
Worker processes reset, seems back to normal now.
Maxim
28-Oct-2009
[780x2]
seems there is a copy "" missing somewhere... I could see the last 
page viewed on cheyenne.org just above the curecode page last time 
I visited it.
(or a clear missing)