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.8 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 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. var data = [];
  19. // create some nice looking data with sin/cos
  20. var steps = 50; // number of datapoints will be steps*steps
  21. var axisMax = 314;
  22. var axisStep = axisMax / steps;
  23. for (var x = 0; x < axisMax; x+=axisStep) {
  24. for (var y = 0; y < axisMax; y+=axisStep) {
  25. var value = custom(x,y);
  26. data.push({x:x,y:y,z:value,style:value});
  27. }
  28. }
  29. // specify options
  30. var options = {
  31. width: "600px",
  32. height: "600px",
  33. style: "surface",
  34. showPerspective: true,
  35. showGrid: true,
  36. showShadow: false,
  37. keepAspectRatio: true,
  38. verticalRatio: 0.5
  39. };
  40. // Instantiate our graph object.
  41. graph = new vis.Graph3d(document.getElementById('mygraph'));
  42. // Draw our graph with the created data and options
  43. graph.draw(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>