vis.js is a dynamic, browser-based visualization library
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

61 lines
1.7 KiB

10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <html>
  3. <head>
  4. <title>Graph 3D line demo</title>
  5. <style>
  6. body {font: 10pt arial;}
  7. </style>
  8. <script type="text/javascript" src="../../dist/vis.js"></script>
  9. <script type="text/javascript">
  10. var data = null;
  11. var graph = null;
  12. // Called when the Visualization API is loaded.
  13. function drawVisualization() {
  14. // Create and populate a data table.
  15. var data = new vis.DataSet({});
  16. // create some nice looking data with sin/cos
  17. var steps = 500;
  18. var axisMax = 314;
  19. var tmax = 4 * 2 * Math.PI;
  20. var axisStep = axisMax / steps;
  21. for (var t = 0; t < tmax; t += tmax / steps) {
  22. var r = 1;
  23. var x = r * Math.sin(t);
  24. var y = r * Math.cos(t);
  25. var z = t / tmax;
  26. data.add({x:x,y:y,z:z});
  27. }
  28. // specify options
  29. var options = {
  30. width: "600px",
  31. height: "600px",
  32. style: "line",
  33. showPerspective: false,
  34. showGrid: true,
  35. keepAspectRatio: true,
  36. verticalRatio: 1.0
  37. };
  38. // Instantiate our graph object.
  39. graph = new vis.Graph3d(document.getElementById('mygraph'));
  40. // Draw our graph with the created data and options
  41. graph.draw(data, options);
  42. graph.setCameraPosition(0.4, undefined, undefined);
  43. }
  44. </script>
  45. </head>
  46. <body onload="drawVisualization()">
  47. <div id="mygraph"></div>
  48. <div id="info"></div>
  49. </body>
  50. </html>