Skip to content

Commit 75a2d65

Browse files
committed
merge
2 parents db78efc + 0aed541 commit 75a2d65

File tree

2 files changed

+88
-21
lines changed

2 files changed

+88
-21
lines changed

css/style.css

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,8 @@ header h2 {
104104
}
105105

106106
.editor {
107-
width: 380px;
108-
height: 210px;
107+
width: 400px;
108+
height: 280px;
109109
font-size: 14px;
110110
}
111111

@@ -120,7 +120,7 @@ header h2 {
120120

121121
.inner {
122122
position: relative;
123-
width: 940px;
123+
width: 1040px;
124124
margin: 0 auto;
125125
}
126126

index.html

Lines changed: 85 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,13 @@ <h1>flowchart.js</h1>
3333

3434
<div id="main">
3535

36-
<section id="demo">
36+
<section id="demo1">
3737
<table align="center" class="inner">
3838
<tr>
3939
<td>
40-
<h3>Demo. Try editing me below</h3>
40+
<h3>Demo 1. Try editing me below</h3>
4141
<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]
4343
e=>end:>http://www.google.com
4444
op1=>operation: My Operation
4545
sub1=>subroutine: My Subroutine
@@ -50,14 +50,14 @@ <h3>Demo. Try editing me below</h3>
5050
st->op1->cond
5151
cond(yes)->io->e
5252
cond(no)->sub1(right)->op1</div>
53-
<!-- </div>
54-
Theme:
53+
</div>
54+
<!-- Theme:
5555
<select class="theme">
5656
<option value="simple">Simple</option>
5757
<option value="hand" selected>Hand drawn</option>
5858
</select> -->
5959
</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>
6161
</tr>
6262
</table>
6363

@@ -68,7 +68,7 @@ <h3>Demo. Try editing me below</h3>
6868
<div class="inner">
6969
<section id="usage">
7070
<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:
7272
<pre>&lt;script src=&quot;<a href="http://github.com/DmitryBaranovskiy/raphael/raw/master/raphael-min.js">raphael-min.js</a>&quot;&gt;&lt;
7373
&lt;script src=&quot;<a href="flowchart-latest.js">flowchart-latest.js</a>&quot;&gt;&lt;/script&gt;
7474
</pre>
@@ -82,6 +82,8 @@ <h3>Usage</h3>
8282
// you can also try to pass options:
8383

8484
diagram.drawSVG('diagram', {
85+
'x': 0,
86+
'y': 0,
8587
'line-width': 3,
8688
'line-length': 50,
8789
'text-margin': 10,
@@ -92,14 +94,65 @@ <h3>Usage</h3>
9294
'fill': 'white',
9395
'yes-text': 'yes',
9496
'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+
}
96119
});
97120
&lt;/script&gt;
98121
</pre>
99122

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+
101155
</section>
102-
</div>
103156

104157
<footer>
105158
<hr />
@@ -121,11 +174,11 @@ <h3>Usage</h3>
121174

122175
<script type="text/javascript">
123176

124-
function setup_editor(div) {
177+
function setup_editor(div, nr) {
125178

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);
129182

130183
// Setup the editor diagram
131184
var editor = ace.edit(editor_div.get(0));
@@ -146,7 +199,20 @@ <h3>Usage</h3>
146199
diagram_div.html('');
147200

148201
// 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+
}
150216

151217
} catch(err) {
152218
var annotation = {
@@ -167,10 +233,11 @@ <h3>Usage</h3>
167233

168234
$(document).ready(function() {
169235
// Example diagrams
170-
//$('.diagram').sequenceDiagram();
171-
236+
172237
// Setup all the editors
173-
setup_editor($('#demo'));
238+
setup_editor($('#demo1'), 1);
239+
240+
setup_editor($('#demo2'), 2);
174241
});
175242
</script>
176243

0 commit comments

Comments
 (0)