@@ -33,13 +33,13 @@ <h1>flowchart.js</h1>
33
33
34
34
< div id ="main ">
35
35
36
- < section id ="demo ">
36
+ < section id ="demo1 ">
37
37
< table align ="center " class ="inner ">
38
38
< tr >
39
39
< td >
40
- < h3 > Demo. Try editing me below</ h3 >
40
+ < h3 > Demo 1 . Try editing me below</ h3 >
41
41
< div class ="editor-wrapper ">
42
- < div class ="editor "> st=> start: Start:> http://www.google.com[blank]
42
+ < div class ="editor editor1 "> st=> start: Start:> http://www.google.com[blank]
43
43
e=> end:> http://www.google.com
44
44
op1=> operation: My Operation
45
45
sub1=> subroutine: My Subroutine
@@ -50,14 +50,14 @@ <h3>Demo. Try editing me below</h3>
50
50
st-> op1-> cond
51
51
cond(yes)-> io-> e
52
52
cond(no)-> sub1(right)-> op1</ div >
53
- <!-- < /div>
54
- Theme:
53
+ </ div >
54
+ <!-- Theme:
55
55
<select class="theme">
56
56
<option value="simple">Simple</option>
57
57
<option value="hand" selected>Hand drawn</option>
58
58
</select> -->
59
59
</ td >
60
- < td class ="diagram "> This should be a diagram! If you don't see it you need Javascript enabled</ td >
60
+ < td class ="diagram diagram1 "> This should be a diagram! If you don't see it you need Javascript enabled</ td >
61
61
</ tr >
62
62
</ table >
63
63
@@ -68,7 +68,7 @@ <h3>Demo. Try editing me below</h3>
68
68
< div class ="inner ">
69
69
< section id ="usage ">
70
70
< h3 > Usage</ h3 >
71
- < p > flowchart.js depends on < a href ="http://raphaeljs.com/ "> Raphaël</ a > </ br > To use include the following:
71
+ flowchart.js depends on < a href ="http://raphaeljs.com/ "> Raphaël</ a > < br / > To use include the following:
72
72
< pre > <script src="< a href ="http://github.com/DmitryBaranovskiy/raphael/raw/master/raphael-min.js "> raphael-min.js</ a > "><
73
73
<script src="< a href ="flowchart-latest.js "> flowchart-latest.js</ a > "></script>
74
74
</ pre >
@@ -82,6 +82,8 @@ <h3>Usage</h3>
82
82
// you can also try to pass options:
83
83
84
84
diagram.drawSVG('diagram', {
85
+ 'x': 0,
86
+ 'y': 0,
85
87
'line-width': 3,
86
88
'line-length': 50,
87
89
'text-margin': 10,
@@ -92,14 +94,65 @@ <h3>Usage</h3>
92
94
'fill': 'white',
93
95
'yes-text': 'yes',
94
96
'no-text': 'no',
95
- 'arrow-end': 'block'
97
+ 'arrow-end': 'block',
98
+ // style symbol types
99
+ 'symbols': {
100
+ 'start': {
101
+ 'font-color': 'red',
102
+ 'element-color': 'green',
103
+ 'fill': 'yellow'
104
+ },
105
+ 'end':{
106
+ 'class': 'end-element'
107
+ }
108
+ },
109
+ // even flowstate support ;-)
110
+ 'flowstate' : {
111
+ 'past' : { 'fill' : '#CCCCCC', 'font-size' : 12},
112
+ 'current' : {'fill' : 'yellow', 'font-color' : 'red', 'font-weight' : 'bold'},
113
+ 'future' : { 'fill' : '#FFFF99'},
114
+ 'request' : { 'fill' : 'blue'},
115
+ 'invalid': {'fill' : '#444444'},
116
+ 'approved' : { 'fill' : '#58C4A3', 'font-size' : 12, 'yes-text' : 'APPROVED', 'no-text' : 'n/a' },
117
+ 'rejected' : { 'fill' : '#C45879', 'font-size' : 12, 'yes-text' : 'n/a', 'no-text' : 'REJECTED' }
118
+ }
96
119
});
97
120
</script>
98
121
</ pre >
99
122
100
- </ p >
123
+ < section id ="demo2 ">
124
+ < table align ="center " class ="inner ">
125
+ < tr >
126
+ < td >
127
+ < h3 > Demo 2 with color coding (flowstate). Try editing me below</ h3 >
128
+ < div class ="editor-wrapper ">
129
+ < div class ="editor editor2 "> st=> start: Start|past:> http://www.google.com[blank]
130
+ e=> end: Ende|future:> http://www.google.com
131
+ op1=> operation: My Operation|past
132
+ op2=> operation: Stuff|current
133
+ sub1=> subroutine: My Subroutine|invalid
134
+ cond=> condition: Yes
135
+ or No?|approved:> http://www.google.com
136
+ c2=> condition: Good idea|rejected
137
+ io=> inputoutput: catch something...|future
138
+
139
+ st-> op1(right)-> cond
140
+ cond(yes, right)-> c2
141
+ cond(no)-> sub1(left)-> op1
142
+ c2(yes)-> io-> e
143
+ c2(no)-> op2-> e</ div >
144
+ </ div >
145
+ <!-- Theme:
146
+ <select class="theme">
147
+ <option value="simple">Simple</option>
148
+ <option value="hand" selected>Hand drawn</option>
149
+ </select> -->
150
+ </ td >
151
+ < td class ="diagram diagram2 "> This should be a diagram! If you don't see it you need Javascript enabled</ td >
152
+ </ tr >
153
+ </ table >
154
+
101
155
</ section >
102
- </ div >
103
156
104
157
< footer >
105
158
< hr />
@@ -121,11 +174,11 @@ <h3>Usage</h3>
121
174
122
175
< script type ="text/javascript ">
123
176
124
- function setup_editor ( div ) {
177
+ function setup_editor ( div , nr ) {
125
178
126
- var editor_div = div . find ( ".editor" ) ;
127
- var diagram_div = div . find ( ".diagram" ) ;
128
- var theme_div = div . find ( ".theme" ) ;
179
+ var editor_div = div . find ( ".editor" + nr ) ;
180
+ var diagram_div = div . find ( ".diagram" + nr ) ;
181
+ var theme_div = div . find ( ".theme" + nr ) ;
129
182
130
183
// Setup the editor diagram
131
184
var editor = ace . edit ( editor_div . get ( 0 ) ) ;
@@ -146,7 +199,20 @@ <h3>Usage</h3>
146
199
diagram_div . html ( '' ) ;
147
200
148
201
// Draw
149
- diagram . drawSVG ( diagram_div . get ( 0 ) ) ;
202
+ if ( nr === 1 ) {
203
+ diagram . drawSVG ( diagram_div . get ( 0 ) ) ;
204
+ } else if ( nr === 2 ) {
205
+ diagram . drawSVG ( diagram_div . get ( 0 ) , {
206
+ 'flowstate' : {
207
+ 'past' : { 'fill' : '#CCCCCC' , 'font-size' : 12 } ,
208
+ 'current' : { 'fill' : 'yellow' , 'font-color' : 'red' , 'font-weight' : 'bold' } ,
209
+ 'future' : { 'fill' : '#FFFF99' } ,
210
+ 'invalid' : { 'fill' : '#444444' } ,
211
+ 'approved' : { 'fill' : '#58C4A3' , 'font-size' : 12 , 'yes-text' : 'APPROVED' , 'no-text' : 'n/a' } ,
212
+ 'rejected' : { 'fill' : '#C45879' , 'font-size' : 12 , 'yes-text' : 'n/a' , 'no-text' : 'REJECTED' }
213
+ }
214
+ } ) ;
215
+ }
150
216
151
217
} catch ( err ) {
152
218
var annotation = {
@@ -167,10 +233,11 @@ <h3>Usage</h3>
167
233
168
234
$ ( document ) . ready ( function ( ) {
169
235
// Example diagrams
170
- //$('.diagram').sequenceDiagram();
171
-
236
+
172
237
// Setup all the editors
173
- setup_editor ( $ ( '#demo' ) ) ;
238
+ setup_editor ( $ ( '#demo1' ) , 1 ) ;
239
+
240
+ setup_editor ( $ ( '#demo2' ) , 2 ) ;
174
241
} ) ;
175
242
</ script >
176
243
0 commit comments