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.

62 lines
1.5 KiB

  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. zoomable: false
  41. };
  42. // Instantiate our graph object.
  43. var container = document.getElementById('mygraph');
  44. graph = new vis.Graph3d(container, data, options);
  45. }
  46. </script>
  47. </head>
  48. <body onload="drawVisualization();">
  49. <div id="mygraph"></div>
  50. <div id="info"></div>
  51. </body>
  52. </html>