/
index.html
322 lines (265 loc) · 14.6 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>SankeyMATIC (BETA): Build a diagram</title>
<link rel="stylesheet" href="build.css">
<link rel="stylesheet" href="../main.css">
</head>
<body>
<!-- script src="http://d3js.org/d3.v2.min.js?2.9.1"></script -->
<script src="d3.v2.js"></script>
<script src="sankey.js"></script>
<script src="canvg.js"></script>
<script src="rgbcolor.js"></script>
<script src="sankeymatic.js"></script>
<header>
<table id="nav">
<tr>
<td><strong><a title="SankeyMATIC home page" href="/">SankeyMATIC (BETA)</a></strong></td>
<td class="active_tab"><strong>Build a Sankey Diagram</strong></td>
<td><a class="button" title="How to use SankeyMATIC to the fullest" href="/manual/">Manual</a></td>
<td><a class="button" title="Gallery of Sankey Examples" href="/gallery/">Gallery</a></td>
<td><a class="button" title="Frequently Asked Questions" href="/faq/">FAQ</a></td>
</tr></table>
</header>
<div class="center_basic">
<table><tr><td>
<form onsubmit="process_sankey(); return false;">
<table class="center_basic">
<tr>
<td id="other_entry">
<h2 class="ui_head" onclick="toggle_panel('input_options');">
<span id="input_options_indicator" class="indicator">⇓</span>
Inputs<span id="input_options_hint">:</span></h2>
<div id="input_options">
<textarea id="flows_in" rows="22" cols="40" onchange="process_sankey();">' Type a list of Flows, like this:
' SOURCE [AMOUNT] TARGET
' Examples:
Wages [2000] Budget
Interest [25] Budget
Budget [500] Taxes
Budget [450] Housing
Budget [310] Food
Budget [205] Transportation
Budget [400] Health Care
Budget [160] Other Necessities
' After all your Flows are entered, use
' the controls below to customize the
' diagram's appearance.
' For even finer control over presentation,
' see the Manual (linked above).</textarea>
<p class="center_basic"><button id="preview_graph" type="submit">Preview</button></p>
</div>
<!-- SIZE & SPACING -->
<h2 class="ui_head" onclick="toggle_panel('diagram_options');">
<span id="diagram_options_indicator" class="indicator">⇑</span>
Size, Spacing & Shape<span id="diagram_options_hint">:</span></h2>
<div id="diagram_options" class="form_chunk">
<p class="form_elements1">
<label for="canvas_width"><strong>Diagram Width:</strong></label>
<span class="no_wrap"><input type="text" class="wholenumber" id="canvas_width" size="5" maxlength="6" value="600" onchange="process_sankey();"> px</span>
<label for="canvas_height" class="spaced_label"><strong>Height:</strong></label>
<span class="no_wrap"><input type="text" class="wholenumber" id="canvas_height" size="5" maxlength="6" value="600" onchange="process_sankey();"> px</span>
</p>
<p class="form_elements2">
<label for="node_padding"><strong>Space between Nodes:</strong></label>
<span class="no_wrap"><input type="text" class="wholenumber" id="node_padding" size="2" maxlength="4" value="15" onchange="process_sankey();"> px</span>
</p>
<p class="form_elements1">
<label for="node_width"><strong>Node Width:</strong></label>
<span class="no_wrap"><input type="text" class="wholenumber" id="node_width" size="2" maxlength="4" value="10" onchange="process_sankey();"> px</span>
<label for="curvature" class="spaced_label"><strong>Curviness:</strong></label>
<span class="no_wrap">|<input id="curvature" type="range" min="0.05" max="0.8" step="0.15" value="0.5" onchange="process_sankey();" class="narrowslider">(</span><br />
</p>
<p class="form_elements2">
<strong>Margins:</strong>
<span class="no_wrap"><label for="top_margin">Top</label>
<input type="text" class="wholenumber" id="top_margin" size="2" maxlength="4" value="12" onchange="process_sankey();"></span>
<span class="no_wrap"><label for="bottom_margin">Bot</label>
<input type="text" class="wholenumber" id="bottom_margin" size="2" maxlength="4" value="12" onchange="process_sankey();"></span>
<span class="no_wrap"><label for="left_margin">L</label>
<input type="text" class="wholenumber" id="left_margin" size="2" maxlength="4" value="12" onchange="process_sankey();"></span>
<span class="no_wrap"><label for="right_margin">R</label>
<input type="text" class="wholenumber" id="right_margin" size="2" maxlength="4" value="12" onchange="process_sankey();"></span>
</p>
</div>
<!-- COLORS -->
<h2 class="ui_head" onclick="toggle_panel('color_options');">
<span id="color_options_indicator" class="indicator">⇓</span>
Colors<span id="color_options_hint">...</span></h2>
<div id="color_options" class="form_chunk" style="display: none;">
<p class="form_elements2">
<label for="background_color"><strong>Background Color:</strong></label> <input type="color" id="background_color" size="7" maxlength="7" value="#FFFFFF" onchange="process_sankey();">
</p>
<p class="form_elements1">
<strong>Node Colors:</strong>
Use theme:
<input name="default_node_colorset" type="radio" id="node_use_set_a" value="A" onchange="process_sankey();" /><label for="node_use_set_a">A</label>
<input name="default_node_colorset" type="radio" id="node_use_set_b" value="B" onchange="process_sankey();" /><label for="node_use_set_b">B</label>
<input name="default_node_colorset" type="radio" id="node_use_set_c" value="C" onchange="process_sankey();" checked="checked" /><label for="node_use_set_c">C</label><br />
<input name="default_node_colorset" type="radio" id="node_use_color" value="none" onchange="process_sankey();" /><label for="node_use_color">Use a single color:</label>
<input type="color" id="default_node_color" size="7" maxlength="7" value="#004477" onchange="process_sankey();"><br />
</p>
<p class="form_elements2">
<strong>Flow Colors:</strong><br />
<input name="default_flow_inherit" type="radio" id="flow_inherit_from_source" value="source" onchange="process_sankey();" />
<label for="flow_inherit_from_source">Use the Source Node's color</label><br />
<input name="default_flow_inherit" type="radio" id="flow_inherit_from_target" value="target" onchange="process_sankey();" checked="checked" />
<label for="flow_inherit_from_target">Use the Target Node's color</label><br />
<input name="default_flow_inherit" type="radio" id="flow_use_color" value="none" onchange="process_sankey();" />
<label for="flow_use_color">Use a single color:</label>
<input type="color" id="default_flow_color" size="7" maxlength="7" value="#666666" onchange="process_sankey();">
</p>
<p class="form_elements1">
<label for="default_flow_opacity"><strong>Flow Opacity:</strong></label>
<span class="no_wrap"><span class="smalllabel">0.0</span><input id="default_flow_opacity" type="range" min="0" max="1" step="0.1" value="0.4" onchange="process_sankey();" class="narrowslider"><span class="smalllabel">1.0</span></span>
</p>
</div>
<!-- LABELS -->
<h2 class="ui_head" onclick="toggle_panel('label_options');">
<span id="label_options_indicator" class="indicator">⇓</span>
Labels & Units<span id="label_options_hint">...</span></h2>
<div id="label_options" class="form_chunk" style="display: none;">
<p class="form_elements1">
<input type="checkbox" id="show_labels" value="1" onchange="process_sankey();" checked="checked">
<label for="show_labels">Show labels</label> <small>(hide to apply your own text to the graph)</small><br />
<input type="checkbox" id="include_values_in_node_labels" value="1" onchange="process_sankey();" checked="checked">
<label for="include_values_in_node_labels">Show Node totals as part of labels</label>
<br />
<input type="checkbox" id="display_full_precision" value="1" onchange="process_sankey();" checked="checked" class="spaced_label">
<label for="display_full_precision">Always show full precision
<small>(best for currency)</small></label>
<br />
</p>
<p class="form_elements2">
<strong>Face:</strong>
<span class="no_wrap"><input name="font_face" type="radio" id="sans_serif" value="sans-serif" checked="checked" onchange="process_sankey();" /><label for="sans_serif" style="font-family: sans-serif;">sans</label></span>
<span class="no_wrap"><input name="font_face" type="radio" id="serif" value="serif" onchange="process_sankey();" /><label for="serif" style="font-family: serif;">serif</label></span>
<span class="no_wrap"><input name="font_face" type="radio" id="monospace" value="monospace" onchange="process_sankey();" /><label for="monospace" style="font-family: monospace;">mono</label></span>
<label for="font_size" class="spaced_label"><strong>Size:</strong></label>
<span class="no_wrap"><input type="text" class="wholenumber" id="font_size" size="2" maxlength="4" value="15" onchange="process_sankey();"> <label for="font_size">px</label></span>
</p>
<p class="form_elements1">
<label for="font_color"><strong>Color:</strong></label>
<input type="color" id="font_color" size="7" maxlength="7" value="#000000" onchange="process_sankey();">
<label for="font_weight" class="spaced_label"><strong>Weight:</strong></label>
<span class="no_wrap"><span style="font-weight: lighter;" class="smalllabel">Light</span><input id="font_weight" type="range" min="100" max="700" step="300" value="400" onchange="process_sankey();" class="narrowslider"><span style="font-weight: bolder;" class="smalllabel">Bold</span></span><br />
</p>
<p class="form_elements2">
<strong>Units:</strong>
<span class="no_wrap"><label for="unit_prefix">Prefix =</label> <input type="text" id="unit_prefix" size="3" maxlength="10" onchange="process_sankey();"></span>
<span class="no_wrap"><label for="unit_suffix">Suffix =</label> <input type="text" id="unit_suffix" size="5" maxlength="10" onchange="process_sankey();"></span>
</p>
<p class="form_elements1">
<label for="number_format"><strong>Number Format:</strong></label>
<select id="number_format" onchange="process_sankey();">
<option value=",." selected="selected">1,000,000.00</option>
<option value=".,">1.000.000,00</option>
<option value=" .">1 000 000.00</option>
<option value=" ,">1 000 000,00</option>
<option value="X.">1000000.00</option>
<option value="X,">1000000,00</option>
</select>
</p>
</div>
<!-- ADVANCED -->
<h2 class="ui_head" onclick="toggle_panel('advanced_options');">
<span id="advanced_options_indicator" class="indicator">⇓</span>
Advanced<span id="advanced_options_hint">...</span></h2>
<div id="advanced_options" class="form_chunk" style="display: none;">
<p class="form_elements1">
<input type="checkbox" id="flow_cross_check" value="1" onchange="process_sankey();" checked="checked">
<label for="flow_cross_check"><strong>Flow Cross-Check:</strong> Verify that the graph adds up.</label><br />
</p>
<p class="form_elements2">
<strong>Diagram Scale</strong> = <span id="scale_figures"></span><br />
(For fair comparisons between diagrams, make their<br />
Units and Scale match as closely as possible.)
</p>
<p class="form_elements1">
<strong>Note:</strong> You can <u>drag</u> Nodes around to reposition them<br />
before export. (However, changing any inputs will<br />
re-draw/reset the whole diagram.)</p>
<p class="form_elements2">
<label for="default_node_opacity"><strong>Node Opacity:</strong></label>
<span class="no_wrap"><span class="smalllabel">0.0</span><input id="default_node_opacity" type="range" min="0" max="1" step="0.1" value="0.9" onchange="process_sankey();" class="narrowslider"><span class="smalllabel">1.0</span></span>
<label for="node_border" class="spaced_label"><strong>Border:</strong></label>
<select id="node_border" onchange="process_sankey();">
<option value="0" selected="selected">0px</option>
<option value="1">1px</option>
<option value="2">2px</option>
<option value="3">3px</option>
<option value="4">4px</option>
<option value="5">5px</option>
</select>
</p>
<p class="form_elements1">
<input type="checkbox" id="reverse_graph" value="1" onchange="process_sankey();">
<label for="reverse_graph"><strong>Reverse the graph</strong> (flow right-to-left)</label>
</p>
</div>
<h2 class="ui_head" onclick="toggle_panel('export_options');">
<span id="export_options_indicator" class="indicator">⇑</span>
Export<span id="export_options_hint">:</span></h2>
<div id="export_options" class="form_chunk">
<div class="form_elements1">
<p class="form_elements">Once you are satisfied with your diagram, you can<br />
<strong>export it as a .PNG image</strong>:</p>
<p class="center_para"><strong>Scale:</strong>
<span class="no_wrap"><input name="scale_x" type="radio" value="1" id="scale_1x" onchange="render_updated_png();" /><label for="scale_1x">1x (Basic)</label></span>
<span class="no_wrap"><input name="scale_x" type="radio" value="2" id="scale_2x" onchange="render_updated_png();" class="spaced_label" checked="checked" /><label for="scale_2x">2x (Retina)</label></span>
<span class="no_wrap"><input name="scale_x" type="radio" value="4" id="scale_4x" onchange="render_updated_png();" class="spaced_label" /><label for="scale_4x">4x (Print)</label></span>
</p>
<p class="center_para no_wrap" id="download_link"><strong><a href="#" id="download_png_link" download="sankey.png">...</a></strong></p>
<p class="center_content" style="margin-bottom: 6px;">Dimensions for IMG tag:</p>
<p class="center_content" id="img_tag_hint"></p>
</div>
</div>
</td>
</tr>
</table>
</form>
</td><td id="grapharea">
<table id="messages">
<tr><td id="messages_area"></td></tr>
</table>
<p id="chart">
<svg id="the_svg" height="600" width="600" xmlns="http://www.w3.org/2000/svg" version="1.1"></svg>
</p>
<canvas id="png_preview" height="600" width="600" style="background: #FFFFFF; display:none;"></canvas>
<div id="chartfooter">
</div>
</td></tr></table>
</div>
<hr>
<div id="footer">
<div id="footer-inner">
<div id="footer-content">
<p>
<strong><a title="SankeyMATIC home page" href="/">SankeyMATIC</a></strong> |
<strong>Build a Sankey Diagram</strong> |
<a class="button" title="How to use SankeyMATIC to the fullest" href="/manual/">Manual</a> |
<a class="button" title="Gallery of Sankey Examples" href="/gallery/">Gallery</a> |
<a class="button" title="Frequently Asked Questions" href="/faq/">FAQ</a>
</p>
<p>
<small>
SankeyMATIC (Twitter: <a href="https://twitter.com/SankeyMATIC" target="_blank">@SankeyMATIC</a>) is produced by
<a href="http://nowthis.com/" target="_blank">Steve Bogart</a>
(Twitter: <a href="https://twitter.com/nowthis" target="_blank">@nowthis</a>).<br />
The SankeyMATIC code is <a href="https://github.com/nowthis/sankeymatic" target="_blank">available on github</a>.
It is built on top of the
<a href="https://github.com/nowthis/d3-plugin-captain-sankey" target="_blank">Sankey library</a> of
<a href="http://d3js.org/" target="_blank">D3.js</a>.<br />
Tips welcome <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=sbogart@sankeymatic.com&currency_code=USD&item_name=Tip" target="_blank">via PayPal</a>.
See <a href="/faq/" target="_blank">the FAQ</a> for more details.
</small>
</p>
</div>
</div>
</div>
<script>
process_sankey(); // render on page load
</script>
</body></html>