05_line.html 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <!doctype html>
  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. 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. // create our graph
  39. var container = document.getElementById('mygraph');
  40. graph = new vis.Graph3d(container, data, options);
  41. graph.setCameraPosition(0.4, undefined, undefined);
  42. }
  43. </script>
  44. <script src="../googleAnalytics.js"></script>
  45. </head>
  46. <body onload="drawVisualization()">
  47. <div id="mygraph"></div>
  48. <div id="info"></div>
  49. </body>
  50. </html>