1 | <html>
|
2 | <head>
|
3 | <meta charset="utf-8" />
|
4 | <title>Vis Graph3D Examples</title>
|
5 |
|
6 | <meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
7 | <meta name="viewport" content="width=device-width, initial-scale=1" />
|
8 |
|
9 | <style>
|
10 | body {
|
11 | margin: 50px auto 200px;
|
12 | min-width: calc(200px + 2em);
|
13 | width: calc(100vw - 200px);
|
14 | }
|
15 |
|
16 | a {
|
17 | color: #2b7ce9;
|
18 | }
|
19 | a:visited {
|
20 | color: #46417a;
|
21 | }
|
22 |
|
23 | .example-link {
|
24 | position: relative;
|
25 | margin: 1em;
|
26 | width: 200px;
|
27 |
|
28 | display: inline-block;
|
29 | text-align: center;
|
30 | }
|
31 |
|
32 | .example-link .example-image {
|
33 | position: relative;
|
34 | margin-top: 1ex;
|
35 | width: 200px;
|
36 | height: 200px;
|
37 | }
|
38 | .example-link .example-image > img {
|
39 | position: absolute;
|
40 | top: 0px;
|
41 | left: 0px;
|
42 | width: 200px;
|
43 | height: 200px;
|
44 |
|
45 | border: 1px solid #2b7ce9;
|
46 |
|
47 | transition: transform 0.5s ease 0s, z-index 0.5s linear 0s;
|
48 | z-index: 1;
|
49 | }
|
50 | .example-link:hover .example-image > img {
|
51 | transform: translate(0px, 95px) scale(2, 2);
|
52 | z-index: 100;
|
53 | }
|
54 |
|
55 | .playgrounds {
|
56 | margin-left: 1em;
|
57 | white-space: nowrap;
|
58 | }
|
59 | .playgrounds form {
|
60 | display: inline-block;
|
61 | margin: 0px;
|
62 | }
|
63 | .icon {
|
64 | width: 2em;
|
65 | height: 2em;
|
66 |
|
67 | background: none;
|
68 | border: none;
|
69 | cursor: pointer;
|
70 | }
|
71 | .icon.jsfiddle {
|
72 | background-size: contain;
|
73 | background-image: url("data:image/svg+xml,%3C%3Fxml version='1.0' encoding='UTF-8'%3F%3E%3C!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.1//EN' 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'%3E%3Csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' version='1.1' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath fill='%232b7ce9' d='M16.45,17.5C17.45,17.5 18.3,17.15 19,16.5C19.67,15.8 20,15 20,14C20,13.05 19.66,12.22 18.96,11.53C18.26,10.84 17.41,10.5 16.41,10.5C15.47,10.5 14.64,10.83 13.92,11.5L9.14,15.56C8.7,16 8.17,16.22 7.55,16.22C6.92,16.22 6.39,16 5.95,15.56C5.5,15.13 5.3,14.61 5.3,14C5.3,13.42 5.5,12.91 5.95,12.47C6.39,12.03 6.92,11.81 7.55,11.81C8.14,11.81 8.69,12.03 9.19,12.47L9.94,13.13L10.92,12.23L10.08,11.53C9.39,10.84 8.55,10.5 7.55,10.5C6.58,10.5 5.74,10.84 5.04,11.53C4.34,12.22 4,13.05 4,14C4,15 4.34,15.8 5.04,16.5C5.74,17.15 6.59,17.5 7.59,17.5C8.53,17.5 9.36,17.16 10.08,16.5L14.86,12.42C15.27,12 15.8,11.81 16.45,11.81C17.08,11.81 17.61,12.03 18.05,12.47C18.5,12.91 18.7,13.42 18.7,14C18.7,14.61 18.5,15.13 18.05,15.56C17.61,16 17.08,16.22 16.45,16.22C15.89,16.22 15.34,16 14.81,15.5L14.06,14.86L13.08,15.75L13.92,16.45C14.61,17.14 15.45,17.5 16.45,17.5M19.36,10.03C20.64,10.13 21.73,10.65 22.64,11.6C23.55,12.55 24,13.69 24,15C24,16.38 23.5,17.55 22.5,18.54C21.54,19.5 20.36,20 19,20H6C4.34,20 2.93,19.43 1.76,18.26C0.59,17.09 0,15.67 0,14C0,12.55 0.5,11.23 1.57,10.05C2.62,8.88 3.88,8.22 5.34,8.06C6,6.84 6.92,5.86 8.11,5.11C9.3,4.36 10.59,4 12,4C13.69,4 15.26,4.58 16.71,5.77C18.16,6.95 19.05,8.38 19.36,10.03Z' /%3E%3C/svg%3E");
|
74 | }
|
75 | .icon.codepen {
|
76 | background-size: contain;
|
77 | background-image: url("data:image/svg+xml,%3C%3Fxml version='1.0' encoding='UTF-8'%3F%3E%3C!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.1//EN' 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'%3E%3Csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' version='1.1' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath fill='%232b7ce9' d='M15.09,12L12,14.08V14.09L8.91,12L12,9.92V9.92L15.09,12M12,2C11.84,2 11.68,2.06 11.53,2.15L2.5,8.11C2.27,8.22 2.09,8.43 2,8.67V14.92C2,15.33 2,15.33 2.15,15.53L11.53,21.86C11.67,21.96 11.84,22 12,22C12.16,22 12.33,21.95 12.47,21.85L21.85,15.5C22,15.33 22,15.33 22,14.92V8.67C21.91,8.42 21.73,8.22 21.5,8.1L12.47,2.15C12.32,2.05 12.16,2 12,2M16.58,13L19.59,15.04L12.83,19.6V15.53L16.58,13M19.69,8.9L16.58,11L12.83,8.47V4.38L19.69,8.9M20.33,10.47V13.53L18.07,12L20.33,10.47M7.42,13L11.17,15.54V19.6L4.41,15.04L7.42,13M4.31,8.9L11.17,4.39V8.5L7.42,11L4.31,8.9M3.67,10.5L5.93,12L3.67,13.54V10.5Z' /%3E%3C/svg%3E");
|
78 | }
|
79 | </style>
|
80 | </head>
|
81 | <body>
|
82 | <div>
|
83 | <div>
|
84 | <h1>Graph 3D</h1>
|
85 | <div>
|
86 | <span class="example-link"
|
87 | ><div>
|
88 | <a href="graph3d/04_animation.html">Animation</a
|
89 | ><span class="playgrounds"
|
90 | ><form
|
91 | action="http://jsfiddle.net/api/post/library/pure/"
|
92 | method="post"
|
93 | target="_blank"
|
94 | >
|
95 | <button class="icon jsfiddle" alt="JSFiddle" title="JSFiddle">
|
96 |  </button
|
97 | ><input
|
98 | type="hidden"
|
99 | name="js"
|
100 | value='var data = null;
|
101 | var graph = null;
|
102 |
|
103 | function custom(x, y, t) {
|
104 | return Math.sin(x / 50 + t / 10) * Math.cos(y / 50 + t / 10) * 50 + 50;
|
105 | }
|
106 |
|
107 | // Called when the Visualization API is loaded.
|
108 | function drawVisualization() {
|
109 | // Create and populate a data table.
|
110 | data = new vis.DataSet();
|
111 | // create some nice looking data with sin/cos
|
112 | var steps = 25;
|
113 | var axisMax = 314;
|
114 | var tMax = 31;
|
115 | var axisStep = axisMax / steps;
|
116 | for (var t = 0; t < tMax; t++) {
|
117 | for (var x = 0; x < axisMax; x += axisStep) {
|
118 | for (var y = 0; y < axisMax; y += axisStep) {
|
119 | var value = custom(x, y, t);
|
120 | data.add([{ x: x, y: y, z: value, filter: t, style: value }]);
|
121 | }
|
122 | }
|
123 | }
|
124 |
|
125 | // specify options
|
126 | var options = {
|
127 | width: "600px",
|
128 | height: "600px",
|
129 | style: "surface",
|
130 | showPerspective: true,
|
131 | showGrid: true,
|
132 | showShadow: false,
|
133 | // showAnimationControls: false,
|
134 | keepAspectRatio: true,
|
135 | verticalRatio: 0.5,
|
136 | animationInterval: 100, // milliseconds
|
137 | animationPreload: true
|
138 | };
|
139 |
|
140 | // create our graph
|
141 | var container = document.getElementById("mygraph");
|
142 | graph = new vis.Graph3d(container, data, options);
|
143 | }
|
144 |
|
145 | window.addEventListener("load", () => {
|
146 | drawVisualization();
|
147 | });
|
148 | '
|
149 | /><input
|
150 | type="hidden"
|
151 | name="css"
|
152 | value="body {
|
153 | font: 10pt arial;
|
154 | }
|
155 | "
|
156 | /><input
|
157 | type="hidden"
|
158 | name="html"
|
159 | value='<div id="mygraph"></div>
|
160 |
|
161 | <div id="info"></div>
|
162 | '
|
163 | /><input
|
164 | type="hidden"
|
165 | name="resources"
|
166 | value="https://visjs.github.io/vis-graph3d/dist/vis-graph3d.min.js"
|
167 | /><input type="hidden" name="wrap" value="b" /><input
|
168 | type="hidden"
|
169 | name="title"
|
170 | value="Graph 3D | Animation"
|
171 | />
|
172 | </form>
|
173 |
|
174 | <form
|
175 | action="https://codepen.io/pen/define"
|
176 | method="post"
|
177 | target="_blank"
|
178 | >
|
179 | <button class="icon codepen" alt="CodePen" title="CodePen">
|
180 |  </button
|
181 | ><input
|
182 | type="hidden"
|
183 | name="data"
|
184 | value='{"css":"body {\n font: 10pt arial;\n}\n","css_external":"","html":"<div id=\"mygraph\"></div>\n\n<div id=\"info\"></div>\n","js":"var data = null;\nvar graph = null;\n\nfunction custom(x, y, t) {\n return Math.sin(x / 50 + t / 10) * Math.cos(y / 50 + t / 10) * 50 + 50;\n}\n\n// Called when the Visualization API is loaded.\nfunction drawVisualization() {\n // Create and populate a data table.\n data = new vis.DataSet();\n // create some nice looking data with sin/cos\n var steps = 25;\n var axisMax = 314;\n var tMax = 31;\n var axisStep = axisMax / steps;\n for (var t = 0; t < tMax; t++) {\n for (var x = 0; x < axisMax; x += axisStep) {\n for (var y = 0; y < axisMax; y += axisStep) {\n var value = custom(x, y, t);\n data.add([{ x: x, y: y, z: value, filter: t, style: value }]);\n }\n }\n }\n\n // specify options\n var options = {\n width: \"600px\",\n height: \"600px\",\n style: \"surface\",\n showPerspective: true,\n showGrid: true,\n showShadow: false,\n // showAnimationControls: false,\n keepAspectRatio: true,\n verticalRatio: 0.5,\n animationInterval: 100, // milliseconds\n animationPreload: true\n };\n\n // create our graph\n var container = document.getElementById(\"mygraph\");\n graph = new vis.Graph3d(container, data, options);\n}\n\nwindow.addEventListener(\"load\", () => {\n drawVisualization();\n});\n","js_external":"https://visjs.github.io/vis-graph3d/dist/vis-graph3d.min.js","title":"Graph 3D | Animation"}'
|
185 | /><input
|
186 | type="hidden"
|
187 | name="js"
|
188 | value='var data = null;
|
189 | var graph = null;
|
190 |
|
191 | function custom(x, y, t) {
|
192 | return Math.sin(x / 50 + t / 10) * Math.cos(y / 50 + t / 10) * 50 + 50;
|
193 | }
|
194 |
|
195 | // Called when the Visualization API is loaded.
|
196 | function drawVisualization() {
|
197 | // Create and populate a data table.
|
198 | data = new vis.DataSet();
|
199 | // create some nice looking data with sin/cos
|
200 | var steps = 25;
|
201 | var axisMax = 314;
|
202 | var tMax = 31;
|
203 | var axisStep = axisMax / steps;
|
204 | for (var t = 0; t < tMax; t++) {
|
205 | for (var x = 0; x < axisMax; x += axisStep) {
|
206 | for (var y = 0; y < axisMax; y += axisStep) {
|
207 | var value = custom(x, y, t);
|
208 | data.add([{ x: x, y: y, z: value, filter: t, style: value }]);
|
209 | }
|
210 | }
|
211 | }
|
212 |
|
213 | // specify options
|
214 | var options = {
|
215 | width: "600px",
|
216 | height: "600px",
|
217 | style: "surface",
|
218 | showPerspective: true,
|
219 | showGrid: true,
|
220 | showShadow: false,
|
221 | // showAnimationControls: false,
|
222 | keepAspectRatio: true,
|
223 | verticalRatio: 0.5,
|
224 | animationInterval: 100, // milliseconds
|
225 | animationPreload: true
|
226 | };
|
227 |
|
228 | // create our graph
|
229 | var container = document.getElementById("mygraph");
|
230 | graph = new vis.Graph3d(container, data, options);
|
231 | }
|
232 |
|
233 | window.addEventListener("load", () => {
|
234 | drawVisualization();
|
235 | });
|
236 | '
|
237 | /><input
|
238 | type="hidden"
|
239 | name="css"
|
240 | value="body {
|
241 | font: 10pt arial;
|
242 | }
|
243 | "
|
244 | /><input
|
245 | type="hidden"
|
246 | name="html"
|
247 | value='<div id="mygraph"></div>
|
248 |
|
249 | <div id="info"></div>
|
250 | '
|
251 | /></form
|
252 | ></span>
|
253 | </div>
|
254 | <a href="graph3d/04_animation.html"
|
255 | ><div class="example-image">
|
256 | <img
|
257 | src="thumbnails/44b2da471c68f49cb41dc0690487d082929fbb022a888327d2b1a035e0c36c66.png"
|
258 | alt="Animation"
|
259 | /></div></a></span
|
260 | ><span class="example-link"
|
261 | ><div>
|
262 | <a href="graph3d/06_moving_dots.html">Animation Moving Dots</a
|
263 | ><span class="playgrounds"
|
264 | ><form
|
265 | action="http://jsfiddle.net/api/post/library/pure/"
|
266 | method="post"
|
267 | target="_blank"
|
268 | >
|
269 | <button class="icon jsfiddle" alt="JSFiddle" title="JSFiddle">
|
270 |  </button
|
271 | ><input
|
272 | type="hidden"
|
273 | name="js"
|
274 | value='var data = null;
|
275 | var graph = null;
|
276 |
|
277 | // Called when the Visualization API is loaded.
|
278 | function drawVisualization() {
|
279 | // create the data table.
|
280 | data = new vis.DataSet();
|
281 |
|
282 | // create some shortcuts to math functions
|
283 | var sin = Math.sin;
|
284 | var cos = Math.cos;
|
285 | var pi = Math.PI;
|
286 |
|
287 | // create the animation data
|
288 | var tmax = 2.0 * pi;
|
289 | var tstep = tmax / 75;
|
290 | var dotCount = 1; // set this to 1, 2, 3, 4, ...
|
291 | for (var t = 0; t < tmax; t += tstep) {
|
292 | var tgroup = parseFloat(t.toFixed(2));
|
293 | var value = t;
|
294 |
|
295 | // a dot in the center
|
296 | data.add({ x: 0, y: 0, z: 0, filter: tgroup, style: value });
|
297 |
|
298 | // one or multiple dots moving around the center
|
299 | for (var dot = 0; dot < dotCount; dot++) {
|
300 | var tdot = t + (2 * pi * dot) / dotCount;
|
301 | data.add({
|
302 | x: sin(tdot),
|
303 | y: cos(tdot),
|
304 | z: sin(tdot),
|
305 | filter: tgroup,
|
306 | style: value
|
307 | });
|
308 | data.add({
|
309 | x: sin(tdot),
|
310 | y: -cos(tdot),
|
311 | z: sin(tdot + (tmax * 1) / 2),
|
312 | filter: tgroup,
|
313 | style: value
|
314 | });
|
315 | }
|
316 | }
|
317 |
|
318 | // specify options
|
319 | var options = {
|
320 | width: "600px",
|
321 | height: "600px",
|
322 | style: "dot-color",
|
323 | showPerspective: true,
|
324 | showGrid: true,
|
325 | keepAspectRatio: true,
|
326 | verticalRatio: 1.0,
|
327 | animationInterval: 35, // milliseconds
|
328 | animationPreload: false,
|
329 | animationAutoStart: true,
|
330 | legendLabel: "color value",
|
331 | cameraPosition: {
|
332 | horizontal: 2.7,
|
333 | vertical: 0.0,
|
334 | distance: 1.65
|
335 | }
|
336 | };
|
337 |
|
338 | // create our graph
|
339 | var container = document.getElementById("mygraph");
|
340 | graph = new vis.Graph3d(container, data, options);
|
341 | }
|
342 |
|
343 | window.addEventListener("load", () => {
|
344 | drawVisualization();
|
345 | });
|
346 | '
|
347 | /><input
|
348 | type="hidden"
|
349 | name="css"
|
350 | value="body {
|
351 | font: 10pt arial;
|
352 | }
|
353 | "
|
354 | /><input
|
355 | type="hidden"
|
356 | name="html"
|
357 | value='<div id="mygraph"></div>
|
358 |
|
359 | <div id="info"></div>
|
360 | '
|
361 | /><input
|
362 | type="hidden"
|
363 | name="resources"
|
364 | value="https://visjs.github.io/vis-graph3d/dist/vis-graph3d.min.js"
|
365 | /><input type="hidden" name="wrap" value="b" /><input
|
366 | type="hidden"
|
367 | name="title"
|
368 | value="Graph 3D | Animation Moving Dots"
|
369 | />
|
370 | </form>
|
371 |
|
372 | <form
|
373 | action="https://codepen.io/pen/define"
|
374 | method="post"
|
375 | target="_blank"
|
376 | >
|
377 | <button class="icon codepen" alt="CodePen" title="CodePen">
|
378 |  </button
|
379 | ><input
|
380 | type="hidden"
|
381 | name="data"
|
382 | value='{"css":"body {\n font: 10pt arial;\n}\n","css_external":"","html":"<div id=\"mygraph\"></div>\n\n<div id=\"info\"></div>\n","js":"var data = null;\nvar graph = null;\n\n// Called when the Visualization API is loaded.\nfunction drawVisualization() {\n // create the data table.\n data = new vis.DataSet();\n\n // create some shortcuts to math functions\n var sin = Math.sin;\n var cos = Math.cos;\n var pi = Math.PI;\n\n // create the animation data\n var tmax = 2.0 * pi;\n var tstep = tmax / 75;\n var dotCount = 1; // set this to 1, 2, 3, 4, ...\n for (var t = 0; t < tmax; t += tstep) {\n var tgroup = parseFloat(t.toFixed(2));\n var value = t;\n\n // a dot in the center\n data.add({ x: 0, y: 0, z: 0, filter: tgroup, style: value });\n\n // one or multiple dots moving around the center\n for (var dot = 0; dot < dotCount; dot++) {\n var tdot = t + (2 * pi * dot) / dotCount;\n data.add({\n x: sin(tdot),\n y: cos(tdot),\n z: sin(tdot),\n filter: tgroup,\n style: value\n });\n data.add({\n x: sin(tdot),\n y: -cos(tdot),\n z: sin(tdot + (tmax * 1) / 2),\n filter: tgroup,\n style: value\n });\n }\n }\n\n // specify options\n var options = {\n width: \"600px\",\n height: \"600px\",\n style: \"dot-color\",\n showPerspective: true,\n showGrid: true,\n keepAspectRatio: true,\n verticalRatio: 1.0,\n animationInterval: 35, // milliseconds\n animationPreload: false,\n animationAutoStart: true,\n legendLabel: \"color value\",\n cameraPosition: {\n horizontal: 2.7,\n vertical: 0.0,\n distance: 1.65\n }\n };\n\n // create our graph\n var container = document.getElementById(\"mygraph\");\n graph = new vis.Graph3d(container, data, options);\n}\n\nwindow.addEventListener(\"load\", () => {\n drawVisualization();\n});\n","js_external":"https://visjs.github.io/vis-graph3d/dist/vis-graph3d.min.js","title":"Graph 3D | Animation Moving Dots"}'
|
383 | /><input
|
384 | type="hidden"
|
385 | name="js"
|
386 | value='var data = null;
|
387 | var graph = null;
|
388 |
|
389 | // Called when the Visualization API is loaded.
|
390 | function drawVisualization() {
|
391 | // create the data table.
|
392 | data = new vis.DataSet();
|
393 |
|
394 | // create some shortcuts to math functions
|
395 | var sin = Math.sin;
|
396 | var cos = Math.cos;
|
397 | var pi = Math.PI;
|
398 |
|
399 | // create the animation data
|
400 | var tmax = 2.0 * pi;
|
401 | var tstep = tmax / 75;
|
402 | var dotCount = 1; // set this to 1, 2, 3, 4, ...
|
403 | for (var t = 0; t < tmax; t += tstep) {
|
404 | var tgroup = parseFloat(t.toFixed(2));
|
405 | var value = t;
|
406 |
|
407 | // a dot in the center
|
408 | data.add({ x: 0, y: 0, z: 0, filter: tgroup, style: value });
|
409 |
|
410 | // one or multiple dots moving around the center
|
411 | for (var dot = 0; dot < dotCount; dot++) {
|
412 | var tdot = t + (2 * pi * dot) / dotCount;
|
413 | data.add({
|
414 | x: sin(tdot),
|
415 | y: cos(tdot),
|
416 | z: sin(tdot),
|
417 | filter: tgroup,
|
418 | style: value
|
419 | });
|
420 | data.add({
|
421 | x: sin(tdot),
|
422 | y: -cos(tdot),
|
423 | z: sin(tdot + (tmax * 1) / 2),
|
424 | filter: tgroup,
|
425 | style: value
|
426 | });
|
427 | }
|
428 | }
|
429 |
|
430 | // specify options
|
431 | var options = {
|
432 | width: "600px",
|
433 | height: "600px",
|
434 | style: "dot-color",
|
435 | showPerspective: true,
|
436 | showGrid: true,
|
437 | keepAspectRatio: true,
|
438 | verticalRatio: 1.0,
|
439 | animationInterval: 35, // milliseconds
|
440 | animationPreload: false,
|
441 | animationAutoStart: true,
|
442 | legendLabel: "color value",
|
443 | cameraPosition: {
|
444 | horizontal: 2.7,
|
445 | vertical: 0.0,
|
446 | distance: 1.65
|
447 | }
|
448 | };
|
449 |
|
450 | // create our graph
|
451 | var container = document.getElementById("mygraph");
|
452 | graph = new vis.Graph3d(container, data, options);
|
453 | }
|
454 |
|
455 | window.addEventListener("load", () => {
|
456 | drawVisualization();
|
457 | });
|
458 | '
|
459 | /><input
|
460 | type="hidden"
|
461 | name="css"
|
462 | value="body {
|
463 | font: 10pt arial;
|
464 | }
|
465 | "
|
466 | /><input
|
467 | type="hidden"
|
468 | name="html"
|
469 | value='<div id="mygraph"></div>
|
470 |
|
471 | <div id="info"></div>
|
472 | '
|
473 | /></form
|
474 | ></span>
|
475 | </div>
|
476 | <a href="graph3d/06_moving_dots.html"
|
477 | ><div class="example-image">
|
478 | <img
|
479 | src="thumbnails/7ce1dc306703919a19090e8f70fc8a7ef0d161412f936d705442ef38aca3ce3a.png"
|
480 | alt="Animation Moving Dots"
|
481 | /></div></a></span
|
482 | ><span class="example-link"
|
483 | ><div>
|
484 | <a href="graph3d/01_basics.html">Basics</a
|
485 | ><span class="playgrounds"
|
486 | ><form
|
487 | action="http://jsfiddle.net/api/post/library/pure/"
|
488 | method="post"
|
489 | target="_blank"
|
490 | >
|
491 | <button class="icon jsfiddle" alt="JSFiddle" title="JSFiddle">
|
492 |  </button
|
493 | ><input
|
494 | type="hidden"
|
495 | name="js"
|
496 | value='var data = null;
|
497 | var graph = null;
|
498 |
|
499 | function custom(x, y) {
|
500 | return Math.sin(x / 50) * Math.cos(y / 50) * 50 + 50;
|
501 | }
|
502 |
|
503 | // Called when the Visualization API is loaded.
|
504 | function drawVisualization() {
|
505 | // Create and populate a data table.
|
506 | data = new vis.DataSet();
|
507 | // create some nice looking data with sin/cos
|
508 | var counter = 0;
|
509 | var steps = 50; // number of datapoints will be steps*steps
|
510 | var axisMax = 314;
|
511 | var axisStep = axisMax / steps;
|
512 | for (var x = 0; x < axisMax; x += axisStep) {
|
513 | for (var y = 0; y < axisMax; y += axisStep) {
|
514 | var value = custom(x, y);
|
515 | data.add({ id: counter++, x: x, y: y, z: value, style: value });
|
516 | }
|
517 | }
|
518 |
|
519 | // specify options
|
520 | var options = {
|
521 | width: "600px",
|
522 | height: "600px",
|
523 | style: "surface",
|
524 | showPerspective: true,
|
525 | showGrid: true,
|
526 | showShadow: false,
|
527 | keepAspectRatio: true,
|
528 | verticalRatio: 0.5
|
529 | };
|
530 |
|
531 | // Instantiate our graph object.
|
532 | var container = document.getElementById("mygraph");
|
533 | graph = new vis.Graph3d(container, data, options);
|
534 | }
|
535 |
|
536 | window.addEventListener("load", () => {
|
537 | drawVisualization();
|
538 | });
|
539 | '
|
540 | /><input
|
541 | type="hidden"
|
542 | name="css"
|
543 | value="body {
|
544 | font: 10pt arial;
|
545 | }
|
546 | "
|
547 | /><input
|
548 | type="hidden"
|
549 | name="html"
|
550 | value='<div id="mygraph"></div>
|
551 |
|
552 | <div id="info"></div>
|
553 | '
|
554 | /><input
|
555 | type="hidden"
|
556 | name="resources"
|
557 | value="https://visjs.github.io/vis-graph3d/dist/vis-graph3d.min.js"
|
558 | /><input type="hidden" name="wrap" value="b" /><input
|
559 | type="hidden"
|
560 | name="title"
|
561 | value="Graph 3D | Basics"
|
562 | />
|
563 | </form>
|
564 |
|
565 | <form
|
566 | action="https://codepen.io/pen/define"
|
567 | method="post"
|
568 | target="_blank"
|
569 | >
|
570 | <button class="icon codepen" alt="CodePen" title="CodePen">
|
571 |  </button
|
572 | ><input
|
573 | type="hidden"
|
574 | name="data"
|
575 | value='{"css":"body {\n font: 10pt arial;\n}\n","css_external":"","html":"<div id=\"mygraph\"></div>\n\n<div id=\"info\"></div>\n","js":"var data = null;\nvar graph = null;\n\nfunction custom(x, y) {\n return Math.sin(x / 50) * Math.cos(y / 50) * 50 + 50;\n}\n\n// Called when the Visualization API is loaded.\nfunction drawVisualization() {\n // Create and populate a data table.\n data = new vis.DataSet();\n // create some nice looking data with sin/cos\n var counter = 0;\n var steps = 50; // number of datapoints will be steps*steps\n var axisMax = 314;\n var axisStep = axisMax / steps;\n for (var x = 0; x < axisMax; x += axisStep) {\n for (var y = 0; y < axisMax; y += axisStep) {\n var value = custom(x, y);\n data.add({ id: counter++, x: x, y: y, z: value, style: value });\n }\n }\n\n // specify options\n var options = {\n width: \"600px\",\n height: \"600px\",\n style: \"surface\",\n showPerspective: true,\n showGrid: true,\n showShadow: false,\n keepAspectRatio: true,\n verticalRatio: 0.5\n };\n\n // Instantiate our graph object.\n var container = document.getElementById(\"mygraph\");\n graph = new vis.Graph3d(container, data, options);\n}\n\nwindow.addEventListener(\"load\", () => {\n drawVisualization();\n});\n","js_external":"https://visjs.github.io/vis-graph3d/dist/vis-graph3d.min.js","title":"Graph 3D | Basics"}'
|
576 | /><input
|
577 | type="hidden"
|
578 | name="js"
|
579 | value='var data = null;
|
580 | var graph = null;
|
581 |
|
582 | function custom(x, y) {
|
583 | return Math.sin(x / 50) * Math.cos(y / 50) * 50 + 50;
|
584 | }
|
585 |
|
586 | // Called when the Visualization API is loaded.
|
587 | function drawVisualization() {
|
588 | // Create and populate a data table.
|
589 | data = new vis.DataSet();
|
590 | // create some nice looking data with sin/cos
|
591 | var counter = 0;
|
592 | var steps = 50; // number of datapoints will be steps*steps
|
593 | var axisMax = 314;
|
594 | var axisStep = axisMax / steps;
|
595 | for (var x = 0; x < axisMax; x += axisStep) {
|
596 | for (var y = 0; y < axisMax; y += axisStep) {
|
597 | var value = custom(x, y);
|
598 | data.add({ id: counter++, x: x, y: y, z: value, style: value });
|
599 | }
|
600 | }
|
601 |
|
602 | // specify options
|
603 | var options = {
|
604 | width: "600px",
|
605 | height: "600px",
|
606 | style: "surface",
|
607 | showPerspective: true,
|
608 | showGrid: true,
|
609 | showShadow: false,
|
610 | keepAspectRatio: true,
|
611 | verticalRatio: 0.5
|
612 | };
|
613 |
|
614 | // Instantiate our graph object.
|
615 | var container = document.getElementById("mygraph");
|
616 | graph = new vis.Graph3d(container, data, options);
|
617 | }
|
618 |
|
619 | window.addEventListener("load", () => {
|
620 | drawVisualization();
|
621 | });
|
622 | '
|
623 | /><input
|
624 | type="hidden"
|
625 | name="css"
|
626 | value="body {
|
627 | font: 10pt arial;
|
628 | }
|
629 | "
|
630 | /><input
|
631 | type="hidden"
|
632 | name="html"
|
633 | value='<div id="mygraph"></div>
|
634 |
|
635 | <div id="info"></div>
|
636 | '
|
637 | /></form
|
638 | ></span>
|
639 | </div>
|
640 | <a href="graph3d/01_basics.html"
|
641 | ><div class="example-image">
|
642 | <img
|
643 | src="thumbnails/a2093f3aab17f34ce73003b929d4508870f32390487c6befe784394ef93e5479.png"
|
644 | alt="Basics"
|
645 | /></div></a></span
|
646 | ><span class="example-link"
|
647 | ><div>
|
648 | <a href="graph3d/02_camera.html">Camera Position</a
|
649 | ><span class="playgrounds"
|
650 | ><form
|
651 | action="http://jsfiddle.net/api/post/library/pure/"
|
652 | method="post"
|
653 | target="_blank"
|
654 | >
|
655 | <button class="icon jsfiddle" alt="JSFiddle" title="JSFiddle">
|
656 |  </button
|
657 | ><input
|
658 | type="hidden"
|
659 | name="js"
|
660 | value='var data = null;
|
661 | var graph = null;
|
662 |
|
663 | function custom(x, y) {
|
664 | return Math.sin(x / 50) * Math.cos(y / 50) * 50 + 50;
|
665 | }
|
666 |
|
667 | // callback function, called when the camera position has changed
|
668 | function onCameraPositionChange() {
|
669 | // adjust the values of startDate and endDate
|
670 | var pos = graph.getCameraPosition();
|
671 | document.getElementById("horizontal").value = parseFloat(
|
672 | pos.horizontal.toFixed(3)
|
673 | );
|
674 | document.getElementById("vertical").value = parseFloat(
|
675 | pos.vertical.toFixed(3)
|
676 | );
|
677 | document.getElementById("distance").value = parseFloat(
|
678 | pos.distance.toFixed(3)
|
679 | );
|
680 | }
|
681 |
|
682 | // set the camera position
|
683 | function setCameraPosition() {
|
684 | var horizontal = parseFloat(document.getElementById("horizontal").value);
|
685 | var vertical = parseFloat(document.getElementById("vertical").value);
|
686 | var distance = parseFloat(document.getElementById("distance").value);
|
687 | var pos = {
|
688 | horizontal: horizontal,
|
689 | vertical: vertical,
|
690 | distance: distance
|
691 | };
|
692 | graph.setCameraPosition(pos);
|
693 |
|
694 | // retrieve the camera position again, to get the applied values
|
695 | onCameraPositionChange();
|
696 | }
|
697 |
|
698 | // Called when the Visualization API is loaded.
|
699 | function drawVisualization() {
|
700 | // Create and populate a data table.
|
701 | data = new vis.DataSet();
|
702 | // create some nice looking data with sin/cos
|
703 | var steps = 50; // number of datapoints will be steps*steps
|
704 | var axisMax = 314;
|
705 | var axisStep = axisMax / steps;
|
706 | for (var x = 0; x < axisMax; x += axisStep) {
|
707 | for (var y = 0; y < axisMax; y += axisStep) {
|
708 | var value = custom(x, y);
|
709 | data.add([{ x: x, y: y, z: value, t: 0, style: value }]);
|
710 | }
|
711 | }
|
712 |
|
713 | // specify options
|
714 | var options = {
|
715 | width: "600px",
|
716 | height: "600px",
|
717 | style: "surface",
|
718 | showPerspective: true,
|
719 | showGrid: true,
|
720 | showShadow: false,
|
721 | keepAspectRatio: true,
|
722 | verticalRatio: 0.5
|
723 | };
|
724 |
|
725 | // create our graph
|
726 | var container = document.getElementById("mygraph");
|
727 | graph = new vis.Graph3d(container, data, options);
|
728 |
|
729 | graph.on("cameraPositionChange", onCameraPositionChange);
|
730 | }
|
731 |
|
732 | window.addEventListener("load", () => {
|
733 | drawVisualization();
|
734 | });
|
735 | '
|
736 | /><input
|
737 | type="hidden"
|
738 | name="css"
|
739 | value="body {
|
740 | font: 10pt arial;
|
741 | }
|
742 | td {
|
743 | font: 10pt arial;
|
744 | }
|
745 | "
|
746 | /><input
|
747 | type="hidden"
|
748 | name="html"
|
749 | value='<h1>Graph 3d camera position</h1>
|
750 | <table>
|
751 | <tbody>
|
752 | <tr>
|
753 | <td>Horizontal angle (0 to 2*pi)</td>
|
754 | <td><input type="text" id="horizontal" value="1.0" /></td>
|
755 | </tr>
|
756 | <tr>
|
757 | <td>Vertical angle (0 to 0.5*pi)</td>
|
758 | <td><input type="text" id="vertical" value="0.5" /></td>
|
759 | </tr>
|
760 | <tr>
|
761 | <td>Distance (0.71 to 5.0)</td>
|
762 | <td><input type="text" id="distance" value="1.7" /></td>
|
763 | </tr>
|
764 | <tr>
|
765 | <td></td>
|
766 | <td>
|
767 | <input type="button" value="Set" onclick="setCameraPosition();" />
|
768 | </td>
|
769 | </tr>
|
770 | </tbody>
|
771 | </table>
|
772 |
|
773 | <div id="mygraph"></div>
|
774 |
|
775 | <div id="info"></div>
|
776 | '
|
777 | /><input
|
778 | type="hidden"
|
779 | name="resources"
|
780 | value="https://visjs.github.io/vis-graph3d/dist/vis-graph3d.min.js"
|
781 | /><input type="hidden" name="wrap" value="b" /><input
|
782 | type="hidden"
|
783 | name="title"
|
784 | value="Graph 3D | Camera Position"
|
785 | />
|
786 | </form>
|
787 |
|
788 | <form
|
789 | action="https://codepen.io/pen/define"
|
790 | method="post"
|
791 | target="_blank"
|
792 | >
|
793 | <button class="icon codepen" alt="CodePen" title="CodePen">
|
794 |  </button
|
795 | ><input
|
796 | type="hidden"
|
797 | name="data"
|
798 | value='{"css":"body {\n font: 10pt arial;\n}\ntd {\n font: 10pt arial;\n}\n","css_external":"","html":"<h1>Graph 3d camera position</h1>\n<table>\n <tbody>\n <tr>\n <td>Horizontal angle (0 to 2*pi)</td>\n <td><input type=\"text\" id=\"horizontal\" value=\"1.0\" /></td>\n </tr>\n <tr>\n <td>Vertical angle (0 to 0.5*pi)</td>\n <td><input type=\"text\" id=\"vertical\" value=\"0.5\" /></td>\n </tr>\n <tr>\n <td>Distance (0.71 to 5.0)</td>\n <td><input type=\"text\" id=\"distance\" value=\"1.7\" /></td>\n </tr>\n <tr>\n <td></td>\n <td>\n <input type=\"button\" value=\"Set\" onclick=\"setCameraPosition();\" />\n </td>\n </tr>\n </tbody>\n</table>\n\n<div id=\"mygraph\"></div>\n\n<div id=\"info\"></div>\n","js":"var data = null;\nvar graph = null;\n\nfunction custom(x, y) {\n return Math.sin(x / 50) * Math.cos(y / 50) * 50 + 50;\n}\n\n// callback function, called when the camera position has changed\nfunction onCameraPositionChange() {\n // adjust the values of startDate and endDate\n var pos = graph.getCameraPosition();\n document.getElementById(\"horizontal\").value = parseFloat(\n pos.horizontal.toFixed(3)\n );\n document.getElementById(\"vertical\").value = parseFloat(\n pos.vertical.toFixed(3)\n );\n document.getElementById(\"distance\").value = parseFloat(\n pos.distance.toFixed(3)\n );\n}\n\n// set the camera position\nfunction setCameraPosition() {\n var horizontal = parseFloat(document.getElementById(\"horizontal\").value);\n var vertical = parseFloat(document.getElementById(\"vertical\").value);\n var distance = parseFloat(document.getElementById(\"distance\").value);\n var pos = {\n horizontal: horizontal,\n vertical: vertical,\n distance: distance\n };\n graph.setCameraPosition(pos);\n\n // retrieve the camera position again, to get the applied values\n onCameraPositionChange();\n}\n\n// Called when the Visualization API is loaded.\nfunction drawVisualization() {\n // Create and populate a data table.\n data = new vis.DataSet();\n // create some nice looking data with sin/cos\n var steps = 50; // number of datapoints will be steps*steps\n var axisMax = 314;\n var axisStep = axisMax / steps;\n for (var x = 0; x < axisMax; x += axisStep) {\n for (var y = 0; y < axisMax; y += axisStep) {\n var value = custom(x, y);\n data.add([{ x: x, y: y, z: value, t: 0, style: value }]);\n }\n }\n\n // specify options\n var options = {\n width: \"600px\",\n height: \"600px\",\n style: \"surface\",\n showPerspective: true,\n showGrid: true,\n showShadow: false,\n keepAspectRatio: true,\n verticalRatio: 0.5\n };\n\n // create our graph\n var container = document.getElementById(\"mygraph\");\n graph = new vis.Graph3d(container, data, options);\n\n graph.on(\"cameraPositionChange\", onCameraPositionChange);\n}\n\nwindow.addEventListener(\"load\", () => {\n drawVisualization();\n});\n","js_external":"https://visjs.github.io/vis-graph3d/dist/vis-graph3d.min.js","title":"Graph 3D | Camera Position"}'
|
799 | /><input
|
800 | type="hidden"
|
801 | name="js"
|
802 | value='var data = null;
|
803 | var graph = null;
|
804 |
|
805 | function custom(x, y) {
|
806 | return Math.sin(x / 50) * Math.cos(y / 50) * 50 + 50;
|
807 | }
|
808 |
|
809 | // callback function, called when the camera position has changed
|
810 | function onCameraPositionChange() {
|
811 | // adjust the values of startDate and endDate
|
812 | var pos = graph.getCameraPosition();
|
813 | document.getElementById("horizontal").value = parseFloat(
|
814 | pos.horizontal.toFixed(3)
|
815 | );
|
816 | document.getElementById("vertical").value = parseFloat(
|
817 | pos.vertical.toFixed(3)
|
818 | );
|
819 | document.getElementById("distance").value = parseFloat(
|
820 | pos.distance.toFixed(3)
|
821 | );
|
822 | }
|
823 |
|
824 | // set the camera position
|
825 | function setCameraPosition() {
|
826 | var horizontal = parseFloat(document.getElementById("horizontal").value);
|
827 | var vertical = parseFloat(document.getElementById("vertical").value);
|
828 | var distance = parseFloat(document.getElementById("distance").value);
|
829 | var pos = {
|
830 | horizontal: horizontal,
|
831 | vertical: vertical,
|
832 | distance: distance
|
833 | };
|
834 | graph.setCameraPosition(pos);
|
835 |
|
836 | // retrieve the camera position again, to get the applied values
|
837 | onCameraPositionChange();
|
838 | }
|
839 |
|
840 | // Called when the Visualization API is loaded.
|
841 | function drawVisualization() {
|
842 | // Create and populate a data table.
|
843 | data = new vis.DataSet();
|
844 | // create some nice looking data with sin/cos
|
845 | var steps = 50; // number of datapoints will be steps*steps
|
846 | var axisMax = 314;
|
847 | var axisStep = axisMax / steps;
|
848 | for (var x = 0; x < axisMax; x += axisStep) {
|
849 | for (var y = 0; y < axisMax; y += axisStep) {
|
850 | var value = custom(x, y);
|
851 | data.add([{ x: x, y: y, z: value, t: 0, style: value }]);
|
852 | }
|
853 | }
|
854 |
|
855 | // specify options
|
856 | var options = {
|
857 | width: "600px",
|
858 | height: "600px",
|
859 | style: "surface",
|
860 | showPerspective: true,
|
861 | showGrid: true,
|
862 | showShadow: false,
|
863 | keepAspectRatio: true,
|
864 | verticalRatio: 0.5
|
865 | };
|
866 |
|
867 | // create our graph
|
868 | var container = document.getElementById("mygraph");
|
869 | graph = new vis.Graph3d(container, data, options);
|
870 |
|
871 | graph.on("cameraPositionChange", onCameraPositionChange);
|
872 | }
|
873 |
|
874 | window.addEventListener("load", () => {
|
875 | drawVisualization();
|
876 | });
|
877 | '
|
878 | /><input
|
879 | type="hidden"
|
880 | name="css"
|
881 | value="body {
|
882 | font: 10pt arial;
|
883 | }
|
884 | td {
|
885 | font: 10pt arial;
|
886 | }
|
887 | "
|
888 | /><input
|
889 | type="hidden"
|
890 | name="html"
|
891 | value='<h1>Graph 3d camera position</h1>
|
892 | <table>
|
893 | <tbody>
|
894 | <tr>
|
895 | <td>Horizontal angle (0 to 2*pi)</td>
|
896 | <td><input type="text" id="horizontal" value="1.0" /></td>
|
897 | </tr>
|
898 | <tr>
|
899 | <td>Vertical angle (0 to 0.5*pi)</td>
|
900 | <td><input type="text" id="vertical" value="0.5" /></td>
|
901 | </tr>
|
902 | <tr>
|
903 | <td>Distance (0.71 to 5.0)</td>
|
904 | <td><input type="text" id="distance" value="1.7" /></td>
|
905 | </tr>
|
906 | <tr>
|
907 | <td></td>
|
908 | <td>
|
909 | <input type="button" value="Set" onclick="setCameraPosition();" />
|
910 | </td>
|
911 | </tr>
|
912 | </tbody>
|
913 | </table>
|
914 |
|
915 | <div id="mygraph"></div>
|
916 |
|
917 | <div id="info"></div>
|
918 | '
|
919 | /></form
|
920 | ></span>
|
921 | </div>
|
922 | <a href="graph3d/02_camera.html"
|
923 | ><div class="example-image">
|
924 | <img
|
925 | src="thumbnails/e67f2e28c3dc1af39bc23e96b7ea0bbc5b632ede8d58793884ce4f3f242dd733.png"
|
926 | alt="Camera Position"
|
927 | /></div></a></span
|
928 | ><span class="example-link"
|
929 | ><div>
|
930 | <a href="graph3d/07_dot_cloud_colors.html"
|
931 | >Cloud with Colored Dots</a
|
932 | ><span class="playgrounds"
|
933 | ><form
|
934 | action="http://jsfiddle.net/api/post/library/pure/"
|
935 | method="post"
|
936 | target="_blank"
|
937 | >
|
938 | <button class="icon jsfiddle" alt="JSFiddle" title="JSFiddle">
|
939 |  </button
|
940 | ><input
|
941 | type="hidden"
|
942 | name="js"
|
943 | value='var data = null;
|
944 | var graph = null;
|
945 |
|
946 | function onclick(point) {
|
947 | console.log(point);
|
948 | }
|
949 |
|
950 | // Called when the Visualization API is loaded.
|
951 | function drawVisualization() {
|
952 | // create the data table.
|
953 | data = new vis.DataSet();
|
954 |
|
955 | // create some shortcuts to math functions
|
956 | var sqrt = Math.sqrt;
|
957 | var pow = Math.pow;
|
958 | var random = Math.random;
|
959 |
|
960 | // create the animation data
|
961 | var imax = 100;
|
962 | for (var i = 0; i < imax; i++) {
|
963 | var x = pow(random(), 2);
|
964 | var y = pow(random(), 2);
|
965 | var z = pow(random(), 2);
|
966 | var style =
|
967 | i % 2 == 0 ? sqrt(pow(x, 2) + pow(y, 2) + pow(z, 2)) : "#00ffff";
|
968 |
|
969 | data.add({ x: x, y: y, z: z, style: style });
|
970 | }
|
971 |
|
972 | // specify options
|
973 | var options = {
|
974 | width: "600px",
|
975 | height: "600px",
|
976 | style: "dot-color",
|
977 | showPerspective: true,
|
978 | showGrid: true,
|
979 | keepAspectRatio: true,
|
980 | verticalRatio: 1.0,
|
981 | legendLabel: "distance",
|
982 | onclick: onclick,
|
983 | cameraPosition: {
|
984 | horizontal: -0.35,
|
985 | vertical: 0.22,
|
986 | distance: 1.8
|
987 | }
|
988 | };
|
989 |
|
990 | // create our graph
|
991 | var container = document.getElementById("mygraph");
|
992 | graph = new vis.Graph3d(container, data, options);
|
993 | }
|
994 |
|
995 | window.addEventListener("load", () => {
|
996 | drawVisualization();
|
997 | });
|
998 | '
|
999 | /><input
|
1000 | type="hidden"
|
1001 | name="css"
|
1002 | value="body {
|
1003 | font: 10pt arial;
|
1004 | }
|
1005 | "
|
1006 | /><input
|
1007 | type="hidden"
|
1008 | name="html"
|
1009 | value='<div id="mygraph"></div>
|
1010 |
|
1011 | <div id="info"></div>
|
1012 | '
|
1013 | /><input
|
1014 | type="hidden"
|
1015 | name="resources"
|
1016 | value="https://visjs.github.io/vis-graph3d/dist/vis-graph3d.min.js"
|
1017 | /><input type="hidden" name="wrap" value="b" /><input
|
1018 | type="hidden"
|
1019 | name="title"
|
1020 | value="Graph 3D | Cloud with Colored Dots"
|
1021 | />
|
1022 | </form>
|
1023 |
|
1024 | <form
|
1025 | action="https://codepen.io/pen/define"
|
1026 | method="post"
|
1027 | target="_blank"
|
1028 | >
|
1029 | <button class="icon codepen" alt="CodePen" title="CodePen">
|
1030 |  </button
|
1031 | ><input
|
1032 | type="hidden"
|
1033 | name="data"
|
1034 | value='{"css":"body {\n font: 10pt arial;\n}\n","css_external":"","html":"<div id=\"mygraph\"></div>\n\n<div id=\"info\"></div>\n","js":"var data = null;\nvar graph = null;\n\nfunction onclick(point) {\n console.log(point);\n}\n\n// Called when the Visualization API is loaded.\nfunction drawVisualization() {\n // create the data table.\n data = new vis.DataSet();\n\n // create some shortcuts to math functions\n var sqrt = Math.sqrt;\n var pow = Math.pow;\n var random = Math.random;\n\n // create the animation data\n var imax = 100;\n for (var i = 0; i < imax; i++) {\n var x = pow(random(), 2);\n var y = pow(random(), 2);\n var z = pow(random(), 2);\n var style =\n i % 2 == 0 ? sqrt(pow(x, 2) + pow(y, 2) + pow(z, 2)) : \"#00ffff\";\n\n data.add({ x: x, y: y, z: z, style: style });\n }\n\n // specify options\n var options = {\n width: \"600px\",\n height: \"600px\",\n style: \"dot-color\",\n showPerspective: true,\n showGrid: true,\n keepAspectRatio: true,\n verticalRatio: 1.0,\n legendLabel: \"distance\",\n onclick: onclick,\n cameraPosition: {\n horizontal: -0.35,\n vertical: 0.22,\n distance: 1.8\n }\n };\n\n // create our graph\n var container = document.getElementById(\"mygraph\");\n graph = new vis.Graph3d(container, data, options);\n}\n\nwindow.addEventListener(\"load\", () => {\n drawVisualization();\n});\n","js_external":"https://visjs.github.io/vis-graph3d/dist/vis-graph3d.min.js","title":"Graph 3D | Cloud with Colored Dots"}'
|
1035 | /><input
|
1036 | type="hidden"
|
1037 | name="js"
|
1038 | value='var data = null;
|
1039 | var graph = null;
|
1040 |
|
1041 | function onclick(point) {
|
1042 | console.log(point);
|
1043 | }
|
1044 |
|
1045 | // Called when the Visualization API is loaded.
|
1046 | function drawVisualization() {
|
1047 | // create the data table.
|
1048 | data = new vis.DataSet();
|
1049 |
|
1050 | // create some shortcuts to math functions
|
1051 | var sqrt = Math.sqrt;
|
1052 | var pow = Math.pow;
|
1053 | var random = Math.random;
|
1054 |
|
1055 | // create the animation data
|
1056 | var imax = 100;
|
1057 | for (var i = 0; i < imax; i++) {
|
1058 | var x = pow(random(), 2);
|
1059 | var y = pow(random(), 2);
|
1060 | var z = pow(random(), 2);
|
1061 | var style =
|
1062 | i % 2 == 0 ? sqrt(pow(x, 2) + pow(y, 2) + pow(z, 2)) : "#00ffff";
|
1063 |
|
1064 | data.add({ x: x, y: y, z: z, style: style });
|
1065 | }
|
1066 |
|
1067 | // specify options
|
1068 | var options = {
|
1069 | width: "600px",
|
1070 | height: "600px",
|
1071 | style: "dot-color",
|
1072 | showPerspective: true,
|
1073 | showGrid: true,
|
1074 | keepAspectRatio: true,
|
1075 | verticalRatio: 1.0,
|
1076 | legendLabel: "distance",
|
1077 | onclick: onclick,
|
1078 | cameraPosition: {
|
1079 | horizontal: -0.35,
|
1080 | vertical: 0.22,
|
1081 | distance: 1.8
|
1082 | }
|
1083 | };
|
1084 |
|
1085 | // create our graph
|
1086 | var container = document.getElementById("mygraph");
|
1087 | graph = new vis.Graph3d(container, data, options);
|
1088 | }
|
1089 |
|
1090 | window.addEventListener("load", () => {
|
1091 | drawVisualization();
|
1092 | });
|
1093 | '
|
1094 | /><input
|
1095 | type="hidden"
|
1096 | name="css"
|
1097 | value="body {
|
1098 | font: 10pt arial;
|
1099 | }
|
1100 | "
|
1101 | /><input
|
1102 | type="hidden"
|
1103 | name="html"
|
1104 | value='<div id="mygraph"></div>
|
1105 |
|
1106 | <div id="info"></div>
|
1107 | '
|
1108 | /></form
|
1109 | ></span>
|
1110 | </div>
|
1111 | <a href="graph3d/07_dot_cloud_colors.html"
|
1112 | ><div class="example-image">
|
1113 | <img
|
1114 | src="thumbnails/25be5ead5cd783a8a644a4af642714aab8e429a7a0bb08222f637c37f52336d5.png"
|
1115 | alt="Cloud with Colored Dots"
|
1116 | /></div></a></span
|
1117 | ><span class="example-link"
|
1118 | ><div>
|
1119 | <a href="graph3d/08_dot_cloud_size.html">Cloud with Sized Dots</a
|
1120 | ><span class="playgrounds"
|
1121 | ><form
|
1122 | action="http://jsfiddle.net/api/post/library/pure/"
|
1123 | method="post"
|
1124 | target="_blank"
|
1125 | >
|
1126 | <button class="icon jsfiddle" alt="JSFiddle" title="JSFiddle">
|
1127 |  </button
|
1128 | ><input
|
1129 | type="hidden"
|
1130 | name="js"
|
1131 | value='var data = null;
|
1132 | var graph = null;
|
1133 |
|
1134 | // Called when the Visualization API is loaded.
|
1135 | function drawVisualization() {
|
1136 | // create the data table.
|
1137 | data = new vis.DataSet();
|
1138 |
|
1139 | // create some shortcuts to math functions
|
1140 | var sqrt = Math.sqrt;
|
1141 | var pow = Math.pow;
|
1142 | var random = Math.random;
|
1143 |
|
1144 | // create the animation data
|
1145 | var imax = 100;
|
1146 | for (var i = 0; i < imax; i++) {
|
1147 | var x = pow(random(), 2);
|
1148 | var y = pow(random(), 2);
|
1149 | var z = pow(random(), 2);
|
1150 |
|
1151 | var dist = sqrt(pow(x, 2) + pow(y, 2) + pow(z, 2));
|
1152 | var range = sqrt(2) - dist;
|
1153 |
|
1154 | data.add({ x: x, y: y, z: z, style: range });
|
1155 | }
|
1156 |
|
1157 | // specify options
|
1158 | var options = {
|
1159 | width: "600px",
|
1160 | height: "600px",
|
1161 | style: "dot-size",
|
1162 | showPerspective: false,
|
1163 | showGrid: true,
|
1164 | keepAspectRatio: true,
|
1165 | legendLabel: "value",
|
1166 | verticalRatio: 1.0,
|
1167 | cameraPosition: {
|
1168 | horizontal: -0.54,
|
1169 | vertical: 0.5,
|
1170 | distance: 1.6
|
1171 | },
|
1172 | dotSizeMinFraction: 0.5,
|
1173 | dotSizeMaxFraction: 2.5
|
1174 | };
|
1175 |
|
1176 | // create our graph
|
1177 | var container = document.getElementById("mygraph");
|
1178 | graph = new vis.Graph3d(container, data, options);
|
1179 | }
|
1180 |
|
1181 | window.addEventListener("load", () => {
|
1182 | drawVisualization();
|
1183 | });
|
1184 | '
|
1185 | /><input
|
1186 | type="hidden"
|
1187 | name="css"
|
1188 | value="body {
|
1189 | font: 10pt arial;
|
1190 | }
|
1191 | "
|
1192 | /><input
|
1193 | type="hidden"
|
1194 | name="html"
|
1195 | value='<div id="mygraph"></div>
|
1196 |
|
1197 | <div id="info"></div>
|
1198 | '
|
1199 | /><input
|
1200 | type="hidden"
|
1201 | name="resources"
|
1202 | value="https://visjs.github.io/vis-graph3d/dist/vis-graph3d.min.js"
|
1203 | /><input type="hidden" name="wrap" value="b" /><input
|
1204 | type="hidden"
|
1205 | name="title"
|
1206 | value="Graph 3D | Cloud with Sized Dots"
|
1207 | />
|
1208 | </form>
|
1209 |
|
1210 | <form
|
1211 | action="https://codepen.io/pen/define"
|
1212 | method="post"
|
1213 | target="_blank"
|
1214 | >
|
1215 | <button class="icon codepen" alt="CodePen" title="CodePen">
|
1216 |  </button
|
1217 | ><input
|
1218 | type="hidden"
|
1219 | name="data"
|
1220 | value='{"css":"body {\n font: 10pt arial;\n}\n","css_external":"","html":"<div id=\"mygraph\"></div>\n\n<div id=\"info\"></div>\n","js":"var data = null;\nvar graph = null;\n\n// Called when the Visualization API is loaded.\nfunction drawVisualization() {\n // create the data table.\n data = new vis.DataSet();\n\n // create some shortcuts to math functions\n var sqrt = Math.sqrt;\n var pow = Math.pow;\n var random = Math.random;\n\n // create the animation data\n var imax = 100;\n for (var i = 0; i < imax; i++) {\n var x = pow(random(), 2);\n var y = pow(random(), 2);\n var z = pow(random(), 2);\n\n var dist = sqrt(pow(x, 2) + pow(y, 2) + pow(z, 2));\n var range = sqrt(2) - dist;\n\n data.add({ x: x, y: y, z: z, style: range });\n }\n\n // specify options\n var options = {\n width: \"600px\",\n height: \"600px\",\n style: \"dot-size\",\n showPerspective: false,\n showGrid: true,\n keepAspectRatio: true,\n legendLabel: \"value\",\n verticalRatio: 1.0,\n cameraPosition: {\n horizontal: -0.54,\n vertical: 0.5,\n distance: 1.6\n },\n dotSizeMinFraction: 0.5,\n dotSizeMaxFraction: 2.5\n };\n\n // create our graph\n var container = document.getElementById(\"mygraph\");\n graph = new vis.Graph3d(container, data, options);\n}\n\nwindow.addEventListener(\"load\", () => {\n drawVisualization();\n});\n","js_external":"https://visjs.github.io/vis-graph3d/dist/vis-graph3d.min.js","title":"Graph 3D | Cloud with Sized Dots"}'
|
1221 | /><input
|
1222 | type="hidden"
|
1223 | name="js"
|
1224 | value='var data = null;
|
1225 | var graph = null;
|
1226 |
|
1227 | // Called when the Visualization API is loaded.
|
1228 | function drawVisualization() {
|
1229 | // create the data table.
|
1230 | data = new vis.DataSet();
|
1231 |
|
1232 | // create some shortcuts to math functions
|
1233 | var sqrt = Math.sqrt;
|
1234 | var pow = Math.pow;
|
1235 | var random = Math.random;
|
1236 |
|
1237 | // create the animation data
|
1238 | var imax = 100;
|
1239 | for (var i = 0; i < imax; i++) {
|
1240 | var x = pow(random(), 2);
|
1241 | var y = pow(random(), 2);
|
1242 | var z = pow(random(), 2);
|
1243 |
|
1244 | var dist = sqrt(pow(x, 2) + pow(y, 2) + pow(z, 2));
|
1245 | var range = sqrt(2) - dist;
|
1246 |
|
1247 | data.add({ x: x, y: y, z: z, style: range });
|
1248 | }
|
1249 |
|
1250 | // specify options
|
1251 | var options = {
|
1252 | width: "600px",
|
1253 | height: "600px",
|
1254 | style: "dot-size",
|
1255 | showPerspective: false,
|
1256 | showGrid: true,
|
1257 | keepAspectRatio: true,
|
1258 | legendLabel: "value",
|
1259 | verticalRatio: 1.0,
|
1260 | cameraPosition: {
|
1261 | horizontal: -0.54,
|
1262 | vertical: 0.5,
|
1263 | distance: 1.6
|
1264 | },
|
1265 | dotSizeMinFraction: 0.5,
|
1266 | dotSizeMaxFraction: 2.5
|
1267 | };
|
1268 |
|
1269 | // create our graph
|
1270 | var container = document.getElementById("mygraph");
|
1271 | graph = new vis.Graph3d(container, data, options);
|
1272 | }
|
1273 |
|
1274 | window.addEventListener("load", () => {
|
1275 | drawVisualization();
|
1276 | });
|
1277 | '
|
1278 | /><input
|
1279 | type="hidden"
|
1280 | name="css"
|
1281 | value="body {
|
1282 | font: 10pt arial;
|
1283 | }
|
1284 | "
|
1285 | /><input
|
1286 | type="hidden"
|
1287 | name="html"
|
1288 | value='<div id="mygraph"></div>
|
1289 |
|
1290 | <div id="info"></div>
|
1291 | '
|
1292 | /></form
|
1293 | ></span>
|
1294 | </div>
|
1295 | <a href="graph3d/08_dot_cloud_size.html"
|
1296 | ><div class="example-image">
|
1297 | <img
|
1298 | src="thumbnails/5a02efacddb0331827ddcf2ae12052f3720c21a7506374c724150cecef901e84.png"
|
1299 | alt="Cloud with Sized Dots"
|
1300 | /></div></a></span
|
1301 | ><span class="example-link"
|
1302 | ><div>
|
1303 | <a href="graph3d/12_custom_labels.html">Custom Labels</a
|
1304 | ><span class="playgrounds"
|
1305 | ><form
|
1306 | action="http://jsfiddle.net/api/post/library/pure/"
|
1307 | method="post"
|
1308 | target="_blank"
|
1309 | >
|
1310 | <button class="icon jsfiddle" alt="JSFiddle" title="JSFiddle">
|
1311 |  </button
|
1312 | ><input
|
1313 | type="hidden"
|
1314 | name="js"
|
1315 | value='var data = null;
|
1316 | var graph = null;
|
1317 |
|
1318 | function custom(x, y) {
|
1319 | return (-Math.sin(x / Math.PI) * Math.cos(y / Math.PI) * 10 + 10) * 1000;
|
1320 | }
|
1321 |
|
1322 | // Called when the Visualization API is loaded.
|
1323 | function drawVisualization() {
|
1324 | var style = document.getElementById("style").value;
|
1325 | var withValue =
|
1326 | ["bar-color", "bar-size", "dot-size", "dot-color"].indexOf(style) != -1;
|
1327 |
|
1328 | // Create and populate a data table.
|
1329 | data = new vis.DataSet();
|
1330 |
|
1331 | // create some nice looking data with sin/cos
|
1332 | var steps = 5; // number of datapoints will be steps*steps
|
1333 | var axisMax = 10;
|
1334 | var axisStep = axisMax / steps;
|
1335 | for (var x = 0; x <= axisMax; x += axisStep) {
|
1336 | for (var y = 0; y <= axisMax; y += axisStep) {
|
1337 | var z = custom(x, y);
|
1338 | if (withValue) {
|
1339 | var value = y - x;
|
1340 | data.add({ x: x, y: y, z: z, style: value });
|
1341 | } else {
|
1342 | data.add({ x: x, y: y, z: z });
|
1343 | }
|
1344 | }
|
1345 | }
|
1346 |
|
1347 | // specify options
|
1348 | var options = {
|
1349 | width: "600px",
|
1350 | height: "600px",
|
1351 | style: style,
|
1352 | showPerspective: true,
|
1353 | showGrid: true,
|
1354 | showShadow: false,
|
1355 |
|
1356 | // Option tooltip can be true, false, or a function returning a string with HTML contents
|
1357 | //tooltip: true,
|
1358 | tooltip: function(point) {
|
1359 | // parameter point contains properties x, y, z
|
1360 | return "value: <b>" + point.z + "</b>";
|
1361 | },
|
1362 |
|
1363 | xValueLabel: function(value) {
|
1364 | return vis
|
1365 | .moment()
|
1366 | .add(value, "days")
|
1367 | .format("DD MMM");
|
1368 | },
|
1369 |
|
1370 | yValueLabel: function(value) {
|
1371 | return value * 10 + "%";
|
1372 | },
|
1373 |
|
1374 | zValueLabel: function(value) {
|
1375 | return value / 1000 + "K";
|
1376 | },
|
1377 |
|
1378 | keepAspectRatio: true,
|
1379 | verticalRatio: 0.5
|
1380 | };
|
1381 |
|
1382 | var camera = graph ? graph.getCameraPosition() : null;
|
1383 |
|
1384 | // create our graph
|
1385 | var container = document.getElementById("mygraph");
|
1386 | graph = new vis.Graph3d(container, data, options);
|
1387 |
|
1388 | if (camera) graph.setCameraPosition(camera); // restore camera position
|
1389 |
|
1390 | document.getElementById("style").onchange = drawVisualization;
|
1391 | }
|
1392 |
|
1393 | window.addEventListener("load", () => {
|
1394 | drawVisualization();
|
1395 | });
|
1396 | '
|
1397 | /><input
|
1398 | type="hidden"
|
1399 | name="css"
|
1400 | value="body {
|
1401 | font: 10pt arial;
|
1402 | }
|
1403 | "
|
1404 | /><input
|
1405 | type="hidden"
|
1406 | name="html"
|
1407 | value='<p>
|
1408 | <label for="style">
|
1409 | Style:
|
1410 | <select id="style">
|
1411 | <option value="bar">bar</option>
|
1412 | <option value="bar-color">bar-color</option>
|
1413 | <option value="bar-size">bar-size</option>
|
1414 |
|
1415 | <option value="dot">dot</option>
|
1416 | <option value="dot-line">dot-line</option>
|
1417 | <option value="dot-color">dot-color</option>
|
1418 | <option value="dot-size">dot-size</option>
|
1419 |
|
1420 | <option value="grid">grid</option>
|
1421 | <option value="line">line</option>
|
1422 | <option value="surface">surface</option>
|
1423 | </select>
|
1424 | </label>
|
1425 | </p>
|
1426 |
|
1427 | <div id="mygraph"></div>
|
1428 |
|
1429 | <div id="info"></div>
|
1430 | '
|
1431 | /><input
|
1432 | type="hidden"
|
1433 | name="resources"
|
1434 | value="https://visjs.github.io/vis-graph3d/dist/vis-graph3d.min.js"
|
1435 | /><input type="hidden" name="wrap" value="b" /><input
|
1436 | type="hidden"
|
1437 | name="title"
|
1438 | value="Graph 3D | Custom Labels"
|
1439 | />
|
1440 | </form>
|
1441 |
|
1442 | <form
|
1443 | action="https://codepen.io/pen/define"
|
1444 | method="post"
|
1445 | target="_blank"
|
1446 | >
|
1447 | <button class="icon codepen" alt="CodePen" title="CodePen">
|
1448 |  </button
|
1449 | ><input
|
1450 | type="hidden"
|
1451 | name="data"
|
1452 | value='{"css":"body {\n font: 10pt arial;\n}\n","css_external":"","html":"<p>\n <label for=\"style\">\n Style:\n <select id=\"style\">\n <option value=\"bar\">bar</option>\n <option value=\"bar-color\">bar-color</option>\n <option value=\"bar-size\">bar-size</option>\n\n <option value=\"dot\">dot</option>\n <option value=\"dot-line\">dot-line</option>\n <option value=\"dot-color\">dot-color</option>\n <option value=\"dot-size\">dot-size</option>\n\n <option value=\"grid\">grid</option>\n <option value=\"line\">line</option>\n <option value=\"surface\">surface</option>\n </select>\n </label>\n</p>\n\n<div id=\"mygraph\"></div>\n\n<div id=\"info\"></div>\n","js":"var data = null;\nvar graph = null;\n\nfunction custom(x, y) {\n return (-Math.sin(x / Math.PI) * Math.cos(y / Math.PI) * 10 + 10) * 1000;\n}\n\n// Called when the Visualization API is loaded.\nfunction drawVisualization() {\n var style = document.getElementById(\"style\").value;\n var withValue =\n [\"bar-color\", \"bar-size\", \"dot-size\", \"dot-color\"].indexOf(style) != -1;\n\n // Create and populate a data table.\n data = new vis.DataSet();\n\n // create some nice looking data with sin/cos\n var steps = 5; // number of datapoints will be steps*steps\n var axisMax = 10;\n var axisStep = axisMax / steps;\n for (var x = 0; x <= axisMax; x += axisStep) {\n for (var y = 0; y <= axisMax; y += axisStep) {\n var z = custom(x, y);\n if (withValue) {\n var value = y - x;\n data.add({ x: x, y: y, z: z, style: value });\n } else {\n data.add({ x: x, y: y, z: z });\n }\n }\n }\n\n // specify options\n var options = {\n width: \"600px\",\n height: \"600px\",\n style: style,\n showPerspective: true,\n showGrid: true,\n showShadow: false,\n\n // Option tooltip can be true, false, or a function returning a string with HTML contents\n //tooltip: true,\n tooltip: function(point) {\n // parameter point contains properties x, y, z\n return \"value: <b>\" + point.z + \"</b>\";\n },\n\n xValueLabel: function(value) {\n return vis\n .moment()\n .add(value, \"days\")\n .format(\"DD MMM\");\n },\n\n yValueLabel: function(value) {\n return value * 10 + \"%\";\n },\n\n zValueLabel: function(value) {\n return value / 1000 + \"K\";\n },\n\n keepAspectRatio: true,\n verticalRatio: 0.5\n };\n\n var camera = graph ? graph.getCameraPosition() : null;\n\n // create our graph\n var container = document.getElementById(\"mygraph\");\n graph = new vis.Graph3d(container, data, options);\n\n if (camera) graph.setCameraPosition(camera); // restore camera position\n\n document.getElementById(\"style\").onchange = drawVisualization;\n}\n\nwindow.addEventListener(\"load\", () => {\n drawVisualization();\n});\n","js_external":"https://visjs.github.io/vis-graph3d/dist/vis-graph3d.min.js","title":"Graph 3D | Custom Labels"}'
|
1453 | /><input
|
1454 | type="hidden"
|
1455 | name="js"
|
1456 | value='var data = null;
|
1457 | var graph = null;
|
1458 |
|
1459 | function custom(x, y) {
|
1460 | return (-Math.sin(x / Math.PI) * Math.cos(y / Math.PI) * 10 + 10) * 1000;
|
1461 | }
|
1462 |
|
1463 | // Called when the Visualization API is loaded.
|
1464 | function drawVisualization() {
|
1465 | var style = document.getElementById("style").value;
|
1466 | var withValue =
|
1467 | ["bar-color", "bar-size", "dot-size", "dot-color"].indexOf(style) != -1;
|
1468 |
|
1469 | // Create and populate a data table.
|
1470 | data = new vis.DataSet();
|
1471 |
|
1472 | // create some nice looking data with sin/cos
|
1473 | var steps = 5; // number of datapoints will be steps*steps
|
1474 | var axisMax = 10;
|
1475 | var axisStep = axisMax / steps;
|
1476 | for (var x = 0; x <= axisMax; x += axisStep) {
|
1477 | for (var y = 0; y <= axisMax; y += axisStep) {
|
1478 | var z = custom(x, y);
|
1479 | if (withValue) {
|
1480 | var value = y - x;
|
1481 | data.add({ x: x, y: y, z: z, style: value });
|
1482 | } else {
|
1483 | data.add({ x: x, y: y, z: z });
|
1484 | }
|
1485 | }
|
1486 | }
|
1487 |
|
1488 | // specify options
|
1489 | var options = {
|
1490 | width: "600px",
|
1491 | height: "600px",
|
1492 | style: style,
|
1493 | showPerspective: true,
|
1494 | showGrid: true,
|
1495 | showShadow: false,
|
1496 |
|
1497 | // Option tooltip can be true, false, or a function returning a string with HTML contents
|
1498 | //tooltip: true,
|
1499 | tooltip: function(point) {
|
1500 | // parameter point contains properties x, y, z
|
1501 | return "value: <b>" + point.z + "</b>";
|
1502 | },
|
1503 |
|
1504 | xValueLabel: function(value) {
|
1505 | return vis
|
1506 | .moment()
|
1507 | .add(value, "days")
|
1508 | .format("DD MMM");
|
1509 | },
|
1510 |
|
1511 | yValueLabel: function(value) {
|
1512 | return value * 10 + "%";
|
1513 | },
|
1514 |
|
1515 | zValueLabel: function(value) {
|
1516 | return value / 1000 + "K";
|
1517 | },
|
1518 |
|
1519 | keepAspectRatio: true,
|
1520 | verticalRatio: 0.5
|
1521 | };
|
1522 |
|
1523 | var camera = graph ? graph.getCameraPosition() : null;
|
1524 |
|
1525 | // create our graph
|
1526 | var container = document.getElementById("mygraph");
|
1527 | graph = new vis.Graph3d(container, data, options);
|
1528 |
|
1529 | if (camera) graph.setCameraPosition(camera); // restore camera position
|
1530 |
|
1531 | document.getElementById("style").onchange = drawVisualization;
|
1532 | }
|
1533 |
|
1534 | window.addEventListener("load", () => {
|
1535 | drawVisualization();
|
1536 | });
|
1537 | '
|
1538 | /><input
|
1539 | type="hidden"
|
1540 | name="css"
|
1541 | value="body {
|
1542 | font: 10pt arial;
|
1543 | }
|
1544 | "
|
1545 | /><input
|
1546 | type="hidden"
|
1547 | name="html"
|
1548 | value='<p>
|
1549 | <label for="style">
|
1550 | Style:
|
1551 | <select id="style">
|
1552 | <option value="bar">bar</option>
|
1553 | <option value="bar-color">bar-color</option>
|
1554 | <option value="bar-size">bar-size</option>
|
1555 |
|
1556 | <option value="dot">dot</option>
|
1557 | <option value="dot-line">dot-line</option>
|
1558 | <option value="dot-color">dot-color</option>
|
1559 | <option value="dot-size">dot-size</option>
|
1560 |
|
1561 | <option value="grid">grid</option>
|
1562 | <option value="line">line</option>
|
1563 | <option value="surface">surface</option>
|
1564 | </select>
|
1565 | </label>
|
1566 | </p>
|
1567 |
|
1568 | <div id="mygraph"></div>
|
1569 |
|
1570 | <div id="info"></div>
|
1571 | '
|
1572 | /></form
|
1573 | ></span>
|
1574 | </div>
|
1575 | <a href="graph3d/12_custom_labels.html"
|
1576 | ><div class="example-image">
|
1577 | <img
|
1578 | src="thumbnails/f7c986763a1b0d76c35e782613d4c2255682de3477eac7ade789091dc243bc17.png"
|
1579 | alt="Custom Labels"
|
1580 | /></div></a></span
|
1581 | ><span class="example-link"
|
1582 | ><div>
|
1583 | <a href="graph3d/13_disable_zoom.html">Disable Zoom</a
|
1584 | ><span class="playgrounds"
|
1585 | ><form
|
1586 | action="http://jsfiddle.net/api/post/library/pure/"
|
1587 | method="post"
|
1588 | target="_blank"
|
1589 | >
|
1590 | <button class="icon jsfiddle" alt="JSFiddle" title="JSFiddle">
|
1591 |  </button
|
1592 | ><input
|
1593 | type="hidden"
|
1594 | name="js"
|
1595 | value='var data = null;
|
1596 | var graph = null;
|
1597 |
|
1598 | function custom(x, y) {
|
1599 | return Math.sin(x / 50) * Math.cos(y / 50) * 50 + 50;
|
1600 | }
|
1601 |
|
1602 | // Called when the Visualization API is loaded.
|
1603 | function drawVisualization() {
|
1604 | // Create and populate a data table.
|
1605 | data = new vis.DataSet();
|
1606 | // create some nice looking data with sin/cos
|
1607 | var counter = 0;
|
1608 | var steps = 50; // number of datapoints will be steps*steps
|
1609 | var axisMax = 314;
|
1610 | var axisStep = axisMax / steps;
|
1611 | for (var x = 0; x < axisMax; x += axisStep) {
|
1612 | for (var y = 0; y < axisMax; y += axisStep) {
|
1613 | var value = custom(x, y);
|
1614 | data.add({ id: counter++, x: x, y: y, z: value, style: value });
|
1615 | }
|
1616 | }
|
1617 |
|
1618 | // specify options
|
1619 | var options = {
|
1620 | width: "600px",
|
1621 | height: "600px",
|
1622 | style: "surface",
|
1623 | showPerspective: true,
|
1624 | showGrid: true,
|
1625 | showShadow: false,
|
1626 | keepAspectRatio: true,
|
1627 | verticalRatio: 0.5,
|
1628 | zoomable: false
|
1629 | };
|
1630 |
|
1631 | // Instantiate our graph object.
|
1632 | var container = document.getElementById("mygraph");
|
1633 | graph = new vis.Graph3d(container, data, options);
|
1634 | }
|
1635 |
|
1636 | window.addEventListener("load", () => {
|
1637 | drawVisualization();
|
1638 | });
|
1639 | '
|
1640 | /><input
|
1641 | type="hidden"
|
1642 | name="css"
|
1643 | value="body {
|
1644 | font: 10pt arial;
|
1645 | }
|
1646 | "
|
1647 | /><input
|
1648 | type="hidden"
|
1649 | name="html"
|
1650 | value='<div id="mygraph"></div>
|
1651 |
|
1652 | <div id="info"></div>
|
1653 | '
|
1654 | /><input
|
1655 | type="hidden"
|
1656 | name="resources"
|
1657 | value="https://visjs.github.io/vis-graph3d/dist/vis-graph3d.min.js"
|
1658 | /><input type="hidden" name="wrap" value="b" /><input
|
1659 | type="hidden"
|
1660 | name="title"
|
1661 | value="Graph 3D | Disable Zoom"
|
1662 | />
|
1663 | </form>
|
1664 |
|
1665 | <form
|
1666 | action="https://codepen.io/pen/define"
|
1667 | method="post"
|
1668 | target="_blank"
|
1669 | >
|
1670 | <button class="icon codepen" alt="CodePen" title="CodePen">
|
1671 |  </button
|
1672 | ><input
|
1673 | type="hidden"
|
1674 | name="data"
|
1675 | value='{"css":"body {\n font: 10pt arial;\n}\n","css_external":"","html":"<div id=\"mygraph\"></div>\n\n<div id=\"info\"></div>\n","js":"var data = null;\nvar graph = null;\n\nfunction custom(x, y) {\n return Math.sin(x / 50) * Math.cos(y / 50) * 50 + 50;\n}\n\n// Called when the Visualization API is loaded.\nfunction drawVisualization() {\n // Create and populate a data table.\n data = new vis.DataSet();\n // create some nice looking data with sin/cos\n var counter = 0;\n var steps = 50; // number of datapoints will be steps*steps\n var axisMax = 314;\n var axisStep = axisMax / steps;\n for (var x = 0; x < axisMax; x += axisStep) {\n for (var y = 0; y < axisMax; y += axisStep) {\n var value = custom(x, y);\n data.add({ id: counter++, x: x, y: y, z: value, style: value });\n }\n }\n\n // specify options\n var options = {\n width: \"600px\",\n height: \"600px\",\n style: \"surface\",\n showPerspective: true,\n showGrid: true,\n showShadow: false,\n keepAspectRatio: true,\n verticalRatio: 0.5,\n zoomable: false\n };\n\n // Instantiate our graph object.\n var container = document.getElementById(\"mygraph\");\n graph = new vis.Graph3d(container, data, options);\n}\n\nwindow.addEventListener(\"load\", () => {\n drawVisualization();\n});\n","js_external":"https://visjs.github.io/vis-graph3d/dist/vis-graph3d.min.js","title":"Graph 3D | Disable Zoom"}'
|
1676 | /><input
|
1677 | type="hidden"
|
1678 | name="js"
|
1679 | value='var data = null;
|
1680 | var graph = null;
|
1681 |
|
1682 | function custom(x, y) {
|
1683 | return Math.sin(x / 50) * Math.cos(y / 50) * 50 + 50;
|
1684 | }
|
1685 |
|
1686 | // Called when the Visualization API is loaded.
|
1687 | function drawVisualization() {
|
1688 | // Create and populate a data table.
|
1689 | data = new vis.DataSet();
|
1690 | // create some nice looking data with sin/cos
|
1691 | var counter = 0;
|
1692 | var steps = 50; // number of datapoints will be steps*steps
|
1693 | var axisMax = 314;
|
1694 | var axisStep = axisMax / steps;
|
1695 | for (var x = 0; x < axisMax; x += axisStep) {
|
1696 | for (var y = 0; y < axisMax; y += axisStep) {
|
1697 | var value = custom(x, y);
|
1698 | data.add({ id: counter++, x: x, y: y, z: value, style: value });
|
1699 | }
|
1700 | }
|
1701 |
|
1702 | // specify options
|
1703 | var options = {
|
1704 | width: "600px",
|
1705 | height: "600px",
|
1706 | style: "surface",
|
1707 | showPerspective: true,
|
1708 | showGrid: true,
|
1709 | showShadow: false,
|
1710 | keepAspectRatio: true,
|
1711 | verticalRatio: 0.5,
|
1712 | zoomable: false
|
1713 | };
|
1714 |
|
1715 | // Instantiate our graph object.
|
1716 | var container = document.getElementById("mygraph");
|
1717 | graph = new vis.Graph3d(container, data, options);
|
1718 | }
|
1719 |
|
1720 | window.addEventListener("load", () => {
|
1721 | drawVisualization();
|
1722 | });
|
1723 | '
|
1724 | /><input
|
1725 | type="hidden"
|
1726 | name="css"
|
1727 | value="body {
|
1728 | font: 10pt arial;
|
1729 | }
|
1730 | "
|
1731 | /><input
|
1732 | type="hidden"
|
1733 | name="html"
|
1734 | value='<div id="mygraph"></div>
|
1735 |
|
1736 | <div id="info"></div>
|
1737 | '
|
1738 | /></form
|
1739 | ></span>
|
1740 | </div>
|
1741 | <a href="graph3d/13_disable_zoom.html"
|
1742 | ><div class="example-image">
|
1743 | <img
|
1744 | src="thumbnails/ca22cb74e9f0c43b4a07bac1b0389e3e16082cfd3c6589d87bd7492c2107bcb6.png"
|
1745 | alt="Disable Zoom"
|
1746 | /></div></a></span
|
1747 | ><span class="example-link"
|
1748 | ><div>
|
1749 | <a href="graph3d/03_filter_data.html">Filter Data</a
|
1750 | ><span class="playgrounds"
|
1751 | ><form
|
1752 | action="http://jsfiddle.net/api/post/library/pure/"
|
1753 | method="post"
|
1754 | target="_blank"
|
1755 | >
|
1756 | <button class="icon jsfiddle" alt="JSFiddle" title="JSFiddle">
|
1757 |  </button
|
1758 | ><input
|
1759 | type="hidden"
|
1760 | name="js"
|
1761 | value='var data = null;
|
1762 | var graph = null;
|
1763 |
|
1764 | function custom(x, y) {
|
1765 | return Math.sin(x / 50) * Math.cos(y / 50) * 50 + 50;
|
1766 | }
|
1767 |
|
1768 | // Called when the Visualization API is loaded.
|
1769 | function drawVisualization() {
|
1770 | // Create and populate a data table.
|
1771 | data = [];
|
1772 | // create some nice looking data with sin/cos
|
1773 | var steps = 50; // number of datapoints will be steps*steps
|
1774 | var axisMax = 314;
|
1775 | var axisStep = axisMax / steps;
|
1776 | for (var x = 0; x < axisMax; x += axisStep) {
|
1777 | for (var y = 0; y < axisMax; y += axisStep) {
|
1778 | var value = custom(x, y);
|
1779 | var valueRange = value > 67 ? "67-100" : value < 33 ? "0-33" : "33-67";
|
1780 | data.push({ x: x, y: y, z: value, filter: valueRange, style: value });
|
1781 | }
|
1782 | }
|
1783 |
|
1784 | // specify options
|
1785 | var options = {
|
1786 | width: "600px",
|
1787 | height: "600px",
|
1788 | style: "surface",
|
1789 | showPerspective: false,
|
1790 | showGrid: true,
|
1791 | showShadow: false,
|
1792 | keepAspectRatio: true,
|
1793 | verticalRatio: 0.5,
|
1794 | filterLabel: "values"
|
1795 | };
|
1796 |
|
1797 | // Create our graph
|
1798 | var container = document.getElementById("mygraph");
|
1799 | graph = new vis.Graph3d(container, data, options);
|
1800 | }
|
1801 |
|
1802 | window.addEventListener("load", () => {
|
1803 | drawVisualization();
|
1804 | });
|
1805 | '
|
1806 | /><input
|
1807 | type="hidden"
|
1808 | name="css"
|
1809 | value="body {
|
1810 | font: 10pt arial;
|
1811 | }
|
1812 | "
|
1813 | /><input
|
1814 | type="hidden"
|
1815 | name="html"
|
1816 | value='<div id="mygraph"></div>
|
1817 |
|
1818 | <div id="info"></div>
|
1819 | '
|
1820 | /><input
|
1821 | type="hidden"
|
1822 | name="resources"
|
1823 | value="https://visjs.github.io/vis-graph3d/dist/vis-graph3d.min.js"
|
1824 | /><input type="hidden" name="wrap" value="b" /><input
|
1825 | type="hidden"
|
1826 | name="title"
|
1827 | value="Graph 3D | Filter Data"
|
1828 | />
|
1829 | </form>
|
1830 |
|
1831 | <form
|
1832 | action="https://codepen.io/pen/define"
|
1833 | method="post"
|
1834 | target="_blank"
|
1835 | >
|
1836 | <button class="icon codepen" alt="CodePen" title="CodePen">
|
1837 |  </button
|
1838 | ><input
|
1839 | type="hidden"
|
1840 | name="data"
|
1841 | value='{"css":"body {\n font: 10pt arial;\n}\n","css_external":"","html":"<div id=\"mygraph\"></div>\n\n<div id=\"info\"></div>\n","js":"var data = null;\nvar graph = null;\n\nfunction custom(x, y) {\n return Math.sin(x / 50) * Math.cos(y / 50) * 50 + 50;\n}\n\n// Called when the Visualization API is loaded.\nfunction drawVisualization() {\n // Create and populate a data table.\n data = [];\n // create some nice looking data with sin/cos\n var steps = 50; // number of datapoints will be steps*steps\n var axisMax = 314;\n var axisStep = axisMax / steps;\n for (var x = 0; x < axisMax; x += axisStep) {\n for (var y = 0; y < axisMax; y += axisStep) {\n var value = custom(x, y);\n var valueRange = value > 67 ? \"67-100\" : value < 33 ? \"0-33\" : \"33-67\";\n data.push({ x: x, y: y, z: value, filter: valueRange, style: value });\n }\n }\n\n // specify options\n var options = {\n width: \"600px\",\n height: \"600px\",\n style: \"surface\",\n showPerspective: false,\n showGrid: true,\n showShadow: false,\n keepAspectRatio: true,\n verticalRatio: 0.5,\n filterLabel: \"values\"\n };\n\n // Create our graph\n var container = document.getElementById(\"mygraph\");\n graph = new vis.Graph3d(container, data, options);\n}\n\nwindow.addEventListener(\"load\", () => {\n drawVisualization();\n});\n","js_external":"https://visjs.github.io/vis-graph3d/dist/vis-graph3d.min.js","title":"Graph 3D | Filter Data"}'
|
1842 | /><input
|
1843 | type="hidden"
|
1844 | name="js"
|
1845 | value='var data = null;
|
1846 | var graph = null;
|
1847 |
|
1848 | function custom(x, y) {
|
1849 | return Math.sin(x / 50) * Math.cos(y / 50) * 50 + 50;
|
1850 | }
|
1851 |
|
1852 | // Called when the Visualization API is loaded.
|
1853 | function drawVisualization() {
|
1854 | // Create and populate a data table.
|
1855 | data = [];
|
1856 | // create some nice looking data with sin/cos
|
1857 | var steps = 50; // number of datapoints will be steps*steps
|
1858 | var axisMax = 314;
|
1859 | var axisStep = axisMax / steps;
|
1860 | for (var x = 0; x < axisMax; x += axisStep) {
|
1861 | for (var y = 0; y < axisMax; y += axisStep) {
|
1862 | var value = custom(x, y);
|
1863 | var valueRange = value > 67 ? "67-100" : value < 33 ? "0-33" : "33-67";
|
1864 | data.push({ x: x, y: y, z: value, filter: valueRange, style: value });
|
1865 | }
|
1866 | }
|
1867 |
|
1868 | // specify options
|
1869 | var options = {
|
1870 | width: "600px",
|
1871 | height: "600px",
|
1872 | style: "surface",
|
1873 | showPerspective: false,
|
1874 | showGrid: true,
|
1875 | showShadow: false,
|
1876 | keepAspectRatio: true,
|
1877 | verticalRatio: 0.5,
|
1878 | filterLabel: "values"
|
1879 | };
|
1880 |
|
1881 | // Create our graph
|
1882 | var container = document.getElementById("mygraph");
|
1883 | graph = new vis.Graph3d(container, data, options);
|
1884 | }
|
1885 |
|
1886 | window.addEventListener("load", () => {
|
1887 | drawVisualization();
|
1888 | });
|
1889 | '
|
1890 | /><input
|
1891 | type="hidden"
|
1892 | name="css"
|
1893 | value="body {
|
1894 | font: 10pt arial;
|
1895 | }
|
1896 | "
|
1897 | /><input
|
1898 | type="hidden"
|
1899 | name="html"
|
1900 | value='<div id="mygraph"></div>
|
1901 |
|
1902 | <div id="info"></div>
|
1903 | '
|
1904 | /></form
|
1905 | ></span>
|
1906 | </div>
|
1907 | <a href="graph3d/03_filter_data.html"
|
1908 | ><div class="example-image">
|
1909 | <img
|
1910 | src="thumbnails/2fa5fd611006cb869a8a54e40a30bb3258eb46541b3530aaf0757dcc15513a18.png"
|
1911 | alt="Filter Data"
|
1912 | /></div></a></span
|
1913 | ><span class="example-link"
|
1914 | ><div>
|
1915 | <a href="graph3d/05_line.html">Line</a
|
1916 | ><span class="playgrounds"
|
1917 | ><form
|
1918 | action="http://jsfiddle.net/api/post/library/pure/"
|
1919 | method="post"
|
1920 | target="_blank"
|
1921 | >
|
1922 | <button class="icon jsfiddle" alt="JSFiddle" title="JSFiddle">
|
1923 |  </button
|
1924 | ><input
|
1925 | type="hidden"
|
1926 | name="js"
|
1927 | value='var data = null;
|
1928 | var graph = null;
|
1929 |
|
1930 | // Called when the Visualization API is loaded.
|
1931 | function drawVisualization() {
|
1932 | // Create and populate a data table.
|
1933 | data = new vis.DataSet();
|
1934 |
|
1935 | // create some nice looking data with sin/cos
|
1936 | var steps = 500;
|
1937 | var axisMax = 314;
|
1938 | var tmax = 4 * 2 * Math.PI;
|
1939 | var axisStep = axisMax / steps;
|
1940 | for (var t = 0; t < tmax; t += tmax / steps) {
|
1941 | var r = 1;
|
1942 | var x = r * Math.sin(t);
|
1943 | var y = r * Math.cos(t);
|
1944 | var z = t / tmax;
|
1945 | data.add({ x: x, y: y, z: z });
|
1946 | }
|
1947 |
|
1948 | // specify options
|
1949 | var options = {
|
1950 | width: "600px",
|
1951 | height: "600px",
|
1952 | style: "line",
|
1953 | showPerspective: false,
|
1954 | showGrid: true,
|
1955 | keepAspectRatio: true,
|
1956 | verticalRatio: 1.0
|
1957 | };
|
1958 |
|
1959 | // create our graph
|
1960 | var container = document.getElementById("mygraph");
|
1961 | graph = new vis.Graph3d(container, data, options);
|
1962 |
|
1963 | graph.setCameraPosition(0.4, undefined, undefined);
|
1964 | }
|
1965 |
|
1966 | window.addEventListener("load", () => {
|
1967 | drawVisualization();
|
1968 | });
|
1969 | '
|
1970 | /><input
|
1971 | type="hidden"
|
1972 | name="css"
|
1973 | value="body {
|
1974 | font: 10pt arial;
|
1975 | }
|
1976 | "
|
1977 | /><input
|
1978 | type="hidden"
|
1979 | name="html"
|
1980 | value='<div id="mygraph"></div>
|
1981 |
|
1982 | <div id="info"></div>
|
1983 | '
|
1984 | /><input
|
1985 | type="hidden"
|
1986 | name="resources"
|
1987 | value="https://visjs.github.io/vis-graph3d/dist/vis-graph3d.min.js"
|
1988 | /><input type="hidden" name="wrap" value="b" /><input
|
1989 | type="hidden"
|
1990 | name="title"
|
1991 | value="Graph 3D | Line"
|
1992 | />
|
1993 | </form>
|
1994 |
|
1995 | <form
|
1996 | action="https://codepen.io/pen/define"
|
1997 | method="post"
|
1998 | target="_blank"
|
1999 | >
|
2000 | <button class="icon codepen" alt="CodePen" title="CodePen">
|
2001 |  </button
|
2002 | ><input
|
2003 | type="hidden"
|
2004 | name="data"
|
2005 | value='{"css":"body {\n font: 10pt arial;\n}\n","css_external":"","html":"<div id=\"mygraph\"></div>\n\n<div id=\"info\"></div>\n","js":"var data = null;\nvar graph = null;\n\n// Called when the Visualization API is loaded.\nfunction drawVisualization() {\n // Create and populate a data table.\n data = new vis.DataSet();\n\n // create some nice looking data with sin/cos\n var steps = 500;\n var axisMax = 314;\n var tmax = 4 * 2 * Math.PI;\n var axisStep = axisMax / steps;\n for (var t = 0; t < tmax; t += tmax / steps) {\n var r = 1;\n var x = r * Math.sin(t);\n var y = r * Math.cos(t);\n var z = t / tmax;\n data.add({ x: x, y: y, z: z });\n }\n\n // specify options\n var options = {\n width: \"600px\",\n height: \"600px\",\n style: \"line\",\n showPerspective: false,\n showGrid: true,\n keepAspectRatio: true,\n verticalRatio: 1.0\n };\n\n // create our graph\n var container = document.getElementById(\"mygraph\");\n graph = new vis.Graph3d(container, data, options);\n\n graph.setCameraPosition(0.4, undefined, undefined);\n}\n\nwindow.addEventListener(\"load\", () => {\n drawVisualization();\n});\n","js_external":"https://visjs.github.io/vis-graph3d/dist/vis-graph3d.min.js","title":"Graph 3D | Line"}'
|
2006 | /><input
|
2007 | type="hidden"
|
2008 | name="js"
|
2009 | value='var data = null;
|
2010 | var graph = null;
|
2011 |
|
2012 | // Called when the Visualization API is loaded.
|
2013 | function drawVisualization() {
|
2014 | // Create and populate a data table.
|
2015 | data = new vis.DataSet();
|
2016 |
|
2017 | // create some nice looking data with sin/cos
|
2018 | var steps = 500;
|
2019 | var axisMax = 314;
|
2020 | var tmax = 4 * 2 * Math.PI;
|
2021 | var axisStep = axisMax / steps;
|
2022 | for (var t = 0; t < tmax; t += tmax / steps) {
|
2023 | var r = 1;
|
2024 | var x = r * Math.sin(t);
|
2025 | var y = r * Math.cos(t);
|
2026 | var z = t / tmax;
|
2027 | data.add({ x: x, y: y, z: z });
|
2028 | }
|
2029 |
|
2030 | // specify options
|
2031 | var options = {
|
2032 | width: "600px",
|
2033 | height: "600px",
|
2034 | style: "line",
|
2035 | showPerspective: false,
|
2036 | showGrid: true,
|
2037 | keepAspectRatio: true,
|
2038 | verticalRatio: 1.0
|
2039 | };
|
2040 |
|
2041 | // create our graph
|
2042 | var container = document.getElementById("mygraph");
|
2043 | graph = new vis.Graph3d(container, data, options);
|
2044 |
|
2045 | graph.setCameraPosition(0.4, undefined, undefined);
|
2046 | }
|
2047 |
|
2048 | window.addEventListener("load", () => {
|
2049 | drawVisualization();
|
2050 | });
|
2051 | '
|
2052 | /><input
|
2053 | type="hidden"
|
2054 | name="css"
|
2055 | value="body {
|
2056 | font: 10pt arial;
|
2057 | }
|
2058 | "
|
2059 | /><input
|
2060 | type="hidden"
|
2061 | name="html"
|
2062 | value='<div id="mygraph"></div>
|
2063 |
|
2064 | <div id="info"></div>
|
2065 | '
|
2066 | /></form
|
2067 | ></span>
|
2068 | </div>
|
2069 | <a href="graph3d/05_line.html"
|
2070 | ><div class="example-image">
|
2071 | <img
|
2072 | src="thumbnails/f5e35d3448f335732af70475c293466677d5806da60c96df9173da7312dcfcff.png"
|
2073 | alt="Line"
|
2074 | /></div></a></span
|
2075 | ><span class="example-link"
|
2076 | ><div>
|
2077 | <a href="graph3d/09_mobile.html">Mobile</a
|
2078 | ><span class="playgrounds"
|
2079 | ><form
|
2080 | action="http://jsfiddle.net/api/post/library/pure/"
|
2081 | method="post"
|
2082 | target="_blank"
|
2083 | >
|
2084 | <button class="icon jsfiddle" alt="JSFiddle" title="JSFiddle">
|
2085 |  </button
|
2086 | ><input
|
2087 | type="hidden"
|
2088 | name="js"
|
2089 | value='var data = null;
|
2090 | var graph = null;
|
2091 |
|
2092 | function custom(x, y) {
|
2093 | return Math.sin(x / 50) * Math.cos(y / 50) * 50 + 50;
|
2094 | }
|
2095 |
|
2096 | // Called when the Visualization API is loaded.
|
2097 | function drawVisualization() {
|
2098 | // Create and populate a data table.
|
2099 | data = new vis.DataSet();
|
2100 |
|
2101 | // create some nice looking data with sin/cos
|
2102 | var steps = 10; // number of datapoints will be steps*steps
|
2103 | var axisMax = 314;
|
2104 | var axisStep = axisMax / steps;
|
2105 | for (var x = 0; x < axisMax; x += axisStep) {
|
2106 | for (var y = 0; y < axisMax; y += axisStep) {
|
2107 | var value = custom(x, y);
|
2108 | data.add([{ x: x, y: y, z: value }]);
|
2109 | }
|
2110 | }
|
2111 |
|
2112 | // specify options
|
2113 | var options = {
|
2114 | width: "100%",
|
2115 | height: "100%",
|
2116 | style: "surface",
|
2117 | showPerspective: true,
|
2118 | showGrid: true,
|
2119 | showShadow: false,
|
2120 | keepAspectRatio: true,
|
2121 | verticalRatio: 0.5,
|
2122 | backgroundColor: {
|
2123 | strokeWidth: 0
|
2124 | }
|
2125 | };
|
2126 |
|
2127 | // create our graph
|
2128 | var container = document.getElementById("mygraph");
|
2129 | graph = new vis.Graph3d(container, data, options);
|
2130 | }
|
2131 |
|
2132 | window.addEventListener("resize", () => {
|
2133 | graph.redraw();
|
2134 | });
|
2135 | window.addEventListener("load", () => {
|
2136 | drawVisualization();
|
2137 | });
|
2138 | '
|
2139 | /><input
|
2140 | type="hidden"
|
2141 | name="css"
|
2142 | value="html,
|
2143 | body {
|
2144 | font: 10pt arial;
|
2145 | padding: 0;
|
2146 | margin: 0;
|
2147 | width: 100%;
|
2148 | height: 100%;
|
2149 | }
|
2150 |
|
2151 | #mygraph {
|
2152 | position: absolute;
|
2153 | width: 100%;
|
2154 | height: 100%;
|
2155 | }
|
2156 | "
|
2157 | /><input
|
2158 | type="hidden"
|
2159 | name="html"
|
2160 | value='<div id="mygraph"></div>
|
2161 | '
|
2162 | /><input
|
2163 | type="hidden"
|
2164 | name="resources"
|
2165 | value="https://visjs.github.io/vis-graph3d/dist/vis-graph3d.min.js"
|
2166 | /><input type="hidden" name="wrap" value="b" /><input
|
2167 | type="hidden"
|
2168 | name="title"
|
2169 | value="Graph 3D | Mobile"
|
2170 | />
|
2171 | </form>
|
2172 |
|
2173 | <form
|
2174 | action="https://codepen.io/pen/define"
|
2175 | method="post"
|
2176 | target="_blank"
|
2177 | >
|
2178 | <button class="icon codepen" alt="CodePen" title="CodePen">
|
2179 |  </button
|
2180 | ><input
|
2181 | type="hidden"
|
2182 | name="data"
|
2183 | value='{"css":"html,\nbody {\n font: 10pt arial;\n padding: 0;\n margin: 0;\n width: 100%;\n height: 100%;\n}\n\n#mygraph {\n position: absolute;\n width: 100%;\n height: 100%;\n}\n","css_external":"","html":"<div id=\"mygraph\"></div>\n","js":"var data = null;\nvar graph = null;\n\nfunction custom(x, y) {\n return Math.sin(x / 50) * Math.cos(y / 50) * 50 + 50;\n}\n\n// Called when the Visualization API is loaded.\nfunction drawVisualization() {\n // Create and populate a data table.\n data = new vis.DataSet();\n\n // create some nice looking data with sin/cos\n var steps = 10; // number of datapoints will be steps*steps\n var axisMax = 314;\n var axisStep = axisMax / steps;\n for (var x = 0; x < axisMax; x += axisStep) {\n for (var y = 0; y < axisMax; y += axisStep) {\n var value = custom(x, y);\n data.add([{ x: x, y: y, z: value }]);\n }\n }\n\n // specify options\n var options = {\n width: \"100%\",\n height: \"100%\",\n style: \"surface\",\n showPerspective: true,\n showGrid: true,\n showShadow: false,\n keepAspectRatio: true,\n verticalRatio: 0.5,\n backgroundColor: {\n strokeWidth: 0\n }\n };\n\n // create our graph\n var container = document.getElementById(\"mygraph\");\n graph = new vis.Graph3d(container, data, options);\n}\n\nwindow.addEventListener(\"resize\", () => {\n graph.redraw();\n});\nwindow.addEventListener(\"load\", () => {\n drawVisualization();\n});\n","js_external":"https://visjs.github.io/vis-graph3d/dist/vis-graph3d.min.js","title":"Graph 3D | Mobile"}'
|
2184 | /><input
|
2185 | type="hidden"
|
2186 | name="js"
|
2187 | value='var data = null;
|
2188 | var graph = null;
|
2189 |
|
2190 | function custom(x, y) {
|
2191 | return Math.sin(x / 50) * Math.cos(y / 50) * 50 + 50;
|
2192 | }
|
2193 |
|
2194 | // Called when the Visualization API is loaded.
|
2195 | function drawVisualization() {
|
2196 | // Create and populate a data table.
|
2197 | data = new vis.DataSet();
|
2198 |
|
2199 | // create some nice looking data with sin/cos
|
2200 | var steps = 10; // number of datapoints will be steps*steps
|
2201 | var axisMax = 314;
|
2202 | var axisStep = axisMax / steps;
|
2203 | for (var x = 0; x < axisMax; x += axisStep) {
|
2204 | for (var y = 0; y < axisMax; y += axisStep) {
|
2205 | var value = custom(x, y);
|
2206 | data.add([{ x: x, y: y, z: value }]);
|
2207 | }
|
2208 | }
|
2209 |
|
2210 | // specify options
|
2211 | var options = {
|
2212 | width: "100%",
|
2213 | height: "100%",
|
2214 | style: "surface",
|
2215 | showPerspective: true,
|
2216 | showGrid: true,
|
2217 | showShadow: false,
|
2218 | keepAspectRatio: true,
|
2219 | verticalRatio: 0.5,
|
2220 | backgroundColor: {
|
2221 | strokeWidth: 0
|
2222 | }
|
2223 | };
|
2224 |
|
2225 | // create our graph
|
2226 | var container = document.getElementById("mygraph");
|
2227 | graph = new vis.Graph3d(container, data, options);
|
2228 | }
|
2229 |
|
2230 | window.addEventListener("resize", () => {
|
2231 | graph.redraw();
|
2232 | });
|
2233 | window.addEventListener("load", () => {
|
2234 | drawVisualization();
|
2235 | });
|
2236 | '
|
2237 | /><input
|
2238 | type="hidden"
|
2239 | name="css"
|
2240 | value="html,
|
2241 | body {
|
2242 | font: 10pt arial;
|
2243 | padding: 0;
|
2244 | margin: 0;
|
2245 | width: 100%;
|
2246 | height: 100%;
|
2247 | }
|
2248 |
|
2249 | #mygraph {
|
2250 | position: absolute;
|
2251 | width: 100%;
|
2252 | height: 100%;
|
2253 | }
|
2254 | "
|
2255 | /><input
|
2256 | type="hidden"
|
2257 | name="html"
|
2258 | value='<div id="mygraph"></div>
|
2259 | '
|
2260 | /></form
|
2261 | ></span>
|
2262 | </div>
|
2263 | <a href="graph3d/09_mobile.html"
|
2264 | ><div class="example-image">
|
2265 | <img
|
2266 | src="thumbnails/4fb6e1185e7f4ae7392babb7ce8c11b5b6baaeb839ef9f9a655f309dde4b234a.png"
|
2267 | alt="Mobile"
|
2268 | /></div></a></span
|
2269 | ><span class="example-link"
|
2270 | ><div>
|
2271 | <a href="graph3d/playground/index.html">Playground</a
|
2272 | ><span class="playgrounds"
|
2273 | ><form
|
2274 | action="http://jsfiddle.net/api/post/library/pure/"
|
2275 | method="post"
|
2276 | target="_blank"
|
2277 | >
|
2278 | <button class="icon jsfiddle" alt="JSFiddle" title="JSFiddle">
|
2279 |  </button
|
2280 | ><input
|
2281 | type="hidden"
|
2282 | name="js"
|
2283 | value='// Called when the Visualization API is loaded.
|
2284 | function drawVisualization() {
|
2285 | // TODO
|
2286 | }
|
2287 |
|
2288 | window.addEventListener("load", () => {
|
2289 | load();
|
2290 | });
|
2291 | '
|
2292 | /><input type="hidden" name="css" value /><input
|
2293 | type="hidden"
|
2294 | name="html"
|
2295 | value='<h1>Graph 3D - Playground</h1>
|
2296 |
|
2297 | <table style="width:100%;">
|
2298 | <colgroup>
|
2299 | <col width="50%" />
|
2300 | <col width="50%" />
|
2301 | </colgroup>
|
2302 | <tbody>
|
2303 | <tr>
|
2304 | <td>
|
2305 | <h2>Data</h2>
|
2306 | <p>
|
2307 | Graph 3D expects a data table with first three to five columns: colums
|
2308 | <code>x</code>, <code>y</code>, <code>z</code> (optional),
|
2309 | <code>style</code>, <code>filter</code> (optional).
|
2310 | </p>
|
2311 |
|
2312 | <table>
|
2313 | <tbody>
|
2314 | <tr>
|
2315 | <td style="white-space: nowrap">
|
2316 | <input
|
2317 | type="radio"
|
2318 | name="datatype"
|
2319 | id="datatypeCsv"
|
2320 | onclick="selectDataType();"
|
2321 | checked
|
2322 | value="csv"
|
2323 | />Csv
|
2324 | </td>
|
2325 | <td>
|
2326 | <div id="csv">
|
2327 | <textarea id="csvTextarea"></textarea>
|
2328 | <p>
|
2329 | <a
|
2330 | href="javascript: loadCsvExample();"
|
2331 | title="Load an example"
|
2332 | >Simple example</a
|
2333 | >
|
2334 | <a
|
2335 | href="javascript: loadCsvLineExample();"
|
2336 | title="Load an example"
|
2337 | >Line example</a
|
2338 | >
|
2339 | <a
|
2340 | href="javascript: loadCsvAnimationExample();"
|
2341 | title="Load an example"
|
2342 | >Animation example</a
|
2343 | >
|
2344 | <a
|
2345 | href="javascript: loadCsvMovingDotsExample();"
|
2346 | title="Load an example"
|
2347 | >Moving dots example</a
|
2348 | >
|
2349 | <a
|
2350 | href="javascript: loadCsvColoredDotsExample();"
|
2351 | title="Load an example"
|
2352 | >Colored dots example</a
|
2353 | >
|
2354 | <a
|
2355 | href="javascript: loadCsvSizedDotsExample();"
|
2356 | title="Load an example"
|
2357 | >Sized dots example</a
|
2358 | >
|
2359 | </p>
|
2360 | </div>
|
2361 | </td>
|
2362 | </tr>
|
2363 | <!-- TODO: add JSON examples -->
|
2364 | </tbody>
|
2365 | </table>
|
2366 |
|
2367 | <br />
|
2368 | </td>
|
2369 | <td rowspan="2">
|
2370 | <h2>Graph</h2>
|
2371 | <p>
|
2372 | <input type="button" value="Draw graph" onclick="draw();" id="draw" />
|
2373 | </p>
|
2374 |
|
2375 | <div id="mygraph"></div>
|
2376 | </td>
|
2377 | </tr>
|
2378 | <tr>
|
2379 | <td>
|
2380 | <h2>Options</h2>
|
2381 |
|
2382 | <table>
|
2383 | <tbody>
|
2384 | <tr>
|
2385 | <th>Option</th>
|
2386 | <th>Value</th>
|
2387 | </tr>
|
2388 |
|
2389 | <tr>
|
2390 | <td>width</td>
|
2391 | <td>
|
2392 | <input type="text" id="width" value="100%" />
|
2393 | <span class="info"
|
2394 | >for example &quot;500px&quot; or &quot;100%&quot;</span
|
2395 | >
|
2396 | </td>
|
2397 | </tr>
|
2398 | <tr>
|
2399 | <td>height</td>
|
2400 | <td>
|
2401 | <input type="text" id="height" value="100%" />
|
2402 | <span class="info"
|
2403 | >for example &quot;500px&quot; or &quot;100%&quot;</span
|
2404 | >
|
2405 | </td>
|
2406 | </tr>
|
2407 | <tr>
|
2408 | <td>style</td>
|
2409 | <td>
|
2410 | <select id="style">
|
2411 | <option value="bar">bar </option
|
2412 | ><option value="bar-color">bar-color </option
|
2413 | ><option value="bar-size">bar-size </option
|
2414 | ><option value="dot">dot </option
|
2415 | ><option value="dot-color">dot-color </option
|
2416 | ><option value="dot-size">dot-size </option
|
2417 | ><option value="dot-line">dot-line </option
|
2418 | ><option value="line">line </option
|
2419 | ><option value="grid">grid </option
|
2420 | ><option value="surface" selected>surface </option></select
|
2421 | >
|
2422 | </td>
|
2423 | </tr>
|
2424 |
|
2425 | <tr>
|
2426 | <td>showAnimationControls</td>
|
2427 | <td>
|
2428 | <input type="checkbox" id="showAnimationControls" checked />
|
2429 | </td>
|
2430 | </tr>
|
2431 | <tr>
|
2432 | <td>showGrid</td>
|
2433 | <td><input type="checkbox" id="showGrid" checked /></td>
|
2434 | </tr>
|
2435 | <tr>
|
2436 | <td>showXAxis</td>
|
2437 | <td><input type="checkbox" id="showXAxis" checked /></td>
|
2438 | </tr>
|
2439 | <tr>
|
2440 | <td>showYAxis</td>
|
2441 | <td><input type="checkbox" id="showYAxis" checked /></td>
|
2442 | </tr>
|
2443 | <tr>
|
2444 | <td>showZAxis</td>
|
2445 | <td><input type="checkbox" id="showZAxis" checked /></td>
|
2446 | </tr>
|
2447 |
|
2448 | <tr>
|
2449 | <td>showPerspective</td>
|
2450 | <td><input type="checkbox" id="showPerspective" checked /></td>
|
2451 | </tr>
|
2452 | <tr>
|
2453 | <td>showLegend</td>
|
2454 | <td><input type="checkbox" id="showLegend" checked /></td>
|
2455 | </tr>
|
2456 | <tr>
|
2457 | <td>showShadow</td>
|
2458 | <td><input type="checkbox" id="showShadow" /></td>
|
2459 | </tr>
|
2460 |
|
2461 | <tr>
|
2462 | <td>keepAspectRatio</td>
|
2463 | <td><input type="checkbox" id="keepAspectRatio" checked /></td>
|
2464 | </tr>
|
2465 | <tr>
|
2466 | <td>verticalRatio</td>
|
2467 | <td>
|
2468 | <input type="text" id="verticalRatio" value="0.5" />
|
2469 | <span class="info">a value between 0.1 and 1.0</span>
|
2470 | </td>
|
2471 | </tr>
|
2472 |
|
2473 | <tr>
|
2474 | <td>animationInterval</td>
|
2475 | <td>
|
2476 | <input type="text" id="animationInterval" value="1000" />
|
2477 | <span class="info">in milliseconds</span>
|
2478 | </td>
|
2479 | </tr>
|
2480 | <tr>
|
2481 | <td>animationPreload</td>
|
2482 | <td><input type="checkbox" id="animationPreload" /></td>
|
2483 | </tr>
|
2484 | <tr>
|
2485 | <td>animationAutoStart</td>
|
2486 | <td><input type="checkbox" id="animationAutoStart" /></td>
|
2487 | </tr>
|
2488 |
|
2489 | <tr>
|
2490 | <td>xCenter</td>
|
2491 | <td><input type="text" id="xCenter" value="55%" /></td>
|
2492 | </tr>
|
2493 | <tr>
|
2494 | <td>yCenter</td>
|
2495 | <td><input type="text" id="yCenter" value="45%" /></td>
|
2496 | </tr>
|
2497 |
|
2498 | <tr>
|
2499 | <td>xMin</td>
|
2500 | <td><input type="text" id="xMin" /></td>
|
2501 | </tr>
|
2502 | <tr>
|
2503 | <td>xMax</td>
|
2504 | <td><input type="text" id="xMax" /></td>
|
2505 | </tr>
|
2506 | <tr>
|
2507 | <td>xStep</td>
|
2508 | <td><input type="text" id="xStep" /></td>
|
2509 | </tr>
|
2510 |
|
2511 | <tr>
|
2512 | <td>yMin</td>
|
2513 | <td><input type="text" id="yMin" /></td>
|
2514 | </tr>
|
2515 | <tr>
|
2516 | <td>yMax</td>
|
2517 | <td><input type="text" id="yMax" /></td>
|
2518 | </tr>
|
2519 | <tr>
|
2520 | <td>yStep</td>
|
2521 | <td><input type="text" id="yStep" /></td>
|
2522 | </tr>
|
2523 |
|
2524 | <tr>
|
2525 | <td>zMin</td>
|
2526 | <td><input type="text" id="zMin" /></td>
|
2527 | </tr>
|
2528 | <tr>
|
2529 | <td>zMax</td>
|
2530 | <td><input type="text" id="zMax" /></td>
|
2531 | </tr>
|
2532 | <tr>
|
2533 | <td>zStep</td>
|
2534 | <td><input type="text" id="zStep" /></td>
|
2535 | </tr>
|
2536 |
|
2537 | <tr>
|
2538 | <td>valueMin</td>
|
2539 | <td><input type="text" id="valueMin" /></td>
|
2540 | </tr>
|
2541 | <tr>
|
2542 | <td>valueMax</td>
|
2543 | <td><input type="text" id="valueMax" /></td>
|
2544 | </tr>
|
2545 |
|
2546 | <tr>
|
2547 | <td>xBarWidth</td>
|
2548 | <td><input type="text" id="xBarWidth" /></td>
|
2549 | </tr>
|
2550 | <tr>
|
2551 | <td>yBarWidth</td>
|
2552 | <td><input type="text" id="yBarWidth" /></td>
|
2553 | </tr>
|
2554 |
|
2555 | <tr>
|
2556 | <td>xLabel</td>
|
2557 | <td><input type="text" id="xLabel" value="x" /></td>
|
2558 | </tr>
|
2559 | <tr>
|
2560 | <td>yLabel</td>
|
2561 | <td><input type="text" id="yLabel" value="y" /></td>
|
2562 | </tr>
|
2563 | <tr>
|
2564 | <td>zLabel</td>
|
2565 | <td><input type="text" id="zLabel" value="z" /></td>
|
2566 | </tr>
|
2567 | <tr>
|
2568 | <td>filterLabel</td>
|
2569 | <td><input type="text" id="filterLabel" value="time" /></td>
|
2570 | </tr>
|
2571 | <tr>
|
2572 | <td>legendLabel</td>
|
2573 | <td><input type="text" id="legendLabel" value="value" /></td>
|
2574 | </tr>
|
2575 | </tbody>
|
2576 | </table>
|
2577 | </td>
|
2578 | </tr>
|
2579 | </tbody>
|
2580 | </table>
|
2581 | '
|
2582 | /><input
|
2583 | type="hidden"
|
2584 | name="resources"
|
2585 | value="https://visjs.github.io/vis-graph3d/examples/graph3d/playground/playground.css,https://visjs.github.io/vis-graph3d/dist/vis-graph3d.min.js,https://visjs.github.io/vis-graph3d/examples/graph3d/playground/playground.js,https://visjs.github.io/vis-graph3d/examples/graph3d/playground/csv2array.js"
|
2586 | /><input type="hidden" name="wrap" value="b" /><input
|
2587 | type="hidden"
|
2588 | name="title"
|
2589 | value="Graph 3D | Playground"
|
2590 | />
|
2591 | </form>
|
2592 |
|
2593 | <form
|
2594 | action="https://codepen.io/pen/define"
|
2595 | method="post"
|
2596 | target="_blank"
|
2597 | >
|
2598 | <button class="icon codepen" alt="CodePen" title="CodePen">
|
2599 |  </button
|
2600 | ><input
|
2601 | type="hidden"
|
2602 | name="data"
|
2603 | value='{"css":"","css_external":"https://visjs.github.io/vis-graph3d/examples/graph3d/playground/playground.css","html":"<h1>Graph 3D - Playground</h1>\n\n<table style=\"width:100%;\">\n <colgroup>\n <col width=\"50%\" />\n <col width=\"50%\" />\n </colgroup>\n <tbody>\n <tr>\n <td>\n <h2>Data</h2>\n <p>\n Graph 3D expects a data table with first three to five columns: colums\n <code>x</code>, <code>y</code>, <code>z</code> (optional),\n <code>style</code>, <code>filter</code> (optional).\n </p>\n\n <table>\n <tbody>\n <tr>\n <td style=\"white-space: nowrap\">\n <input\n type=\"radio\"\n name=\"datatype\"\n id=\"datatypeCsv\"\n onclick=\"selectDataType();\"\n checked\n value=\"csv\"\n />Csv\n </td>\n <td>\n <div id=\"csv\">\n <textarea id=\"csvTextarea\"></textarea>\n <p>\n <a\n href=\"javascript: loadCsvExample();\"\n title=\"Load an example\"\n >Simple example</a\n >\n <a\n href=\"javascript: loadCsvLineExample();\"\n title=\"Load an example\"\n >Line example</a\n >\n <a\n href=\"javascript: loadCsvAnimationExample();\"\n title=\"Load an example\"\n >Animation example</a\n >\n <a\n href=\"javascript: loadCsvMovingDotsExample();\"\n title=\"Load an example\"\n >Moving dots example</a\n >\n <a\n href=\"javascript: loadCsvColoredDotsExample();\"\n title=\"Load an example\"\n >Colored dots example</a\n >\n <a\n href=\"javascript: loadCsvSizedDotsExample();\"\n title=\"Load an example\"\n >Sized dots example</a\n >\n </p>\n </div>\n </td>\n </tr>\n <!-- TODO: add JSON examples -->\n </tbody>\n </table>\n\n <br />\n </td>\n <td rowspan=\"2\">\n <h2>Graph</h2>\n <p>\n <input type=\"button\" value=\"Draw graph\" onclick=\"draw();\" id=\"draw\" />\n </p>\n\n <div id=\"mygraph\"></div>\n </td>\n </tr>\n <tr>\n <td>\n <h2>Options</h2>\n\n <table>\n <tbody>\n <tr>\n <th>Option</th>\n <th>Value</th>\n </tr>\n\n <tr>\n <td>width</td>\n <td>\n <input type=\"text\" id=\"width\" value=\"100%\" />\n <span class=\"info\"\n >for example &quot;500px&quot; or &quot;100%&quot;</span\n >\n </td>\n </tr>\n <tr>\n <td>height</td>\n <td>\n <input type=\"text\" id=\"height\" value=\"100%\" />\n <span class=\"info\"\n >for example &quot;500px&quot; or &quot;100%&quot;</span\n >\n </td>\n </tr>\n <tr>\n <td>style</td>\n <td>\n <select id=\"style\">\n <option value=\"bar\">bar </option\n ><option value=\"bar-color\">bar-color </option\n ><option value=\"bar-size\">bar-size </option\n ><option value=\"dot\">dot </option\n ><option value=\"dot-color\">dot-color </option\n ><option value=\"dot-size\">dot-size </option\n ><option value=\"dot-line\">dot-line </option\n ><option value=\"line\">line </option\n ><option value=\"grid\">grid </option\n ><option value=\"surface\" selected>surface </option></select\n >\n </td>\n </tr>\n\n <tr>\n <td>showAnimationControls</td>\n <td>\n <input type=\"checkbox\" id=\"showAnimationControls\" checked />\n </td>\n </tr>\n <tr>\n <td>showGrid</td>\n <td><input type=\"checkbox\" id=\"showGrid\" checked /></td>\n </tr>\n <tr>\n <td>showXAxis</td>\n <td><input type=\"checkbox\" id=\"showXAxis\" checked /></td>\n </tr>\n <tr>\n <td>showYAxis</td>\n <td><input type=\"checkbox\" id=\"showYAxis\" checked /></td>\n </tr>\n <tr>\n <td>showZAxis</td>\n <td><input type=\"checkbox\" id=\"showZAxis\" checked /></td>\n </tr>\n\n <tr>\n <td>showPerspective</td>\n <td><input type=\"checkbox\" id=\"showPerspective\" checked /></td>\n </tr>\n <tr>\n <td>showLegend</td>\n <td><input type=\"checkbox\" id=\"showLegend\" checked /></td>\n </tr>\n <tr>\n <td>showShadow</td>\n <td><input type=\"checkbox\" id=\"showShadow\" /></td>\n </tr>\n\n <tr>\n <td>keepAspectRatio</td>\n <td><input type=\"checkbox\" id=\"keepAspectRatio\" checked /></td>\n </tr>\n <tr>\n <td>verticalRatio</td>\n <td>\n <input type=\"text\" id=\"verticalRatio\" value=\"0.5\" />\n <span class=\"info\">a value between 0.1 and 1.0</span>\n </td>\n </tr>\n\n <tr>\n <td>animationInterval</td>\n <td>\n <input type=\"text\" id=\"animationInterval\" value=\"1000\" />\n <span class=\"info\">in milliseconds</span>\n </td>\n </tr>\n <tr>\n <td>animationPreload</td>\n <td><input type=\"checkbox\" id=\"animationPreload\" /></td>\n </tr>\n <tr>\n <td>animationAutoStart</td>\n <td><input type=\"checkbox\" id=\"animationAutoStart\" /></td>\n </tr>\n\n <tr>\n <td>xCenter</td>\n <td><input type=\"text\" id=\"xCenter\" value=\"55%\" /></td>\n </tr>\n <tr>\n <td>yCenter</td>\n <td><input type=\"text\" id=\"yCenter\" value=\"45%\" /></td>\n </tr>\n\n <tr>\n <td>xMin</td>\n <td><input type=\"text\" id=\"xMin\" /></td>\n </tr>\n <tr>\n <td>xMax</td>\n <td><input type=\"text\" id=\"xMax\" /></td>\n </tr>\n <tr>\n <td>xStep</td>\n <td><input type=\"text\" id=\"xStep\" /></td>\n </tr>\n\n <tr>\n <td>yMin</td>\n <td><input type=\"text\" id=\"yMin\" /></td>\n </tr>\n <tr>\n <td>yMax</td>\n <td><input type=\"text\" id=\"yMax\" /></td>\n </tr>\n <tr>\n <td>yStep</td>\n <td><input type=\"text\" id=\"yStep\" /></td>\n </tr>\n\n <tr>\n <td>zMin</td>\n <td><input type=\"text\" id=\"zMin\" /></td>\n </tr>\n <tr>\n <td>zMax</td>\n <td><input type=\"text\" id=\"zMax\" /></td>\n </tr>\n <tr>\n <td>zStep</td>\n <td><input type=\"text\" id=\"zStep\" /></td>\n </tr>\n\n <tr>\n <td>valueMin</td>\n <td><input type=\"text\" id=\"valueMin\" /></td>\n </tr>\n <tr>\n <td>valueMax</td>\n <td><input type=\"text\" id=\"valueMax\" /></td>\n </tr>\n\n <tr>\n <td>xBarWidth</td>\n <td><input type=\"text\" id=\"xBarWidth\" /></td>\n </tr>\n <tr>\n <td>yBarWidth</td>\n <td><input type=\"text\" id=\"yBarWidth\" /></td>\n </tr>\n\n <tr>\n <td>xLabel</td>\n <td><input type=\"text\" id=\"xLabel\" value=\"x\" /></td>\n </tr>\n <tr>\n <td>yLabel</td>\n <td><input type=\"text\" id=\"yLabel\" value=\"y\" /></td>\n </tr>\n <tr>\n <td>zLabel</td>\n <td><input type=\"text\" id=\"zLabel\" value=\"z\" /></td>\n </tr>\n <tr>\n <td>filterLabel</td>\n <td><input type=\"text\" id=\"filterLabel\" value=\"time\" /></td>\n </tr>\n <tr>\n <td>legendLabel</td>\n <td><input type=\"text\" id=\"legendLabel\" value=\"value\" /></td>\n </tr>\n </tbody>\n </table>\n </td>\n </tr>\n </tbody>\n</table>\n","js":"// Called when the Visualization API is loaded.\nfunction drawVisualization() {\n // TODO\n}\n\nwindow.addEventListener(\"load\", () => {\n load();\n});\n","js_external":"https://visjs.github.io/vis-graph3d/dist/vis-graph3d.min.js;https://visjs.github.io/vis-graph3d/examples/graph3d/playground/playground.js;https://visjs.github.io/vis-graph3d/examples/graph3d/playground/csv2array.js","title":"Graph 3D | Playground"}'
|
2604 | /><input
|
2605 | type="hidden"
|
2606 | name="js"
|
2607 | value='// Called when the Visualization API is loaded.
|
2608 | function drawVisualization() {
|
2609 | // TODO
|
2610 | }
|
2611 |
|
2612 | window.addEventListener("load", () => {
|
2613 | load();
|
2614 | });
|
2615 | '
|
2616 | /><input type="hidden" name="css" value /><input
|
2617 | type="hidden"
|
2618 | name="html"
|
2619 | value='<h1>Graph 3D - Playground</h1>
|
2620 |
|
2621 | <table style="width:100%;">
|
2622 | <colgroup>
|
2623 | <col width="50%" />
|
2624 | <col width="50%" />
|
2625 | </colgroup>
|
2626 | <tbody>
|
2627 | <tr>
|
2628 | <td>
|
2629 | <h2>Data</h2>
|
2630 | <p>
|
2631 | Graph 3D expects a data table with first three to five columns: colums
|
2632 | <code>x</code>, <code>y</code>, <code>z</code> (optional),
|
2633 | <code>style</code>, <code>filter</code> (optional).
|
2634 | </p>
|
2635 |
|
2636 | <table>
|
2637 | <tbody>
|
2638 | <tr>
|
2639 | <td style="white-space: nowrap">
|
2640 | <input
|
2641 | type="radio"
|
2642 | name="datatype"
|
2643 | id="datatypeCsv"
|
2644 | onclick="selectDataType();"
|
2645 | checked
|
2646 | value="csv"
|
2647 | />Csv
|
2648 | </td>
|
2649 | <td>
|
2650 | <div id="csv">
|
2651 | <textarea id="csvTextarea"></textarea>
|
2652 | <p>
|
2653 | <a
|
2654 | href="javascript: loadCsvExample();"
|
2655 | title="Load an example"
|
2656 | >Simple example</a
|
2657 | >
|
2658 | <a
|
2659 | href="javascript: loadCsvLineExample();"
|
2660 | title="Load an example"
|
2661 | >Line example</a
|
2662 | >
|
2663 | <a
|
2664 | href="javascript: loadCsvAnimationExample();"
|
2665 | title="Load an example"
|
2666 | >Animation example</a
|
2667 | >
|
2668 | <a
|
2669 | href="javascript: loadCsvMovingDotsExample();"
|
2670 | title="Load an example"
|
2671 | >Moving dots example</a
|
2672 | >
|
2673 | <a
|
2674 | href="javascript: loadCsvColoredDotsExample();"
|
2675 | title="Load an example"
|
2676 | >Colored dots example</a
|
2677 | >
|
2678 | <a
|
2679 | href="javascript: loadCsvSizedDotsExample();"
|
2680 | title="Load an example"
|
2681 | >Sized dots example</a
|
2682 | >
|
2683 | </p>
|
2684 | </div>
|
2685 | </td>
|
2686 | </tr>
|
2687 | <!-- TODO: add JSON examples -->
|
2688 | </tbody>
|
2689 | </table>
|
2690 |
|
2691 | <br />
|
2692 | </td>
|
2693 | <td rowspan="2">
|
2694 | <h2>Graph</h2>
|
2695 | <p>
|
2696 | <input type="button" value="Draw graph" onclick="draw();" id="draw" />
|
2697 | </p>
|
2698 |
|
2699 | <div id="mygraph"></div>
|
2700 | </td>
|
2701 | </tr>
|
2702 | <tr>
|
2703 | <td>
|
2704 | <h2>Options</h2>
|
2705 |
|
2706 | <table>
|
2707 | <tbody>
|
2708 | <tr>
|
2709 | <th>Option</th>
|
2710 | <th>Value</th>
|
2711 | </tr>
|
2712 |
|
2713 | <tr>
|
2714 | <td>width</td>
|
2715 | <td>
|
2716 | <input type="text" id="width" value="100%" />
|
2717 | <span class="info"
|
2718 | >for example &quot;500px&quot; or &quot;100%&quot;</span
|
2719 | >
|
2720 | </td>
|
2721 | </tr>
|
2722 | <tr>
|
2723 | <td>height</td>
|
2724 | <td>
|
2725 | <input type="text" id="height" value="100%" />
|
2726 | <span class="info"
|
2727 | >for example &quot;500px&quot; or &quot;100%&quot;</span
|
2728 | >
|
2729 | </td>
|
2730 | </tr>
|
2731 | <tr>
|
2732 | <td>style</td>
|
2733 | <td>
|
2734 | <select id="style">
|
2735 | <option value="bar">bar </option
|
2736 | ><option value="bar-color">bar-color </option
|
2737 | ><option value="bar-size">bar-size </option
|
2738 | ><option value="dot">dot </option
|
2739 | ><option value="dot-color">dot-color </option
|
2740 | ><option value="dot-size">dot-size </option
|
2741 | ><option value="dot-line">dot-line </option
|
2742 | ><option value="line">line </option
|
2743 | ><option value="grid">grid </option
|
2744 | ><option value="surface" selected>surface </option></select
|
2745 | >
|
2746 | </td>
|
2747 | </tr>
|
2748 |
|
2749 | <tr>
|
2750 | <td>showAnimationControls</td>
|
2751 | <td>
|
2752 | <input type="checkbox" id="showAnimationControls" checked />
|
2753 | </td>
|
2754 | </tr>
|
2755 | <tr>
|
2756 | <td>showGrid</td>
|
2757 | <td><input type="checkbox" id="showGrid" checked /></td>
|
2758 | </tr>
|
2759 | <tr>
|
2760 | <td>showXAxis</td>
|
2761 | <td><input type="checkbox" id="showXAxis" checked /></td>
|
2762 | </tr>
|
2763 | <tr>
|
2764 | <td>showYAxis</td>
|
2765 | <td><input type="checkbox" id="showYAxis" checked /></td>
|
2766 | </tr>
|
2767 | <tr>
|
2768 | <td>showZAxis</td>
|
2769 | <td><input type="checkbox" id="showZAxis" checked /></td>
|
2770 | </tr>
|
2771 |
|
2772 | <tr>
|
2773 | <td>showPerspective</td>
|
2774 | <td><input type="checkbox" id="showPerspective" checked /></td>
|
2775 | </tr>
|
2776 | <tr>
|
2777 | <td>showLegend</td>
|
2778 | <td><input type="checkbox" id="showLegend" checked /></td>
|
2779 | </tr>
|
2780 | <tr>
|
2781 | <td>showShadow</td>
|
2782 | <td><input type="checkbox" id="showShadow" /></td>
|
2783 | </tr>
|
2784 |
|
2785 | <tr>
|
2786 | <td>keepAspectRatio</td>
|
2787 | <td><input type="checkbox" id="keepAspectRatio" checked /></td>
|
2788 | </tr>
|
2789 | <tr>
|
2790 | <td>verticalRatio</td>
|
2791 | <td>
|
2792 | <input type="text" id="verticalRatio" value="0.5" />
|
2793 | <span class="info">a value between 0.1 and 1.0</span>
|
2794 | </td>
|
2795 | </tr>
|
2796 |
|
2797 | <tr>
|
2798 | <td>animationInterval</td>
|
2799 | <td>
|
2800 | <input type="text" id="animationInterval" value="1000" />
|
2801 | <span class="info">in milliseconds</span>
|
2802 | </td>
|
2803 | </tr>
|
2804 | <tr>
|
2805 | <td>animationPreload</td>
|
2806 | <td><input type="checkbox" id="animationPreload" /></td>
|
2807 | </tr>
|
2808 | <tr>
|
2809 | <td>animationAutoStart</td>
|
2810 | <td><input type="checkbox" id="animationAutoStart" /></td>
|
2811 | </tr>
|
2812 |
|
2813 | <tr>
|
2814 | <td>xCenter</td>
|
2815 | <td><input type="text" id="xCenter" value="55%" /></td>
|
2816 | </tr>
|
2817 | <tr>
|
2818 | <td>yCenter</td>
|
2819 | <td><input type="text" id="yCenter" value="45%" /></td>
|
2820 | </tr>
|
2821 |
|
2822 | <tr>
|
2823 | <td>xMin</td>
|
2824 | <td><input type="text" id="xMin" /></td>
|
2825 | </tr>
|
2826 | <tr>
|
2827 | <td>xMax</td>
|
2828 | <td><input type="text" id="xMax" /></td>
|
2829 | </tr>
|
2830 | <tr>
|
2831 | <td>xStep</td>
|
2832 | <td><input type="text" id="xStep" /></td>
|
2833 | </tr>
|
2834 |
|
2835 | <tr>
|
2836 | <td>yMin</td>
|
2837 | <td><input type="text" id="yMin" /></td>
|
2838 | </tr>
|
2839 | <tr>
|
2840 | <td>yMax</td>
|
2841 | <td><input type="text" id="yMax" /></td>
|
2842 | </tr>
|
2843 | <tr>
|
2844 | <td>yStep</td>
|
2845 | <td><input type="text" id="yStep" /></td>
|
2846 | </tr>
|
2847 |
|
2848 | <tr>
|
2849 | <td>zMin</td>
|
2850 | <td><input type="text" id="zMin" /></td>
|
2851 | </tr>
|
2852 | <tr>
|
2853 | <td>zMax</td>
|
2854 | <td><input type="text" id="zMax" /></td>
|
2855 | </tr>
|
2856 | <tr>
|
2857 | <td>zStep</td>
|
2858 | <td><input type="text" id="zStep" /></td>
|
2859 | </tr>
|
2860 |
|
2861 | <tr>
|
2862 | <td>valueMin</td>
|
2863 | <td><input type="text" id="valueMin" /></td>
|
2864 | </tr>
|
2865 | <tr>
|
2866 | <td>valueMax</td>
|
2867 | <td><input type="text" id="valueMax" /></td>
|
2868 | </tr>
|
2869 |
|
2870 | <tr>
|
2871 | <td>xBarWidth</td>
|
2872 | <td><input type="text" id="xBarWidth" /></td>
|
2873 | </tr>
|
2874 | <tr>
|
2875 | <td>yBarWidth</td>
|
2876 | <td><input type="text" id="yBarWidth" /></td>
|
2877 | </tr>
|
2878 |
|
2879 | <tr>
|
2880 | <td>xLabel</td>
|
2881 | <td><input type="text" id="xLabel" value="x" /></td>
|
2882 | </tr>
|
2883 | <tr>
|
2884 | <td>yLabel</td>
|
2885 | <td><input type="text" id="yLabel" value="y" /></td>
|
2886 | </tr>
|
2887 | <tr>
|
2888 | <td>zLabel</td>
|
2889 | <td><input type="text" id="zLabel" value="z" /></td>
|
2890 | </tr>
|
2891 | <tr>
|
2892 | <td>filterLabel</td>
|
2893 | <td><input type="text" id="filterLabel" value="time" /></td>
|
2894 | </tr>
|
2895 | <tr>
|
2896 | <td>legendLabel</td>
|
2897 | <td><input type="text" id="legendLabel" value="value" /></td>
|
2898 | </tr>
|
2899 | </tbody>
|
2900 | </table>
|
2901 | </td>
|
2902 | </tr>
|
2903 | </tbody>
|
2904 | </table>
|
2905 | '
|
2906 | /></form
|
2907 | ></span>
|
2908 | </div>
|
2909 | <a href="graph3d/playground/index.html"
|
2910 | ><div class="example-image">
|
2911 | <img
|
2912 | src="thumbnails/abd84ceb6894a84b569ea940d4831358492f11253c022f11e43b1014a7992ddf.png"
|
2913 | alt="Playground"
|
2914 | /></div></a></span
|
2915 | ><span class="example-link"
|
2916 | ><div>
|
2917 | <a href="graph3d/10_styling.html">Styling</a
|
2918 | ><span class="playgrounds"
|
2919 | ><form
|
2920 | action="http://jsfiddle.net/api/post/library/pure/"
|
2921 | method="post"
|
2922 | target="_blank"
|
2923 | >
|
2924 | <button class="icon jsfiddle" alt="JSFiddle" title="JSFiddle">
|
2925 |  </button
|
2926 | ><input
|
2927 | type="hidden"
|
2928 | name="js"
|
2929 | value='var data = null;
|
2930 | var graph = null;
|
2931 |
|
2932 | function custom(x, y) {
|
2933 | return -Math.sin(x / Math.PI) * Math.cos(y / Math.PI) * 10 + 10;
|
2934 | }
|
2935 |
|
2936 | // Called when the Visualization API is loaded.
|
2937 | function drawVisualization() {
|
2938 | var style = document.getElementById("style").value;
|
2939 | var showPerspective = document.getElementById("perspective").checked;
|
2940 | var xBarWidth =
|
2941 | parseFloat(document.getElementById("xBarWidth").value) || undefined;
|
2942 | var yBarWidth =
|
2943 | parseFloat(document.getElementById("yBarWidth").value) || undefined;
|
2944 | var withValue =
|
2945 | ["bar-color", "bar-size", "dot-size", "dot-color"].indexOf(style) != -1;
|
2946 |
|
2947 | // Create and populate a data table.
|
2948 | data = [];
|
2949 |
|
2950 | // create some nice looking data with sin/cos
|
2951 | var steps = 5; // number of datapoints will be steps*steps
|
2952 | var axisMax = 10;
|
2953 | var axisStep = axisMax / steps;
|
2954 | for (var x = 0; x <= axisMax; x += axisStep) {
|
2955 | for (var y = 0; y <= axisMax; y += axisStep) {
|
2956 | var z = custom(x, y);
|
2957 | if (withValue) {
|
2958 | var value = y - x;
|
2959 | data.push({ x: x, y: y, z: z, style: value });
|
2960 | } else {
|
2961 | data.push({ x: x, y: y, z: z });
|
2962 | }
|
2963 | }
|
2964 | }
|
2965 |
|
2966 | // specify options
|
2967 | var options = {
|
2968 | width: "600px",
|
2969 | height: "600px",
|
2970 | style: style,
|
2971 | xBarWidth: xBarWidth,
|
2972 | yBarWidth: yBarWidth,
|
2973 | showPerspective: showPerspective,
|
2974 | showGrid: true,
|
2975 | showShadow: false,
|
2976 | keepAspectRatio: true,
|
2977 | verticalRatio: 0.5
|
2978 | };
|
2979 |
|
2980 | var camera = graph ? graph.getCameraPosition() : null;
|
2981 |
|
2982 | // create our graph
|
2983 | var container = document.getElementById("mygraph");
|
2984 | graph = new vis.Graph3d(container, data, options);
|
2985 |
|
2986 | if (camera) graph.setCameraPosition(camera); // restore camera position
|
2987 |
|
2988 | document.getElementById("style").onchange = drawVisualization;
|
2989 | document.getElementById("perspective").onchange = drawVisualization;
|
2990 | document.getElementById("xBarWidth").onchange = drawVisualization;
|
2991 | document.getElementById("yBarWidth").onchange = drawVisualization;
|
2992 | }
|
2993 |
|
2994 | window.addEventListener("load", () => {
|
2995 | drawVisualization();
|
2996 | });
|
2997 | '
|
2998 | /><input
|
2999 | type="hidden"
|
3000 | name="css"
|
3001 | value="body {
|
3002 | font: 10pt arial;
|
3003 | }
|
3004 | "
|
3005 | /><input
|
3006 | type="hidden"
|
3007 | name="html"
|
3008 | value='<p>
|
3009 | <label for="style">
|
3010 | Style:
|
3011 | <select id="style">
|
3012 | <option value="bar">bar</option>
|
3013 | <option value="bar-color">bar-color</option>
|
3014 | <option value="bar-size">bar-size</option>
|
3015 |
|
3016 | <option value="dot">dot</option>
|
3017 | <option value="dot-line">dot-line</option>
|
3018 | <option value="dot-color">dot-color</option>
|
3019 | <option value="dot-size">dot-size</option>
|
3020 |
|
3021 | <option value="grid">grid</option>
|
3022 | <option value="line">line</option>
|
3023 | <option value="surface">surface</option>
|
3024 | </select>
|
3025 | </label>
|
3026 | </p>
|
3027 |
|
3028 | <p>
|
3029 | <label for="perspective">
|
3030 | <input type="checkbox" id="perspective" checked /> Show perspective
|
3031 | </label>
|
3032 | </p>
|
3033 |
|
3034 | <p>
|
3035 | <label for="xBarWidth">
|
3036 | Bar width X:
|
3037 | <input type="text" id="xBarWidth" value style="width:50px;" /> (only
|
3038 | applicable for styles &quot;bar&quot; and &quot;bar-color&quot;)
|
3039 | </label>
|
3040 | </p>
|
3041 | <p>
|
3042 | <label for="yBarWidth">
|
3043 | Bar width Y:
|
3044 | <input type="text" id="yBarWidth" value style="width:50px;" /> (only
|
3045 | applicable for styles &quot;bar&quot; and &quot;bar-color&quot;)
|
3046 | </label>
|
3047 | </p>
|
3048 |
|
3049 | <div id="mygraph"></div>
|
3050 |
|
3051 | <div id="info"></div>
|
3052 | '
|
3053 | /><input
|
3054 | type="hidden"
|
3055 | name="resources"
|
3056 | value="https://visjs.github.io/vis-graph3d/dist/vis-graph3d.min.js"
|
3057 | /><input type="hidden" name="wrap" value="b" /><input
|
3058 | type="hidden"
|
3059 | name="title"
|
3060 | value="Graph 3D | Styling"
|
3061 | />
|
3062 | </form>
|
3063 |
|
3064 | <form
|
3065 | action="https://codepen.io/pen/define"
|
3066 | method="post"
|
3067 | target="_blank"
|
3068 | >
|
3069 | <button class="icon codepen" alt="CodePen" title="CodePen">
|
3070 |  </button
|
3071 | ><input
|
3072 | type="hidden"
|
3073 | name="data"
|
3074 | value='{"css":"body {\n font: 10pt arial;\n}\n","css_external":"","html":"<p>\n <label for=\"style\">\n Style:\n <select id=\"style\">\n <option value=\"bar\">bar</option>\n <option value=\"bar-color\">bar-color</option>\n <option value=\"bar-size\">bar-size</option>\n\n <option value=\"dot\">dot</option>\n <option value=\"dot-line\">dot-line</option>\n <option value=\"dot-color\">dot-color</option>\n <option value=\"dot-size\">dot-size</option>\n\n <option value=\"grid\">grid</option>\n <option value=\"line\">line</option>\n <option value=\"surface\">surface</option>\n </select>\n </label>\n</p>\n\n<p>\n <label for=\"perspective\">\n <input type=\"checkbox\" id=\"perspective\" checked /> Show perspective\n </label>\n</p>\n\n<p>\n <label for=\"xBarWidth\">\n Bar width X:\n <input type=\"text\" id=\"xBarWidth\" value style=\"width:50px;\" /> (only\n applicable for styles &quot;bar&quot; and &quot;bar-color&quot;)\n </label>\n</p>\n<p>\n <label for=\"yBarWidth\">\n Bar width Y:\n <input type=\"text\" id=\"yBarWidth\" value style=\"width:50px;\" /> (only\n applicable for styles &quot;bar&quot; and &quot;bar-color&quot;)\n </label>\n</p>\n\n<div id=\"mygraph\"></div>\n\n<div id=\"info\"></div>\n","js":"var data = null;\nvar graph = null;\n\nfunction custom(x, y) {\n return -Math.sin(x / Math.PI) * Math.cos(y / Math.PI) * 10 + 10;\n}\n\n// Called when the Visualization API is loaded.\nfunction drawVisualization() {\n var style = document.getElementById(\"style\").value;\n var showPerspective = document.getElementById(\"perspective\").checked;\n var xBarWidth =\n parseFloat(document.getElementById(\"xBarWidth\").value) || undefined;\n var yBarWidth =\n parseFloat(document.getElementById(\"yBarWidth\").value) || undefined;\n var withValue =\n [\"bar-color\", \"bar-size\", \"dot-size\", \"dot-color\"].indexOf(style) != -1;\n\n // Create and populate a data table.\n data = [];\n\n // create some nice looking data with sin/cos\n var steps = 5; // number of datapoints will be steps*steps\n var axisMax = 10;\n var axisStep = axisMax / steps;\n for (var x = 0; x <= axisMax; x += axisStep) {\n for (var y = 0; y <= axisMax; y += axisStep) {\n var z = custom(x, y);\n if (withValue) {\n var value = y - x;\n data.push({ x: x, y: y, z: z, style: value });\n } else {\n data.push({ x: x, y: y, z: z });\n }\n }\n }\n\n // specify options\n var options = {\n width: \"600px\",\n height: \"600px\",\n style: style,\n xBarWidth: xBarWidth,\n yBarWidth: yBarWidth,\n showPerspective: showPerspective,\n showGrid: true,\n showShadow: false,\n keepAspectRatio: true,\n verticalRatio: 0.5\n };\n\n var camera = graph ? graph.getCameraPosition() : null;\n\n // create our graph\n var container = document.getElementById(\"mygraph\");\n graph = new vis.Graph3d(container, data, options);\n\n if (camera) graph.setCameraPosition(camera); // restore camera position\n\n document.getElementById(\"style\").onchange = drawVisualization;\n document.getElementById(\"perspective\").onchange = drawVisualization;\n document.getElementById(\"xBarWidth\").onchange = drawVisualization;\n document.getElementById(\"yBarWidth\").onchange = drawVisualization;\n}\n\nwindow.addEventListener(\"load\", () => {\n drawVisualization();\n});\n","js_external":"https://visjs.github.io/vis-graph3d/dist/vis-graph3d.min.js","title":"Graph 3D | Styling"}'
|
3075 | /><input
|
3076 | type="hidden"
|
3077 | name="js"
|
3078 | value='var data = null;
|
3079 | var graph = null;
|
3080 |
|
3081 | function custom(x, y) {
|
3082 | return -Math.sin(x / Math.PI) * Math.cos(y / Math.PI) * 10 + 10;
|
3083 | }
|
3084 |
|
3085 | // Called when the Visualization API is loaded.
|
3086 | function drawVisualization() {
|
3087 | var style = document.getElementById("style").value;
|
3088 | var showPerspective = document.getElementById("perspective").checked;
|
3089 | var xBarWidth =
|
3090 | parseFloat(document.getElementById("xBarWidth").value) || undefined;
|
3091 | var yBarWidth =
|
3092 | parseFloat(document.getElementById("yBarWidth").value) || undefined;
|
3093 | var withValue =
|
3094 | ["bar-color", "bar-size", "dot-size", "dot-color"].indexOf(style) != -1;
|
3095 |
|
3096 | // Create and populate a data table.
|
3097 | data = [];
|
3098 |
|
3099 | // create some nice looking data with sin/cos
|
3100 | var steps = 5; // number of datapoints will be steps*steps
|
3101 | var axisMax = 10;
|
3102 | var axisStep = axisMax / steps;
|
3103 | for (var x = 0; x <= axisMax; x += axisStep) {
|
3104 | for (var y = 0; y <= axisMax; y += axisStep) {
|
3105 | var z = custom(x, y);
|
3106 | if (withValue) {
|
3107 | var value = y - x;
|
3108 | data.push({ x: x, y: y, z: z, style: value });
|
3109 | } else {
|
3110 | data.push({ x: x, y: y, z: z });
|
3111 | }
|
3112 | }
|
3113 | }
|
3114 |
|
3115 | // specify options
|
3116 | var options = {
|
3117 | width: "600px",
|
3118 | height: "600px",
|
3119 | style: style,
|
3120 | xBarWidth: xBarWidth,
|
3121 | yBarWidth: yBarWidth,
|
3122 | showPerspective: showPerspective,
|
3123 | showGrid: true,
|
3124 | showShadow: false,
|
3125 | keepAspectRatio: true,
|
3126 | verticalRatio: 0.5
|
3127 | };
|
3128 |
|
3129 | var camera = graph ? graph.getCameraPosition() : null;
|
3130 |
|
3131 | // create our graph
|
3132 | var container = document.getElementById("mygraph");
|
3133 | graph = new vis.Graph3d(container, data, options);
|
3134 |
|
3135 | if (camera) graph.setCameraPosition(camera); // restore camera position
|
3136 |
|
3137 | document.getElementById("style").onchange = drawVisualization;
|
3138 | document.getElementById("perspective").onchange = drawVisualization;
|
3139 | document.getElementById("xBarWidth").onchange = drawVisualization;
|
3140 | document.getElementById("yBarWidth").onchange = drawVisualization;
|
3141 | }
|
3142 |
|
3143 | window.addEventListener("load", () => {
|
3144 | drawVisualization();
|
3145 | });
|
3146 | '
|
3147 | /><input
|
3148 | type="hidden"
|
3149 | name="css"
|
3150 | value="body {
|
3151 | font: 10pt arial;
|
3152 | }
|
3153 | "
|
3154 | /><input
|
3155 | type="hidden"
|
3156 | name="html"
|
3157 | value='<p>
|
3158 | <label for="style">
|
3159 | Style:
|
3160 | <select id="style">
|
3161 | <option value="bar">bar</option>
|
3162 | <option value="bar-color">bar-color</option>
|
3163 | <option value="bar-size">bar-size</option>
|
3164 |
|
3165 | <option value="dot">dot</option>
|
3166 | <option value="dot-line">dot-line</option>
|
3167 | <option value="dot-color">dot-color</option>
|
3168 | <option value="dot-size">dot-size</option>
|
3169 |
|
3170 | <option value="grid">grid</option>
|
3171 | <option value="line">line</option>
|
3172 | <option value="surface">surface</option>
|
3173 | </select>
|
3174 | </label>
|
3175 | </p>
|
3176 |
|
3177 | <p>
|
3178 | <label for="perspective">
|
3179 | <input type="checkbox" id="perspective" checked /> Show perspective
|
3180 | </label>
|
3181 | </p>
|
3182 |
|
3183 | <p>
|
3184 | <label for="xBarWidth">
|
3185 | Bar width X:
|
3186 | <input type="text" id="xBarWidth" value style="width:50px;" /> (only
|
3187 | applicable for styles &quot;bar&quot; and &quot;bar-color&quot;)
|
3188 | </label>
|
3189 | </p>
|
3190 | <p>
|
3191 | <label for="yBarWidth">
|
3192 | Bar width Y:
|
3193 | <input type="text" id="yBarWidth" value style="width:50px;" /> (only
|
3194 | applicable for styles &quot;bar&quot; and &quot;bar-color&quot;)
|
3195 | </label>
|
3196 | </p>
|
3197 |
|
3198 | <div id="mygraph"></div>
|
3199 |
|
3200 | <div id="info"></div>
|
3201 | '
|
3202 | /></form
|
3203 | ></span>
|
3204 | </div>
|
3205 | <a href="graph3d/10_styling.html"
|
3206 | ><div class="example-image">
|
3207 | <img
|
3208 | src="thumbnails/5692720dbea5649cf26f16fdee0735e311e3f2eaa6af7c9404b3a1fdb906fbe3.png"
|
3209 | alt="Styling"
|
3210 | /></div></a></span
|
3211 | ><span class="example-link"
|
3212 | ><div>
|
3213 | <a href="graph3d/15_styling_per_point.html">Styling per Point</a
|
3214 | ><span class="playgrounds"
|
3215 | ><form
|
3216 | action="http://jsfiddle.net/api/post/library/pure/"
|
3217 | method="post"
|
3218 | target="_blank"
|
3219 | >
|
3220 | <button class="icon jsfiddle" alt="JSFiddle" title="JSFiddle">
|
3221 |  </button
|
3222 | ><input
|
3223 | type="hidden"
|
3224 | name="js"
|
3225 | value='var data = null;
|
3226 | var graph = null;
|
3227 |
|
3228 | function custom(x, y) {
|
3229 | return -Math.sin(x / Math.PI) * Math.cos(y / Math.PI) * 10 + 10;
|
3230 | }
|
3231 |
|
3232 | // Called when the Visualization API is loaded.
|
3233 | function drawVisualization() {
|
3234 | var style = document.getElementById("style").value;
|
3235 | var showPerspective = document.getElementById("perspective").checked;
|
3236 | var xBarWidth =
|
3237 | parseFloat(document.getElementById("xBarWidth").value) || undefined;
|
3238 | var yBarWidth =
|
3239 | parseFloat(document.getElementById("yBarWidth").value) || undefined;
|
3240 | var withValue =
|
3241 | ["bar-color", "bar-size", "dot-size", "dot-color"].indexOf(style) != -1;
|
3242 |
|
3243 | // Create and populate a data table.
|
3244 | data = [];
|
3245 | colors = ["red", "orange", "yellow", "green", "blue", "indigo", "violet"];
|
3246 |
|
3247 | // create some nice looking data with sin/cos
|
3248 | var steps = 7; // number of datapoints will be steps*steps
|
3249 | var axisMax = 12;
|
3250 | var axisStep = axisMax / steps;
|
3251 | for (var x = 0; x <= axisMax; x += axisStep) {
|
3252 | for (var y = 0; y <= axisMax; y += axisStep) {
|
3253 | var z = custom(x, y);
|
3254 | if (withValue) {
|
3255 | data.push({
|
3256 | x: x,
|
3257 | y: y,
|
3258 | z: z,
|
3259 | style: {
|
3260 | fill: colors[x / axisStep],
|
3261 | stroke: "#999"
|
3262 | }
|
3263 | });
|
3264 | } else {
|
3265 | data.push({ x: x, y: y, z: z });
|
3266 | }
|
3267 | }
|
3268 | }
|
3269 |
|
3270 | // specify options
|
3271 | var options = {
|
3272 | width: "600px",
|
3273 | height: "600px",
|
3274 | style: style,
|
3275 | xBarWidth: xBarWidth,
|
3276 | yBarWidth: yBarWidth,
|
3277 | showPerspective: showPerspective,
|
3278 | showGrid: true,
|
3279 | showShadow: false,
|
3280 | keepAspectRatio: true,
|
3281 | verticalRatio: 0.5
|
3282 | };
|
3283 |
|
3284 | var camera = graph ? graph.getCameraPosition() : null;
|
3285 |
|
3286 | // create our graph
|
3287 | var container = document.getElementById("mygraph");
|
3288 | graph = new vis.Graph3d(container, data, options);
|
3289 |
|
3290 | if (camera) graph.setCameraPosition(camera); // restore camera position
|
3291 |
|
3292 | document.getElementById("style").onchange = drawVisualization;
|
3293 | document.getElementById("perspective").onchange = drawVisualization;
|
3294 | document.getElementById("xBarWidth").onchange = drawVisualization;
|
3295 | document.getElementById("yBarWidth").onchange = drawVisualization;
|
3296 | }
|
3297 |
|
3298 | window.addEventListener("load", () => {
|
3299 | drawVisualization();
|
3300 | });
|
3301 | '
|
3302 | /><input
|
3303 | type="hidden"
|
3304 | name="css"
|
3305 | value="body {
|
3306 | font: 10pt arial;
|
3307 | }
|
3308 | "
|
3309 | /><input
|
3310 | type="hidden"
|
3311 | name="html"
|
3312 | value='<p>
|
3313 | <label for="style">
|
3314 | Style:
|
3315 | <select id="style">
|
3316 | <option value="bar">bar</option>
|
3317 | <option value="bar-color" selected>bar-color</option>
|
3318 | <option value="bar-size">bar-size</option>
|
3319 |
|
3320 | <option value="dot">dot</option>
|
3321 | <option value="dot-line">dot-line</option>
|
3322 | <option value="dot-color">dot-color</option>
|
3323 | <option value="dot-size">dot-size</option>
|
3324 |
|
3325 | <option value="grid">grid</option>
|
3326 | <option value="line">line</option>
|
3327 | <option value="surface">surface</option>
|
3328 | </select>
|
3329 | </label>
|
3330 | </p>
|
3331 |
|
3332 | <p>
|
3333 | <label for="perspective">
|
3334 | <input type="checkbox" id="perspective" checked /> Show perspective
|
3335 | </label>
|
3336 | </p>
|
3337 |
|
3338 | <p>
|
3339 | <label for="xBarWidth">
|
3340 | Bar width X:
|
3341 | <input type="text" id="xBarWidth" value style="width:50px;" /> (only
|
3342 | applicable for styles &quot;bar&quot; and &quot;bar-color&quot;)
|
3343 | </label>
|
3344 | </p>
|
3345 | <p>
|
3346 | <label for="yBarWidth">
|
3347 | Bar width Y:
|
3348 | <input type="text" id="yBarWidth" value style="width:50px;" /> (only
|
3349 | applicable for styles &quot;bar&quot; and &quot;bar-color&quot;)
|
3350 | </label>
|
3351 | </p>
|
3352 |
|
3353 | <div id="mygraph"></div>
|
3354 |
|
3355 | <div id="info"></div>
|
3356 | '
|
3357 | /><input
|
3358 | type="hidden"
|
3359 | name="resources"
|
3360 | value="https://visjs.github.io/vis-graph3d/dist/vis-graph3d.min.js"
|
3361 | /><input type="hidden" name="wrap" value="b" /><input
|
3362 | type="hidden"
|
3363 | name="title"
|
3364 | value="Graph 3D | Styling per Point"
|
3365 | />
|
3366 | </form>
|
3367 |
|
3368 | <form
|
3369 | action="https://codepen.io/pen/define"
|
3370 | method="post"
|
3371 | target="_blank"
|
3372 | >
|
3373 | <button class="icon codepen" alt="CodePen" title="CodePen">
|
3374 |  </button
|
3375 | ><input
|
3376 | type="hidden"
|
3377 | name="data"
|
3378 | value='{"css":"body {\n font: 10pt arial;\n}\n","css_external":"","html":"<p>\n <label for=\"style\">\n Style:\n <select id=\"style\">\n <option value=\"bar\">bar</option>\n <option value=\"bar-color\" selected>bar-color</option>\n <option value=\"bar-size\">bar-size</option>\n\n <option value=\"dot\">dot</option>\n <option value=\"dot-line\">dot-line</option>\n <option value=\"dot-color\">dot-color</option>\n <option value=\"dot-size\">dot-size</option>\n\n <option value=\"grid\">grid</option>\n <option value=\"line\">line</option>\n <option value=\"surface\">surface</option>\n </select>\n </label>\n</p>\n\n<p>\n <label for=\"perspective\">\n <input type=\"checkbox\" id=\"perspective\" checked /> Show perspective\n </label>\n</p>\n\n<p>\n <label for=\"xBarWidth\">\n Bar width X:\n <input type=\"text\" id=\"xBarWidth\" value style=\"width:50px;\" /> (only\n applicable for styles &quot;bar&quot; and &quot;bar-color&quot;)\n </label>\n</p>\n<p>\n <label for=\"yBarWidth\">\n Bar width Y:\n <input type=\"text\" id=\"yBarWidth\" value style=\"width:50px;\" /> (only\n applicable for styles &quot;bar&quot; and &quot;bar-color&quot;)\n </label>\n</p>\n\n<div id=\"mygraph\"></div>\n\n<div id=\"info\"></div>\n","js":"var data = null;\nvar graph = null;\n\nfunction custom(x, y) {\n return -Math.sin(x / Math.PI) * Math.cos(y / Math.PI) * 10 + 10;\n}\n\n// Called when the Visualization API is loaded.\nfunction drawVisualization() {\n var style = document.getElementById(\"style\").value;\n var showPerspective = document.getElementById(\"perspective\").checked;\n var xBarWidth =\n parseFloat(document.getElementById(\"xBarWidth\").value) || undefined;\n var yBarWidth =\n parseFloat(document.getElementById(\"yBarWidth\").value) || undefined;\n var withValue =\n [\"bar-color\", \"bar-size\", \"dot-size\", \"dot-color\"].indexOf(style) != -1;\n\n // Create and populate a data table.\n data = [];\n colors = [\"red\", \"orange\", \"yellow\", \"green\", \"blue\", \"indigo\", \"violet\"];\n\n // create some nice looking data with sin/cos\n var steps = 7; // number of datapoints will be steps*steps\n var axisMax = 12;\n var axisStep = axisMax / steps;\n for (var x = 0; x <= axisMax; x += axisStep) {\n for (var y = 0; y <= axisMax; y += axisStep) {\n var z = custom(x, y);\n if (withValue) {\n data.push({\n x: x,\n y: y,\n z: z,\n style: {\n fill: colors[x / axisStep],\n stroke: \"#999\"\n }\n });\n } else {\n data.push({ x: x, y: y, z: z });\n }\n }\n }\n\n // specify options\n var options = {\n width: \"600px\",\n height: \"600px\",\n style: style,\n xBarWidth: xBarWidth,\n yBarWidth: yBarWidth,\n showPerspective: showPerspective,\n showGrid: true,\n showShadow: false,\n keepAspectRatio: true,\n verticalRatio: 0.5\n };\n\n var camera = graph ? graph.getCameraPosition() : null;\n\n // create our graph\n var container = document.getElementById(\"mygraph\");\n graph = new vis.Graph3d(container, data, options);\n\n if (camera) graph.setCameraPosition(camera); // restore camera position\n\n document.getElementById(\"style\").onchange = drawVisualization;\n document.getElementById(\"perspective\").onchange = drawVisualization;\n document.getElementById(\"xBarWidth\").onchange = drawVisualization;\n document.getElementById(\"yBarWidth\").onchange = drawVisualization;\n}\n\nwindow.addEventListener(\"load\", () => {\n drawVisualization();\n});\n","js_external":"https://visjs.github.io/vis-graph3d/dist/vis-graph3d.min.js","title":"Graph 3D | Styling per Point"}'
|
3379 | /><input
|
3380 | type="hidden"
|
3381 | name="js"
|
3382 | value='var data = null;
|
3383 | var graph = null;
|
3384 |
|
3385 | function custom(x, y) {
|
3386 | return -Math.sin(x / Math.PI) * Math.cos(y / Math.PI) * 10 + 10;
|
3387 | }
|
3388 |
|
3389 | // Called when the Visualization API is loaded.
|
3390 | function drawVisualization() {
|
3391 | var style = document.getElementById("style").value;
|
3392 | var showPerspective = document.getElementById("perspective").checked;
|
3393 | var xBarWidth =
|
3394 | parseFloat(document.getElementById("xBarWidth").value) || undefined;
|
3395 | var yBarWidth =
|
3396 | parseFloat(document.getElementById("yBarWidth").value) || undefined;
|
3397 | var withValue =
|
3398 | ["bar-color", "bar-size", "dot-size", "dot-color"].indexOf(style) != -1;
|
3399 |
|
3400 | // Create and populate a data table.
|
3401 | data = [];
|
3402 | colors = ["red", "orange", "yellow", "green", "blue", "indigo", "violet"];
|
3403 |
|
3404 | // create some nice looking data with sin/cos
|
3405 | var steps = 7; // number of datapoints will be steps*steps
|
3406 | var axisMax = 12;
|
3407 | var axisStep = axisMax / steps;
|
3408 | for (var x = 0; x <= axisMax; x += axisStep) {
|
3409 | for (var y = 0; y <= axisMax; y += axisStep) {
|
3410 | var z = custom(x, y);
|
3411 | if (withValue) {
|
3412 | data.push({
|
3413 | x: x,
|
3414 | y: y,
|
3415 | z: z,
|
3416 | style: {
|
3417 | fill: colors[x / axisStep],
|
3418 | stroke: "#999"
|
3419 | }
|
3420 | });
|
3421 | } else {
|
3422 | data.push({ x: x, y: y, z: z });
|
3423 | }
|
3424 | }
|
3425 | }
|
3426 |
|
3427 | // specify options
|
3428 | var options = {
|
3429 | width: "600px",
|
3430 | height: "600px",
|
3431 | style: style,
|
3432 | xBarWidth: xBarWidth,
|
3433 | yBarWidth: yBarWidth,
|
3434 | showPerspective: showPerspective,
|
3435 | showGrid: true,
|
3436 | showShadow: false,
|
3437 | keepAspectRatio: true,
|
3438 | verticalRatio: 0.5
|
3439 | };
|
3440 |
|
3441 | var camera = graph ? graph.getCameraPosition() : null;
|
3442 |
|
3443 | // create our graph
|
3444 | var container = document.getElementById("mygraph");
|
3445 | graph = new vis.Graph3d(container, data, options);
|
3446 |
|
3447 | if (camera) graph.setCameraPosition(camera); // restore camera position
|
3448 |
|
3449 | document.getElementById("style").onchange = drawVisualization;
|
3450 | document.getElementById("perspective").onchange = drawVisualization;
|
3451 | document.getElementById("xBarWidth").onchange = drawVisualization;
|
3452 | document.getElementById("yBarWidth").onchange = drawVisualization;
|
3453 | }
|
3454 |
|
3455 | window.addEventListener("load", () => {
|
3456 | drawVisualization();
|
3457 | });
|
3458 | '
|
3459 | /><input
|
3460 | type="hidden"
|
3461 | name="css"
|
3462 | value="body {
|
3463 | font: 10pt arial;
|
3464 | }
|
3465 | "
|
3466 | /><input
|
3467 | type="hidden"
|
3468 | name="html"
|
3469 | value='<p>
|
3470 | <label for="style">
|
3471 | Style:
|
3472 | <select id="style">
|
3473 | <option value="bar">bar</option>
|
3474 | <option value="bar-color" selected>bar-color</option>
|
3475 | <option value="bar-size">bar-size</option>
|
3476 |
|
3477 | <option value="dot">dot</option>
|
3478 | <option value="dot-line">dot-line</option>
|
3479 | <option value="dot-color">dot-color</option>
|
3480 | <option value="dot-size">dot-size</option>
|
3481 |
|
3482 | <option value="grid">grid</option>
|
3483 | <option value="line">line</option>
|
3484 | <option value="surface">surface</option>
|
3485 | </select>
|
3486 | </label>
|
3487 | </p>
|
3488 |
|
3489 | <p>
|
3490 | <label for="perspective">
|
3491 | <input type="checkbox" id="perspective" checked /> Show perspective
|
3492 | </label>
|
3493 | </p>
|
3494 |
|
3495 | <p>
|
3496 | <label for="xBarWidth">
|
3497 | Bar width X:
|
3498 | <input type="text" id="xBarWidth" value style="width:50px;" /> (only
|
3499 | applicable for styles &quot;bar&quot; and &quot;bar-color&quot;)
|
3500 | </label>
|
3501 | </p>
|
3502 | <p>
|
3503 | <label for="yBarWidth">
|
3504 | Bar width Y:
|
3505 | <input type="text" id="yBarWidth" value style="width:50px;" /> (only
|
3506 | applicable for styles &quot;bar&quot; and &quot;bar-color&quot;)
|
3507 | </label>
|
3508 | </p>
|
3509 |
|
3510 | <div id="mygraph"></div>
|
3511 |
|
3512 | <div id="info"></div>
|
3513 | '
|
3514 | /></form
|
3515 | ></span>
|
3516 | </div>
|
3517 | <a href="graph3d/15_styling_per_point.html"
|
3518 | ><div class="example-image">
|
3519 | <img
|
3520 | src="thumbnails/c83e4c80b92f79205c976318a5d1f7be8b08dd8f68c242177458bbacc2f3465c.png"
|
3521 | alt="Styling per Point"
|
3522 | /></div></a></span
|
3523 | ><span class="example-link"
|
3524 | ><div>
|
3525 | <a href="graph3d/11_tooltips.html">Tooltips</a
|
3526 | ><span class="playgrounds"
|
3527 | ><form
|
3528 | action="http://jsfiddle.net/api/post/library/pure/"
|
3529 | method="post"
|
3530 | target="_blank"
|
3531 | >
|
3532 | <button class="icon jsfiddle" alt="JSFiddle" title="JSFiddle">
|
3533 |  </button
|
3534 | ><input
|
3535 | type="hidden"
|
3536 | name="js"
|
3537 | value='var data = null;
|
3538 | var graph = null;
|
3539 |
|
3540 | function custom(x, y) {
|
3541 | return -Math.sin(x / Math.PI) * Math.cos(y / Math.PI) * 10 + 10;
|
3542 | }
|
3543 |
|
3544 | // Called when the Visualization API is loaded.
|
3545 | function drawVisualization() {
|
3546 | var style = document.getElementById("style").value;
|
3547 | var withValue =
|
3548 | ["bar-color", "bar-size", "dot-size", "dot-color"].indexOf(style) != -1;
|
3549 |
|
3550 | // Create and populate a data table.
|
3551 | data = new vis.DataSet();
|
3552 | var extra_content = [
|
3553 | "Arbitrary information",
|
3554 | "You can access data from the point source object",
|
3555 | "Tooltip example content"
|
3556 | ];
|
3557 |
|
3558 | // create some nice looking data with sin/cos
|
3559 | var steps = 5; // number of datapoints will be steps*steps
|
3560 | var axisMax = 10;
|
3561 | var axisStep = axisMax / steps;
|
3562 | for (var x = 0; x <= axisMax; x += axisStep) {
|
3563 | for (var y = 0; y <= axisMax; y += axisStep) {
|
3564 | var z = custom(x, y);
|
3565 | if (withValue) {
|
3566 | var value = y - x;
|
3567 | data.add({
|
3568 | x: x,
|
3569 | y: y,
|
3570 | z: z,
|
3571 | style: value,
|
3572 | extra: extra_content[(x * y) % extra_content.length]
|
3573 | });
|
3574 | } else {
|
3575 | data.add({
|
3576 | x: x,
|
3577 | y: y,
|
3578 | z: z,
|
3579 | extra: extra_content[(x * y) % extra_content.length]
|
3580 | });
|
3581 | }
|
3582 | }
|
3583 | }
|
3584 |
|
3585 | // specify options
|
3586 | var options = {
|
3587 | width: "600px",
|
3588 | height: "600px",
|
3589 | style: style,
|
3590 | showPerspective: true,
|
3591 | showLegend: true,
|
3592 | showGrid: true,
|
3593 | showShadow: false,
|
3594 |
|
3595 | // Option tooltip can be true, false, or a function returning a string with HTML contents
|
3596 | tooltip: function(point) {
|
3597 | // parameter point contains properties x, y, z, and data
|
3598 | // data is the original object passed to the point constructor
|
3599 | return "value: <b>" + point.z + "</b><br>" + point.data.extra;
|
3600 | },
|
3601 |
|
3602 | // Tooltip default styling can be overridden
|
3603 | tooltipStyle: {
|
3604 | content: {
|
3605 | background: "rgba(255, 255, 255, 0.7)",
|
3606 | padding: "10px",
|
3607 | borderRadius: "10px"
|
3608 | },
|
3609 | line: {
|
3610 | borderLeft: "1px dotted rgba(0, 0, 0, 0.5)"
|
3611 | },
|
3612 | dot: {
|
3613 | border: "5px solid rgba(0, 0, 0, 0.5)"
|
3614 | }
|
3615 | },
|
3616 |
|
3617 | keepAspectRatio: true,
|
3618 | verticalRatio: 0.5
|
3619 | };
|
3620 |
|
3621 | var camera = graph ? graph.getCameraPosition() : null;
|
3622 |
|
3623 | // create our graph
|
3624 | var container = document.getElementById("mygraph");
|
3625 | graph = new vis.Graph3d(container, data, options);
|
3626 |
|
3627 | if (camera) graph.setCameraPosition(camera); // restore camera position
|
3628 |
|
3629 | document.getElementById("style").onchange = drawVisualization;
|
3630 | }
|
3631 |
|
3632 | window.addEventListener("load", () => {
|
3633 | drawVisualization();
|
3634 | });
|
3635 | '
|
3636 | /><input
|
3637 | type="hidden"
|
3638 | name="css"
|
3639 | value="body {
|
3640 | font: 10pt arial;
|
3641 | }
|
3642 | div#info {
|
3643 | width: 600px;
|
3644 | text-align: center;
|
3645 | margin-top: 2em;
|
3646 | font-size: 1.2em;
|
3647 | }
|
3648 | "
|
3649 | /><input
|
3650 | type="hidden"
|
3651 | name="html"
|
3652 | value='<p>
|
3653 | <label for="style">
|
3654 | Style:
|
3655 | <select id="style">
|
3656 | <option value="bar">bar</option>
|
3657 | <option value="bar-color">bar-color</option>
|
3658 | <option value="bar-size">bar-size</option>
|
3659 |
|
3660 | <option value="dot">dot</option>
|
3661 | <option value="dot-line">dot-line</option>
|
3662 | <option value="dot-color">dot-color</option>
|
3663 | <option value="dot-size">dot-size</option>
|
3664 |
|
3665 | <option value="grid">grid</option>
|
3666 | <option value="line">line</option>
|
3667 | <option value="surface">surface</option>
|
3668 | </select>
|
3669 | </label>
|
3670 | </p>
|
3671 |
|
3672 | <div id="mygraph"></div>
|
3673 |
|
3674 | <div id="info">Hover the mouse cursor over the graph to see tooltips.</div>
|
3675 | '
|
3676 | /><input
|
3677 | type="hidden"
|
3678 | name="resources"
|
3679 | value="https://visjs.github.io/vis-graph3d/dist/vis-graph3d.min.js"
|
3680 | /><input type="hidden" name="wrap" value="b" /><input
|
3681 | type="hidden"
|
3682 | name="title"
|
3683 | value="Graph 3D | Tooltips"
|
3684 | />
|
3685 | </form>
|
3686 |
|
3687 | <form
|
3688 | action="https://codepen.io/pen/define"
|
3689 | method="post"
|
3690 | target="_blank"
|
3691 | >
|
3692 | <button class="icon codepen" alt="CodePen" title="CodePen">
|
3693 |  </button
|
3694 | ><input
|
3695 | type="hidden"
|
3696 | name="data"
|
3697 | value='{"css":"body {\n font: 10pt arial;\n}\ndiv#info {\n width: 600px;\n text-align: center;\n margin-top: 2em;\n font-size: 1.2em;\n}\n","css_external":"","html":"<p>\n <label for=\"style\">\n Style:\n <select id=\"style\">\n <option value=\"bar\">bar</option>\n <option value=\"bar-color\">bar-color</option>\n <option value=\"bar-size\">bar-size</option>\n\n <option value=\"dot\">dot</option>\n <option value=\"dot-line\">dot-line</option>\n <option value=\"dot-color\">dot-color</option>\n <option value=\"dot-size\">dot-size</option>\n\n <option value=\"grid\">grid</option>\n <option value=\"line\">line</option>\n <option value=\"surface\">surface</option>\n </select>\n </label>\n</p>\n\n<div id=\"mygraph\"></div>\n\n<div id=\"info\">Hover the mouse cursor over the graph to see tooltips.</div>\n","js":"var data = null;\nvar graph = null;\n\nfunction custom(x, y) {\n return -Math.sin(x / Math.PI) * Math.cos(y / Math.PI) * 10 + 10;\n}\n\n// Called when the Visualization API is loaded.\nfunction drawVisualization() {\n var style = document.getElementById(\"style\").value;\n var withValue =\n [\"bar-color\", \"bar-size\", \"dot-size\", \"dot-color\"].indexOf(style) != -1;\n\n // Create and populate a data table.\n data = new vis.DataSet();\n var extra_content = [\n \"Arbitrary information\",\n \"You can access data from the point source object\",\n \"Tooltip example content\"\n ];\n\n // create some nice looking data with sin/cos\n var steps = 5; // number of datapoints will be steps*steps\n var axisMax = 10;\n var axisStep = axisMax / steps;\n for (var x = 0; x <= axisMax; x += axisStep) {\n for (var y = 0; y <= axisMax; y += axisStep) {\n var z = custom(x, y);\n if (withValue) {\n var value = y - x;\n data.add({\n x: x,\n y: y,\n z: z,\n style: value,\n extra: extra_content[(x * y) % extra_content.length]\n });\n } else {\n data.add({\n x: x,\n y: y,\n z: z,\n extra: extra_content[(x * y) % extra_content.length]\n });\n }\n }\n }\n\n // specify options\n var options = {\n width: \"600px\",\n height: \"600px\",\n style: style,\n showPerspective: true,\n showLegend: true,\n showGrid: true,\n showShadow: false,\n\n // Option tooltip can be true, false, or a function returning a string with HTML contents\n tooltip: function(point) {\n // parameter point contains properties x, y, z, and data\n // data is the original object passed to the point constructor\n return \"value: <b>\" + point.z + \"</b><br>\" + point.data.extra;\n },\n\n // Tooltip default styling can be overridden\n tooltipStyle: {\n content: {\n background: \"rgba(255, 255, 255, 0.7)\",\n padding: \"10px\",\n borderRadius: \"10px\"\n },\n line: {\n borderLeft: \"1px dotted rgba(0, 0, 0, 0.5)\"\n },\n dot: {\n border: \"5px solid rgba(0, 0, 0, 0.5)\"\n }\n },\n\n keepAspectRatio: true,\n verticalRatio: 0.5\n };\n\n var camera = graph ? graph.getCameraPosition() : null;\n\n // create our graph\n var container = document.getElementById(\"mygraph\");\n graph = new vis.Graph3d(container, data, options);\n\n if (camera) graph.setCameraPosition(camera); // restore camera position\n\n document.getElementById(\"style\").onchange = drawVisualization;\n}\n\nwindow.addEventListener(\"load\", () => {\n drawVisualization();\n});\n","js_external":"https://visjs.github.io/vis-graph3d/dist/vis-graph3d.min.js","title":"Graph 3D | Tooltips"}'
|
3698 | /><input
|
3699 | type="hidden"
|
3700 | name="js"
|
3701 | value='var data = null;
|
3702 | var graph = null;
|
3703 |
|
3704 | function custom(x, y) {
|
3705 | return -Math.sin(x / Math.PI) * Math.cos(y / Math.PI) * 10 + 10;
|
3706 | }
|
3707 |
|
3708 | // Called when the Visualization API is loaded.
|
3709 | function drawVisualization() {
|
3710 | var style = document.getElementById("style").value;
|
3711 | var withValue =
|
3712 | ["bar-color", "bar-size", "dot-size", "dot-color"].indexOf(style) != -1;
|
3713 |
|
3714 | // Create and populate a data table.
|
3715 | data = new vis.DataSet();
|
3716 | var extra_content = [
|
3717 | "Arbitrary information",
|
3718 | "You can access data from the point source object",
|
3719 | "Tooltip example content"
|
3720 | ];
|
3721 |
|
3722 | // create some nice looking data with sin/cos
|
3723 | var steps = 5; // number of datapoints will be steps*steps
|
3724 | var axisMax = 10;
|
3725 | var axisStep = axisMax / steps;
|
3726 | for (var x = 0; x <= axisMax; x += axisStep) {
|
3727 | for (var y = 0; y <= axisMax; y += axisStep) {
|
3728 | var z = custom(x, y);
|
3729 | if (withValue) {
|
3730 | var value = y - x;
|
3731 | data.add({
|
3732 | x: x,
|
3733 | y: y,
|
3734 | z: z,
|
3735 | style: value,
|
3736 | extra: extra_content[(x * y) % extra_content.length]
|
3737 | });
|
3738 | } else {
|
3739 | data.add({
|
3740 | x: x,
|
3741 | y: y,
|
3742 | z: z,
|
3743 | extra: extra_content[(x * y) % extra_content.length]
|
3744 | });
|
3745 | }
|
3746 | }
|
3747 | }
|
3748 |
|
3749 | // specify options
|
3750 | var options = {
|
3751 | width: "600px",
|
3752 | height: "600px",
|
3753 | style: style,
|
3754 | showPerspective: true,
|
3755 | showLegend: true,
|
3756 | showGrid: true,
|
3757 | showShadow: false,
|
3758 |
|
3759 | // Option tooltip can be true, false, or a function returning a string with HTML contents
|
3760 | tooltip: function(point) {
|
3761 | // parameter point contains properties x, y, z, and data
|
3762 | // data is the original object passed to the point constructor
|
3763 | return "value: <b>" + point.z + "</b><br>" + point.data.extra;
|
3764 | },
|
3765 |
|
3766 | // Tooltip default styling can be overridden
|
3767 | tooltipStyle: {
|
3768 | content: {
|
3769 | background: "rgba(255, 255, 255, 0.7)",
|
3770 | padding: "10px",
|
3771 | borderRadius: "10px"
|
3772 | },
|
3773 | line: {
|
3774 | borderLeft: "1px dotted rgba(0, 0, 0, 0.5)"
|
3775 | },
|
3776 | dot: {
|
3777 | border: "5px solid rgba(0, 0, 0, 0.5)"
|
3778 | }
|
3779 | },
|
3780 |
|
3781 | keepAspectRatio: true,
|
3782 | verticalRatio: 0.5
|
3783 | };
|
3784 |
|
3785 | var camera = graph ? graph.getCameraPosition() : null;
|
3786 |
|
3787 | // create our graph
|
3788 | var container = document.getElementById("mygraph");
|
3789 | graph = new vis.Graph3d(container, data, options);
|
3790 |
|
3791 | if (camera) graph.setCameraPosition(camera); // restore camera position
|
3792 |
|
3793 | document.getElementById("style").onchange = drawVisualization;
|
3794 | }
|
3795 |
|
3796 | window.addEventListener("load", () => {
|
3797 | drawVisualization();
|
3798 | });
|
3799 | '
|
3800 | /><input
|
3801 | type="hidden"
|
3802 | name="css"
|
3803 | value="body {
|
3804 | font: 10pt arial;
|
3805 | }
|
3806 | div#info {
|
3807 | width: 600px;
|
3808 | text-align: center;
|
3809 | margin-top: 2em;
|
3810 | font-size: 1.2em;
|
3811 | }
|
3812 | "
|
3813 | /><input
|
3814 | type="hidden"
|
3815 | name="html"
|
3816 | value='<p>
|
3817 | <label for="style">
|
3818 | Style:
|
3819 | <select id="style">
|
3820 | <option value="bar">bar</option>
|
3821 | <option value="bar-color">bar-color</option>
|
3822 | <option value="bar-size">bar-size</option>
|
3823 |
|
3824 | <option value="dot">dot</option>
|
3825 | <option value="dot-line">dot-line</option>
|
3826 | <option value="dot-color">dot-color</option>
|
3827 | <option value="dot-size">dot-size</option>
|
3828 |
|
3829 | <option value="grid">grid</option>
|
3830 | <option value="line">line</option>
|
3831 | <option value="surface">surface</option>
|
3832 | </select>
|
3833 | </label>
|
3834 | </p>
|
3835 |
|
3836 | <div id="mygraph"></div>
|
3837 |
|
3838 | <div id="info">Hover the mouse cursor over the graph to see tooltips.</div>
|
3839 | '
|
3840 | /></form
|
3841 | ></span>
|
3842 | </div>
|
3843 | <a href="graph3d/11_tooltips.html"
|
3844 | ><div class="example-image">
|
3845 | <img
|
3846 | src="thumbnails/c053a6307bb0b5efafd118ab07192cd5d3bf6c6b6bbc742d10d8eda2d7bb04e7.png"
|
3847 | alt="Tooltips"
|
3848 | /></div></a></span
|
3849 | ><span class="example-link"
|
3850 | ><div>
|
3851 | <a href="graph3d/rotateAxisLabels/rotateAxisLabels.html"
|
3852 | >WORLD INDEXES BY COUNTRY 2018 MID-YEAR</a
|
3853 | ><span class="playgrounds"
|
3854 | ><form
|
3855 | action="http://jsfiddle.net/api/post/library/pure/"
|
3856 | method="post"
|
3857 | target="_blank"
|
3858 | >
|
3859 | <button class="icon jsfiddle" alt="JSFiddle" title="JSFiddle">
|
3860 |  </button
|
3861 | ><input
|
3862 | type="hidden"
|
3863 | name="js"
|
3864 | value='var graph = null;
|
3865 |
|
3866 | function drawVisualization() {
|
3867 | var style = document.getElementById("style").value;
|
3868 | var withValue =
|
3869 | ["bar-color", "bar-size", "dot-size", "dot-color"].indexOf(style) != -1;
|
3870 |
|
3871 | // Create and populate a data table.
|
3872 | var data = new vis.DataSet();
|
3873 | var extra_content = [];
|
3874 | data.add({
|
3875 | id: "c57621e7d6cfb81",
|
3876 | x: 0,
|
3877 | y: -1,
|
3878 | z: 0,
|
3879 | extra: extra_content[0]
|
3880 | });
|
3881 | var axis_x = {};
|
3882 | var axis_y = {};
|
3883 | var file1 = "world_index_data_small.json?nocache=" + Math.random();
|
3884 | var _width = "1000px";
|
3885 | var _height = "1000px";
|
3886 |
|
3887 | var request = new XMLHttpRequest();
|
3888 | request.open("GET", file1, true);
|
3889 |
|
3890 | function axisLoad(axis_obj, callback) {
|
3891 | Object.keys(axis_obj).forEach(function(field, i) {
|
3892 | callback(axis_obj[field], i);
|
3893 | });
|
3894 | }
|
3895 |
|
3896 | request.onload = function() {
|
3897 | if (request.status >= 200 && request.status < 400) {
|
3898 | var result = JSON.parse(request.responseText);
|
3899 | axisLoad(result.graph3d, function(object, i) {
|
3900 | data.add(object);
|
3901 | });
|
3902 | axisLoad(result.axis_x, function(object, i) {
|
3903 | axis_x[i] = object;
|
3904 | });
|
3905 | axisLoad(result.axis_y, function(object, i) {
|
3906 | axis_y[i] = object;
|
3907 | });
|
3908 | data.remove("c57621e7d6cfb81");
|
3909 | } else {
|
3910 | console.log("ERR: request.onload");
|
3911 | }
|
3912 | };
|
3913 | request.onerror = function() {
|
3914 | console.log("ERR: Connection request");
|
3915 | };
|
3916 | request.send();
|
3917 |
|
3918 | var options = {
|
3919 | width: _width,
|
3920 | height: _height,
|
3921 | style: style,
|
3922 | showPerspective: false,
|
3923 | showLegend: true,
|
3924 | showGrid: true,
|
3925 | showShadow: true,
|
3926 | xLabel: "COUNTRY",
|
3927 | yLabel: "INDEX",
|
3928 | zLabel: "PERCENT",
|
3929 | legendLabel: "value",
|
3930 | rotateAxisLabels: true,
|
3931 | axisColor: "#41413C",
|
3932 | axisFontType: "courier",
|
3933 | axisFontSize: 30,
|
3934 | gridColor: "#5590CC",
|
3935 | backgroundColor: "white",
|
3936 | dataColor: {
|
3937 | fill: "green",
|
3938 | stroke: "green",
|
3939 | strokeWidth: 2
|
3940 | },
|
3941 | cameraPosition: {
|
3942 | horizontal: 0,
|
3943 | vertical: 2,
|
3944 | distance: 2.3
|
3945 | },
|
3946 | tooltip: function(point) {
|
3947 | return (
|
3948 | "value: <b>" +
|
3949 | point.z +
|
3950 | "%</b><br>" +
|
3951 | axis_x[point.x] +
|
3952 | "</b><br>" +
|
3953 | axis_y[point.y]
|
3954 | );
|
3955 | },
|
3956 | tooltipDelay: 0,
|
3957 | tooltipStyle: {
|
3958 | content: {
|
3959 | background: "rgba(255, 255, 255, 0.7)",
|
3960 | padding: "10px",
|
3961 | borderRadius: "10px"
|
3962 | },
|
3963 | line: {
|
3964 | borderLeft: "1px dotted rgba(0, 0, 0, 0.5)"
|
3965 | },
|
3966 | dot: {
|
3967 | border: "5px solid rgba(0, 0, 0, 0.5)"
|
3968 | }
|
3969 | },
|
3970 | keepAspectRatio: false,
|
3971 | verticalRatio: 0.5,
|
3972 | xBarWidth: 1,
|
3973 | yBarWidth: 1,
|
3974 | xStep: 1,
|
3975 | yStep: 1,
|
3976 | xCenter: "50%",
|
3977 | yCenter: "25%",
|
3978 | xValueLabel: function(value) {
|
3979 | return "" + axis_x[value.toString()];
|
3980 | },
|
3981 | yValueLabel: function(value) {
|
3982 | return "" + axis_y[value.toString()];
|
3983 | },
|
3984 | zValueLabel: function(value) {
|
3985 | return value + "%";
|
3986 | }
|
3987 | };
|
3988 | var camera = graph ? graph.getCameraPosition() : null;
|
3989 | var container = document.getElementById("mygraph");
|
3990 | graph = new vis.Graph3d(container, data, options);
|
3991 | if (camera) graph.setCameraPosition(camera);
|
3992 | document.getElementById("style").onchange = drawVisualization;
|
3993 | }
|
3994 |
|
3995 | window.addEventListener("load", () => {
|
3996 | drawVisualization();
|
3997 | });
|
3998 | '
|
3999 | /><input
|
4000 | type="hidden"
|
4001 | name="css"
|
4002 | value="body {
|
4003 | font: 10pt arial;
|
4004 | }
|
4005 | div#info {
|
4006 | width: 500px;
|
4007 | text-align: center;
|
4008 | margin-top: 2em;
|
4009 | font-size: 1.2em;
|
4010 | }
|
4011 | span#graphHead,
|
4012 | span#updateTime,
|
4013 | span#startTime,
|
4014 | span#endTime {
|
4015 | font: 10pt arial;
|
4016 | font-weight: bold;
|
4017 | text-align: center;
|
4018 | }
|
4019 | "
|
4020 | /><input
|
4021 | type="hidden"
|
4022 | name="html"
|
4023 | value='<p>
|
4024 | <label for="style">
|
4025 | Style:
|
4026 | <select id="style">
|
4027 | <option value="bar">bar</option>
|
4028 | <option value="dot">dot</option>
|
4029 | <option value="dot-line">dot-line</option>
|
4030 | </select>
|
4031 | </label>
|
4032 | </p>
|
4033 | <div style="text-align: center; width: 1024px;">
|
4034 | <span id="graphHead">WORLD INDEXES BY COUNTRY 2018 MID-YEAR</span><br />
|
4035 | <span id="updateTime"></span><br />
|
4036 | <span id="startTime"></span><br />
|
4037 | <span id="endTime"></span><br />
|
4038 | <div id="mygraph" height="470px"></div>
|
4039 | <div id="info">Hover the mouse cursor over the graph to see tooltips.</div>
|
4040 | </div>
|
4041 | '
|
4042 | /><input
|
4043 | type="hidden"
|
4044 | name="resources"
|
4045 | value="https://visjs.github.io/vis-graph3d/dist/vis-graph3d.min.js"
|
4046 | /><input type="hidden" name="wrap" value="b" /><input
|
4047 | type="hidden"
|
4048 | name="title"
|
4049 | value="Graph 3D | WORLD INDEXES BY COUNTRY 2018 MID-YEAR"
|
4050 | />
|
4051 | </form>
|
4052 |
|
4053 | <form
|
4054 | action="https://codepen.io/pen/define"
|
4055 | method="post"
|
4056 | target="_blank"
|
4057 | >
|
4058 | <button class="icon codepen" alt="CodePen" title="CodePen">
|
4059 |  </button
|
4060 | ><input
|
4061 | type="hidden"
|
4062 | name="data"
|
4063 | value='{"css":"body {\n font: 10pt arial;\n}\ndiv#info {\n width: 500px;\n text-align: center;\n margin-top: 2em;\n font-size: 1.2em;\n}\nspan#graphHead,\nspan#updateTime,\nspan#startTime,\nspan#endTime {\n font: 10pt arial;\n font-weight: bold;\n text-align: center;\n}\n","css_external":"","html":"<p>\n <label for=\"style\">\n Style:\n <select id=\"style\">\n <option value=\"bar\">bar</option>\n <option value=\"dot\">dot</option>\n <option value=\"dot-line\">dot-line</option>\n </select>\n </label>\n</p>\n<div style=\"text-align: center; width: 1024px;\">\n <span id=\"graphHead\">WORLD INDEXES BY COUNTRY 2018 MID-YEAR</span><br />\n <span id=\"updateTime\"></span><br />\n <span id=\"startTime\"></span><br />\n <span id=\"endTime\"></span><br />\n <div id=\"mygraph\" height=\"470px\"></div>\n <div id=\"info\">Hover the mouse cursor over the graph to see tooltips.</div>\n</div>\n","js":"var graph = null;\n\nfunction drawVisualization() {\n var style = document.getElementById(\"style\").value;\n var withValue =\n [\"bar-color\", \"bar-size\", \"dot-size\", \"dot-color\"].indexOf(style) != -1;\n\n // Create and populate a data table.\n var data = new vis.DataSet();\n var extra_content = [];\n data.add({\n id: \"c57621e7d6cfb81\",\n x: 0,\n y: -1,\n z: 0,\n extra: extra_content[0]\n });\n var axis_x = {};\n var axis_y = {};\n var file1 = \"world_index_data_small.json?nocache=\" + Math.random();\n var _width = \"1000px\";\n var _height = \"1000px\";\n\n var request = new XMLHttpRequest();\n request.open(\"GET\", file1, true);\n\n function axisLoad(axis_obj, callback) {\n Object.keys(axis_obj).forEach(function(field, i) {\n callback(axis_obj[field], i);\n });\n }\n\n request.onload = function() {\n if (request.status >= 200 && request.status < 400) {\n var result = JSON.parse(request.responseText);\n axisLoad(result.graph3d, function(object, i) {\n data.add(object);\n });\n axisLoad(result.axis_x, function(object, i) {\n axis_x[i] = object;\n });\n axisLoad(result.axis_y, function(object, i) {\n axis_y[i] = object;\n });\n data.remove(\"c57621e7d6cfb81\");\n } else {\n console.log(\"ERR: request.onload\");\n }\n };\n request.onerror = function() {\n console.log(\"ERR: Connection request\");\n };\n request.send();\n\n var options = {\n width: _width,\n height: _height,\n style: style,\n showPerspective: false,\n showLegend: true,\n showGrid: true,\n showShadow: true,\n xLabel: \"COUNTRY\",\n yLabel: \"INDEX\",\n zLabel: \"PERCENT\",\n legendLabel: \"value\",\n rotateAxisLabels: true,\n axisColor: \"#41413C\",\n axisFontType: \"courier\",\n axisFontSize: 30,\n gridColor: \"#5590CC\",\n backgroundColor: \"white\",\n dataColor: {\n fill: \"green\",\n stroke: \"green\",\n strokeWidth: 2\n },\n cameraPosition: {\n horizontal: 0,\n vertical: 2,\n distance: 2.3\n },\n tooltip: function(point) {\n return (\n \"value: <b>\" +\n point.z +\n \"%</b><br>\" +\n axis_x[point.x] +\n \"</b><br>\" +\n axis_y[point.y]\n );\n },\n tooltipDelay: 0,\n tooltipStyle: {\n content: {\n background: \"rgba(255, 255, 255, 0.7)\",\n padding: \"10px\",\n borderRadius: \"10px\"\n },\n line: {\n borderLeft: \"1px dotted rgba(0, 0, 0, 0.5)\"\n },\n dot: {\n border: \"5px solid rgba(0, 0, 0, 0.5)\"\n }\n },\n keepAspectRatio: false,\n verticalRatio: 0.5,\n xBarWidth: 1,\n yBarWidth: 1,\n xStep: 1,\n yStep: 1,\n xCenter: \"50%\",\n yCenter: \"25%\",\n xValueLabel: function(value) {\n return \"\" + axis_x[value.toString()];\n },\n yValueLabel: function(value) {\n return \"\" + axis_y[value.toString()];\n },\n zValueLabel: function(value) {\n return value + \"%\";\n }\n };\n var camera = graph ? graph.getCameraPosition() : null;\n var container = document.getElementById(\"mygraph\");\n graph = new vis.Graph3d(container, data, options);\n if (camera) graph.setCameraPosition(camera);\n document.getElementById(\"style\").onchange = drawVisualization;\n}\n\nwindow.addEventListener(\"load\", () => {\n drawVisualization();\n});\n","js_external":"https://visjs.github.io/vis-graph3d/dist/vis-graph3d.min.js","title":"Graph 3D | WORLD INDEXES BY COUNTRY 2018 MID-YEAR"}'
|
4064 | /><input
|
4065 | type="hidden"
|
4066 | name="js"
|
4067 | value='var graph = null;
|
4068 |
|
4069 | function drawVisualization() {
|
4070 | var style = document.getElementById("style").value;
|
4071 | var withValue =
|
4072 | ["bar-color", "bar-size", "dot-size", "dot-color"].indexOf(style) != -1;
|
4073 |
|
4074 | // Create and populate a data table.
|
4075 | var data = new vis.DataSet();
|
4076 | var extra_content = [];
|
4077 | data.add({
|
4078 | id: "c57621e7d6cfb81",
|
4079 | x: 0,
|
4080 | y: -1,
|
4081 | z: 0,
|
4082 | extra: extra_content[0]
|
4083 | });
|
4084 | var axis_x = {};
|
4085 | var axis_y = {};
|
4086 | var file1 = "world_index_data_small.json?nocache=" + Math.random();
|
4087 | var _width = "1000px";
|
4088 | var _height = "1000px";
|
4089 |
|
4090 | var request = new XMLHttpRequest();
|
4091 | request.open("GET", file1, true);
|
4092 |
|
4093 | function axisLoad(axis_obj, callback) {
|
4094 | Object.keys(axis_obj).forEach(function(field, i) {
|
4095 | callback(axis_obj[field], i);
|
4096 | });
|
4097 | }
|
4098 |
|
4099 | request.onload = function() {
|
4100 | if (request.status >= 200 && request.status < 400) {
|
4101 | var result = JSON.parse(request.responseText);
|
4102 | axisLoad(result.graph3d, function(object, i) {
|
4103 | data.add(object);
|
4104 | });
|
4105 | axisLoad(result.axis_x, function(object, i) {
|
4106 | axis_x[i] = object;
|
4107 | });
|
4108 | axisLoad(result.axis_y, function(object, i) {
|
4109 | axis_y[i] = object;
|
4110 | });
|
4111 | data.remove("c57621e7d6cfb81");
|
4112 | } else {
|
4113 | console.log("ERR: request.onload");
|
4114 | }
|
4115 | };
|
4116 | request.onerror = function() {
|
4117 | console.log("ERR: Connection request");
|
4118 | };
|
4119 | request.send();
|
4120 |
|
4121 | var options = {
|
4122 | width: _width,
|
4123 | height: _height,
|
4124 | style: style,
|
4125 | showPerspective: false,
|
4126 | showLegend: true,
|
4127 | showGrid: true,
|
4128 | showShadow: true,
|
4129 | xLabel: "COUNTRY",
|
4130 | yLabel: "INDEX",
|
4131 | zLabel: "PERCENT",
|
4132 | legendLabel: "value",
|
4133 | rotateAxisLabels: true,
|
4134 | axisColor: "#41413C",
|
4135 | axisFontType: "courier",
|
4136 | axisFontSize: 30,
|
4137 | gridColor: "#5590CC",
|
4138 | backgroundColor: "white",
|
4139 | dataColor: {
|
4140 | fill: "green",
|
4141 | stroke: "green",
|
4142 | strokeWidth: 2
|
4143 | },
|
4144 | cameraPosition: {
|
4145 | horizontal: 0,
|
4146 | vertical: 2,
|
4147 | distance: 2.3
|
4148 | },
|
4149 | tooltip: function(point) {
|
4150 | return (
|
4151 | "value: <b>" +
|
4152 | point.z +
|
4153 | "%</b><br>" +
|
4154 | axis_x[point.x] +
|
4155 | "</b><br>" +
|
4156 | axis_y[point.y]
|
4157 | );
|
4158 | },
|
4159 | tooltipDelay: 0,
|
4160 | tooltipStyle: {
|
4161 | content: {
|
4162 | background: "rgba(255, 255, 255, 0.7)",
|
4163 | padding: "10px",
|
4164 | borderRadius: "10px"
|
4165 | },
|
4166 | line: {
|
4167 | borderLeft: "1px dotted rgba(0, 0, 0, 0.5)"
|
4168 | },
|
4169 | dot: {
|
4170 | border: "5px solid rgba(0, 0, 0, 0.5)"
|
4171 | }
|
4172 | },
|
4173 | keepAspectRatio: false,
|
4174 | verticalRatio: 0.5,
|
4175 | xBarWidth: 1,
|
4176 | yBarWidth: 1,
|
4177 | xStep: 1,
|
4178 | yStep: 1,
|
4179 | xCenter: "50%",
|
4180 | yCenter: "25%",
|
4181 | xValueLabel: function(value) {
|
4182 | return "" + axis_x[value.toString()];
|
4183 | },
|
4184 | yValueLabel: function(value) {
|
4185 | return "" + axis_y[value.toString()];
|
4186 | },
|
4187 | zValueLabel: function(value) {
|
4188 | return value + "%";
|
4189 | }
|
4190 | };
|
4191 | var camera = graph ? graph.getCameraPosition() : null;
|
4192 | var container = document.getElementById("mygraph");
|
4193 | graph = new vis.Graph3d(container, data, options);
|
4194 | if (camera) graph.setCameraPosition(camera);
|
4195 | document.getElementById("style").onchange = drawVisualization;
|
4196 | }
|
4197 |
|
4198 | window.addEventListener("load", () => {
|
4199 | drawVisualization();
|
4200 | });
|
4201 | '
|
4202 | /><input
|
4203 | type="hidden"
|
4204 | name="css"
|
4205 | value="body {
|
4206 | font: 10pt arial;
|
4207 | }
|
4208 | div#info {
|
4209 | width: 500px;
|
4210 | text-align: center;
|
4211 | margin-top: 2em;
|
4212 | font-size: 1.2em;
|
4213 | }
|
4214 | span#graphHead,
|
4215 | span#updateTime,
|
4216 | span#startTime,
|
4217 | span#endTime {
|
4218 | font: 10pt arial;
|
4219 | font-weight: bold;
|
4220 | text-align: center;
|
4221 | }
|
4222 | "
|
4223 | /><input
|
4224 | type="hidden"
|
4225 | name="html"
|
4226 | value='<p>
|
4227 | <label for="style">
|
4228 | Style:
|
4229 | <select id="style">
|
4230 | <option value="bar">bar</option>
|
4231 | <option value="dot">dot</option>
|
4232 | <option value="dot-line">dot-line</option>
|
4233 | </select>
|
4234 | </label>
|
4235 | </p>
|
4236 | <div style="text-align: center; width: 1024px;">
|
4237 | <span id="graphHead">WORLD INDEXES BY COUNTRY 2018 MID-YEAR</span><br />
|
4238 | <span id="updateTime"></span><br />
|
4239 | <span id="startTime"></span><br />
|
4240 | <span id="endTime"></span><br />
|
4241 | <div id="mygraph" height="470px"></div>
|
4242 | <div id="info">Hover the mouse cursor over the graph to see tooltips.</div>
|
4243 | </div>
|
4244 | '
|
4245 | /></form
|
4246 | ></span>
|
4247 | </div>
|
4248 | <a href="graph3d/rotateAxisLabels/rotateAxisLabels.html"
|
4249 | ><div class="example-image">
|
4250 | <img
|
4251 | src="thumbnails/0b719c793c5a7360ba565c3d9448a308fe2f150e90aee742099ab867df5c2e23.png"
|
4252 | alt="WORLD INDEXES BY COUNTRY 2018 MID-YEAR"
|
4253 | /></div></a></span
|
4254 | ><span class="example-link"
|
4255 | ><div>
|
4256 | <a href="graph3d/14_zoom_ctrl_scroll.html">Zoom CTRL Scroll</a
|
4257 | ><span class="playgrounds"
|
4258 | ><form
|
4259 | action="http://jsfiddle.net/api/post/library/pure/"
|
4260 | method="post"
|
4261 | target="_blank"
|
4262 | >
|
4263 | <button class="icon jsfiddle" alt="JSFiddle" title="JSFiddle">
|
4264 |  </button
|
4265 | ><input
|
4266 | type="hidden"
|
4267 | name="js"
|
4268 | value='var data = null;
|
4269 | var graph = null;
|
4270 |
|
4271 | function custom(x, y) {
|
4272 | return Math.sin(x / 50) * Math.cos(y / 50) * 50 + 50;
|
4273 | }
|
4274 |
|
4275 | // Called when the Visualization API is loaded.
|
4276 | function drawVisualization() {
|
4277 | // Create and populate a data table.
|
4278 | data = new vis.DataSet();
|
4279 | // create some nice looking data with sin/cos
|
4280 | var counter = 0;
|
4281 | var steps = 50; // number of datapoints will be steps*steps
|
4282 | var axisMax = 314;
|
4283 | var axisStep = axisMax / steps;
|
4284 | for (var x = 0; x < axisMax; x += axisStep) {
|
4285 | for (var y = 0; y < axisMax; y += axisStep) {
|
4286 | var value = custom(x, y);
|
4287 | data.add({ id: counter++, x: x, y: y, z: value, style: value });
|
4288 | }
|
4289 | }
|
4290 |
|
4291 | // specify options
|
4292 | var options = {
|
4293 | width: "600px",
|
4294 | height: "600px",
|
4295 | style: "surface",
|
4296 | showPerspective: true,
|
4297 | showGrid: true,
|
4298 | showShadow: false,
|
4299 | keepAspectRatio: true,
|
4300 | verticalRatio: 0.5,
|
4301 | ctrlToZoom: true
|
4302 | };
|
4303 |
|
4304 | // Instantiate our graph object.
|
4305 | var container = document.getElementById("mygraph");
|
4306 | graph = new vis.Graph3d(container, data, options);
|
4307 | }
|
4308 |
|
4309 | window.addEventListener("load", () => {
|
4310 | drawVisualization();
|
4311 | });
|
4312 | '
|
4313 | /><input
|
4314 | type="hidden"
|
4315 | name="css"
|
4316 | value="body {
|
4317 | font: 10pt arial;
|
4318 | }
|
4319 | "
|
4320 | /><input
|
4321 | type="hidden"
|
4322 | name="html"
|
4323 | value='<div id="mygraph"></div>
|
4324 |
|
4325 | <div id="info"></div>
|
4326 | '
|
4327 | /><input
|
4328 | type="hidden"
|
4329 | name="resources"
|
4330 | value="https://visjs.github.io/vis-graph3d/dist/vis-graph3d.min.js"
|
4331 | /><input type="hidden" name="wrap" value="b" /><input
|
4332 | type="hidden"
|
4333 | name="title"
|
4334 | value="Graph 3D | Zoom CTRL Scroll"
|
4335 | />
|
4336 | </form>
|
4337 |
|
4338 | <form
|
4339 | action="https://codepen.io/pen/define"
|
4340 | method="post"
|
4341 | target="_blank"
|
4342 | >
|
4343 | <button class="icon codepen" alt="CodePen" title="CodePen">
|
4344 |  </button
|
4345 | ><input
|
4346 | type="hidden"
|
4347 | name="data"
|
4348 | value='{"css":"body {\n font: 10pt arial;\n}\n","css_external":"","html":"<div id=\"mygraph\"></div>\n\n<div id=\"info\"></div>\n","js":"var data = null;\nvar graph = null;\n\nfunction custom(x, y) {\n return Math.sin(x / 50) * Math.cos(y / 50) * 50 + 50;\n}\n\n// Called when the Visualization API is loaded.\nfunction drawVisualization() {\n // Create and populate a data table.\n data = new vis.DataSet();\n // create some nice looking data with sin/cos\n var counter = 0;\n var steps = 50; // number of datapoints will be steps*steps\n var axisMax = 314;\n var axisStep = axisMax / steps;\n for (var x = 0; x < axisMax; x += axisStep) {\n for (var y = 0; y < axisMax; y += axisStep) {\n var value = custom(x, y);\n data.add({ id: counter++, x: x, y: y, z: value, style: value });\n }\n }\n\n // specify options\n var options = {\n width: \"600px\",\n height: \"600px\",\n style: \"surface\",\n showPerspective: true,\n showGrid: true,\n showShadow: false,\n keepAspectRatio: true,\n verticalRatio: 0.5,\n ctrlToZoom: true\n };\n\n // Instantiate our graph object.\n var container = document.getElementById(\"mygraph\");\n graph = new vis.Graph3d(container, data, options);\n}\n\nwindow.addEventListener(\"load\", () => {\n drawVisualization();\n});\n","js_external":"https://visjs.github.io/vis-graph3d/dist/vis-graph3d.min.js","title":"Graph 3D | Zoom CTRL Scroll"}'
|
4349 | /><input
|
4350 | type="hidden"
|
4351 | name="js"
|
4352 | value='var data = null;
|
4353 | var graph = null;
|
4354 |
|
4355 | function custom(x, y) {
|
4356 | return Math.sin(x / 50) * Math.cos(y / 50) * 50 + 50;
|
4357 | }
|
4358 |
|
4359 | // Called when the Visualization API is loaded.
|
4360 | function drawVisualization() {
|
4361 | // Create and populate a data table.
|
4362 | data = new vis.DataSet();
|
4363 | // create some nice looking data with sin/cos
|
4364 | var counter = 0;
|
4365 | var steps = 50; // number of datapoints will be steps*steps
|
4366 | var axisMax = 314;
|
4367 | var axisStep = axisMax / steps;
|
4368 | for (var x = 0; x < axisMax; x += axisStep) {
|
4369 | for (var y = 0; y < axisMax; y += axisStep) {
|
4370 | var value = custom(x, y);
|
4371 | data.add({ id: counter++, x: x, y: y, z: value, style: value });
|
4372 | }
|
4373 | }
|
4374 |
|
4375 | // specify options
|
4376 | var options = {
|
4377 | width: "600px",
|
4378 | height: "600px",
|
4379 | style: "surface",
|
4380 | showPerspective: true,
|
4381 | showGrid: true,
|
4382 | showShadow: false,
|
4383 | keepAspectRatio: true,
|
4384 | verticalRatio: 0.5,
|
4385 | ctrlToZoom: true
|
4386 | };
|
4387 |
|
4388 | // Instantiate our graph object.
|
4389 | var container = document.getElementById("mygraph");
|
4390 | graph = new vis.Graph3d(container, data, options);
|
4391 | }
|
4392 |
|
4393 | window.addEventListener("load", () => {
|
4394 | drawVisualization();
|
4395 | });
|
4396 | '
|
4397 | /><input
|
4398 | type="hidden"
|
4399 | name="css"
|
4400 | value="body {
|
4401 | font: 10pt arial;
|
4402 | }
|
4403 | "
|
4404 | /><input
|
4405 | type="hidden"
|
4406 | name="html"
|
4407 | value='<div id="mygraph"></div>
|
4408 |
|
4409 | <div id="info"></div>
|
4410 | '
|
4411 | /></form
|
4412 | ></span>
|
4413 | </div>
|
4414 | <a href="graph3d/14_zoom_ctrl_scroll.html"
|
4415 | ><div class="example-image">
|
4416 | <img
|
4417 | src="thumbnails/9d3da0f15b9ed2d99a43702eab6e272430988bf6f5b634baeed4a4232208502a.png"
|
4418 | alt="Zoom CTRL Scroll"
|
4419 | /></div></a
|
4420 | ></span>
|
4421 | </div>
|
4422 | </div>
|
4423 | </div>
|
4424 | </body>
|
4425 | </html>
|