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

World: r3wp

[!CureCode] web-based bugtracking tool

Steeve
22-Sep-2009
[746x3]
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)
Dockimbel
28-Oct-2009
[782]
I'm wondering why this garbage is showing up now instead of a few 
weeks ago when I've upgraded the server.
Graham
28-Oct-2009
[783x4]
Henrik ... no idea when you've seen this issue?
It only occurs to me after I've been making changes ... not in the 
normal course of events.
hasn't happened since I reported it in March when I was setting the 
response buffer.
Until the other day.
Dockimbel
28-Oct-2009
[787]
After a quick code and trace.log files inspection : there's no missing 
COPY, it seems related to a complex chain of events preventing the 
RSP output buffer to be CLEARed before re-use. I found a potential 
flaw in response/include, if the included script raises an error 
in a way that's not  catchable by the RSP execution system, it can 
prevent the output buffer from being reset. In trace.log file, I've 
found an error at 00:53 AM from a rejected SMTP connection using 
SEND function (not the new builtin MTA) that could be the trigger 
for this issue.
Graham
28-Oct-2009
[788]
Probably why I only see when debugging faulty rsp code.
Henrik
28-Oct-2009
[789]
Graham, only during development. Cure was a restart of the server. 
From Doc's post, it seems he knows what to do about it.
Dockimbel
29-Oct-2009
[790x6]
CureCode service will be interrupted during a few seconds now in 
order to upgrade the server.
Upgrading also PHP to v5.2.11 on the same server...takes a bit more 
time.
It's amazing how much time it takes to compile PHP...
The number of modules included on the default config is insane.
Stopping Cheyenne...
Restarted. Everything seems ok.