01_basics.html 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <!doctype html>
  2. <html>
  3. <head>
  4. <title>Graph 3D 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. function custom(x, y) {
  13. return (Math.sin(x/50) * Math.cos(y/50) * 50 + 50);
  14. }
  15. // Called when the Visualization API is loaded.
  16. function drawVisualization() {
  17. // Create and populate a data table.
  18. data = new vis.DataSet();
  19. // create some nice looking data with sin/cos
  20. var counter = 0;
  21. var steps = 50; // number of datapoints will be steps*steps
  22. var axisMax = 314;
  23. var axisStep = axisMax / steps;
  24. for (var x = 0; x < axisMax; x+=axisStep) {
  25. for (var y = 0; y < axisMax; y+=axisStep) {
  26. var value = custom(x,y);
  27. data.add({id:counter++,x:x,y:y,z:value,style:value});
  28. }
  29. }
  30. // specify options
  31. var options = {
  32. width: '600px',
  33. height: '600px',
  34. style: 'surface',
  35. showPerspective: true,
  36. showGrid: true,
  37. showShadow: false,
  38. keepAspectRatio: true,
  39. verticalRatio: 0.5
  40. };
  41. // Instantiate our graph object.
  42. var container = document.getElementById('mygraph');
  43. graph = new vis.Graph3d(container, data, options);
  44. }
  45. </script>
  46. <script src="../googleAnalytics.js"></script>
  47. </head>
  48. <body onload="drawVisualization();">
  49. <div id="mygraph"></div>
  50. <div id="info"></div>
  51. </body>
  52. </html>