Subversion Repositories Integrator Subversion

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1 espaco 1
var ChartsFlowchart = function() {
2
 
3
    var handleDemo1 = function() {
4
 
5
        var flow = '';
6
 
7
        flow += 'st=>start: Start:>http://keenthemes.com[blank]' + "\n";
8
                flow += 'e=>end:>http://keenthemes.com' + "\n";
9
                flow += 'op1=>operation: My Operation' + "\n";
10
                flow += 'sub1=>subroutine: My Subroutine' + "\n";;
11
                flow += 'cond=>condition: Yes' + "\n";
12
                flow += 'or No?:>http://keenthemes.com' + "\n";
13
                flow += 'io=>inputoutput: catch something...' + "\n";
14
                flow += 'st->op1->cond' + "\n";
15
                flow += 'cond(yes)->io->e' + "\n";
16
                flow += 'cond(no)->sub1(right)->op1';
17
 
18
        var diagram = flowchart.parse(flow);
19
 
20
        diagram.drawSVG('diagram_1', {
21
            'x': 0,
22
            'y': 0,
23
            'line-width': 3,
24
            'line-length': 50,
25
            'text-margin': 10,
26
            'font-size': 14,
27
            'font-color': 'black',
28
            'line-color': 'black',
29
            'element-color': 'black',
30
            'fill': 'white',
31
            'yes-text': 'yes',
32
            'no-text': 'no',
33
            'arrow-end': 'block',
34
            'scale': 1,
35
            // style symbol types
36
            'symbols': {
37
                'start': {
38
                    'font-color': 'red',
39
                    'element-color': 'green',
40
                    'fill': 'yellow'
41
                },
42
                'end': {
43
                    'class': 'end-element'
44
                }
45
            },
46
            // even flowstate support ;-)
47
            'flowstate': {
48
                'past': {
49
                    'fill': '#CCCCCC',
50
                    'font-size': 12
51
                },
52
                'current': {
53
                    'fill': 'yellow',
54
                    'font-color': 'red',
55
                    'font-weight': 'bold'
56
                },
57
                'future': {
58
                    'fill': '#FFFF99'
59
                },
60
                'request': {
61
                    'fill': 'blue'
62
                },
63
                'invalid': {
64
                    'fill': '#444444'
65
                },
66
                'approved': {
67
                    'fill': '#58C4A3',
68
                    'font-size': 12,
69
                    'yes-text': 'APPROVED',
70
                    'no-text': 'n/a'
71
                },
72
                'rejected': {
73
                    'fill': '#C45879',
74
                    'font-size': 12,
75
                    'yes-text': 'n/a',
76
                    'no-text': 'REJECTED'
77
                }
78
            }
79
        });
80
    }
81
 
82
    var handleDemo2 = function() {
83
 
84
        var flow = '';
85
 
86
        flow += 'st=>start: Start:>http://keenthemes.com[blank]' + "\n";
87
                flow += 'st=>start: Start|past:>http://keenthemes.com[blank]' + "\n";
88
                flow += 'e=>end: End|future:>http://keenthemes.com' + "\n";
89
                flow += 'op1=>operation: My Operation|past' + "\n";
90
                flow += 'op2=>operation: Stuff|current' + "\n";
91
                flow += 'sub1=>subroutine: My Subroutine|invalid' + "\n";
92
                flow += 'cond=>condition: Yes' + "\n";
93
                flow += 'or No?|approved:>http://keenthemes.com' + "\n";
94
                flow += 'c2=>condition: Good idea|rejected' + "\n";
95
                flow += 'io=>inputoutput: catch something...|future' + "\n";
96
                flow += 'st->op1(right)->cond' + "\n";
97
                flow += 'cond(yes, right)->c2' + "\n";
98
                flow += 'cond(no)->sub1(left)->op1' + "\n";
99
                flow += 'c2(yes)->io->e' + "\n";
100
                flow += 'c2(no)->op2->e' + "\n";
101
 
102
        var diagram = flowchart.parse(flow);
103
 
104
        diagram.drawSVG('diagram_2', {
105
            'x': 0,
106
            'y': 0,
107
            'line-width': 3,
108
            'line-length': 50,
109
            'text-margin': 10,
110
            'font-size': 14,
111
            'font-color': 'black',
112
            'line-color': 'black',
113
            'element-color': 'black',
114
            'fill': 'white',
115
            'yes-text': 'yes',
116
            'no-text': 'no',
117
            'arrow-end': 'block',
118
            'scale': 1,
119
            // style symbol types
120
            'symbols': {
121
                'start': {
122
                    'font-color': 'red',
123
                    'element-color': 'green',
124
                    'fill': 'yellow'
125
                },
126
                'end': {
127
                    'class': 'end-element'
128
                }
129
            },
130
            // even flowstate support ;-)
131
            'flowstate': {
132
                'past': {
133
                    'fill': '#CCCCCC',
134
                    'font-size': 12
135
                },
136
                'current': {
137
                    'fill': 'yellow',
138
                    'font-color': 'red',
139
                    'font-weight': 'bold'
140
                },
141
                'future': {
142
                    'fill': '#FFFF99'
143
                },
144
                'request': {
145
                    'fill': 'blue'
146
                },
147
                'invalid': {
148
                    'fill': '#444444'
149
                },
150
                'approved': {
151
                    'fill': '#58C4A3',
152
                    'font-size': 12,
153
                    'yes-text': 'APPROVED',
154
                    'no-text': 'n/a'
155
                },
156
                'rejected': {
157
                    'fill': '#C45879',
158
                    'font-size': 12,
159
                    'yes-text': 'n/a',
160
                    'no-text': 'REJECTED'
161
                }
162
            }
163
        });
164
    }
165
 
166
    return {
167
 
168
        init: function() {
169
            handleDemo1();
170
            handleDemo2();
171
        }
172
 
173
    };
174
 
175
}();
176
 
177
jQuery(document).ready(function() {
178
    ChartsFlowchart.init();
179
});