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.

64 lines
1.5 KiB

  1. <!DOCTYPE HTML>
  2. <html>
  3. <head>
  4. <meta content="text/html;charset=utf-8" http-equiv="Content-Type">
  5. <meta content="utf-8" http-equiv="encoding">
  6. <title>Graph2d | Basic Example</title>
  7. <style type="text/css">
  8. body, html {
  9. font-family: sans-serif;
  10. }
  11. .red {
  12. fill:red;
  13. }
  14. </style>
  15. <script src="../../dist/vis.js"></script>
  16. <link href="../../dist/vis.css" rel="stylesheet" type="text/css" />
  17. </head>
  18. <body>
  19. <h2>Graph2d | Label Example</h2>
  20. <div style="width:700px; font-size:14px; text-align: justify;">
  21. This example shows the how to add a label to each point in Graph2d. Each item can have a label object which contains the content and CSS class.In addition, xOffset and yOffset will adjust the location of the label relative to the point being labelled.
  22. <br /><br />
  23. </div>
  24. <br />
  25. <div id="visualization"></div>
  26. <script type="text/javascript">
  27. var container = document.getElementById('visualization');
  28. var label1 = {
  29. content: "offset label",
  30. xOffset: 20,
  31. yOffset: 20
  32. }
  33. var label2 = {
  34. content: "Label2",
  35. className: "red"
  36. }
  37. var items = [
  38. {x: '2014-06-11', y: 10,label:label1},
  39. {x: '2014-06-12', y: 25,label:label2},
  40. {x: '2014-06-13', y: 30},
  41. {x: '2014-06-14', y: 10},
  42. {x: '2014-06-15', y: 15},
  43. {x: '2014-06-16', y: 30}
  44. ];
  45. var dataset = new vis.DataSet(items);
  46. var options = {
  47. start: '2014-06-10',
  48. end: '2014-06-18',
  49. style:'bar'
  50. };
  51. var graph2d = new vis.Graph2d(container, dataset, options);
  52. </script>
  53. </body>
  54. </html>