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.9 KiB

  1. <!DOCTYPE HTML>
  2. <html>
  3. <head>
  4. <title>Graph2d | Scatterplot</title>
  5. <style type="text/css">
  6. body, html {
  7. font-family: sans-serif;
  8. }
  9. </style>
  10. <script src="../../dist/vis.js"></script>
  11. <link href="../../dist/vis.css" rel="stylesheet" type="text/css" />
  12. <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></head>
  13. <body>
  14. <h2>Graph2d | Scatterplot</h2>
  15. <div style="width:700px; font-size:14px; text-align: justify;">
  16. You can manually disable the automatic sorting of the datapoints by using the <code>sort</code> option. You can use this with the
  17. <code>style: 'points'</code> option for making a scatterplot!
  18. </div>
  19. <pre class="prettyprint lang-js">
  20. var options = {
  21. sort: false,
  22. sampling:false,
  23. style:'points'
  24. };
  25. </pre>
  26. <br />
  27. <div id="visualization"></div>
  28. <script type="text/javascript">
  29. var container = document.getElementById('visualization');
  30. var items = [];
  31. for (var i = 0; i < 100; i++) {
  32. items.push({x: new Date('2014-06-11').valueOf() + Math.floor(Math.random() * 30000), y: 500 + (Math.random() * 100)});
  33. }
  34. var dataset = new vis.DataSet(items);
  35. var options = {
  36. sort: false,
  37. sampling:false,
  38. style:'points',
  39. dataAxis: {
  40. left: {
  41. range: {
  42. min: 300, max: 800
  43. }
  44. }
  45. },
  46. drawPoints: {
  47. enabled: true,
  48. size: 6,
  49. style: 'circle' // square, circle
  50. },
  51. defaultGroup: 'Scatterplot',
  52. height: '600px'
  53. };
  54. var graph2d = new vis.Graph2d(container, dataset, options);
  55. </script>
  56. </body>
  57. </html>