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.

60 lines
1.9 KiB

  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <html>
  3. <head><script>(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)})(window,document,'script','//www.google-analytics.com/analytics.js','ga');ga('create', 'UA-61231638-1', 'auto');ga('send', 'pageview');</script>
  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. </head>
  47. <body onload="drawVisualization();">
  48. <div id="mygraph"></div>
  49. <div id="info"></div>
  50. </body>
  51. </html>