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.

102 lines
2.7 KiB

11 years ago
11 years ago
11 years ago
11 years ago
  1. vis.js
  2. ==================
  3. Vis.js is a dynamic, browser based visualization library.
  4. The library is designed to be easy to use, to handle large amounts
  5. of dynamic data, and to enable manipulation of the data.
  6. The library consists of Timeline, LineChart, LineChart3d, Graph, and Treegrid.
  7. Vis.js Library is part of [CHAP](http://chap.almende.com),
  8. the Common Hybrid Agent Platform, developed by [Almende B.V](http://almende.com).
  9. # Install
  10. Install via bower:
  11. bower install vis
  12. Or download the library from the github project:
  13. [https://github.com/almende/vis.git](https://github.com/almende/vis.git).
  14. # Load
  15. To use a component, include the javascript and css file of the component
  16. in your webpage. For example for the Timeline:
  17. ```html
  18. <script src="../timeline.js"></script>
  19. <link href="../timeline.css" rel="stylesheet" type="text/css" />
  20. ```
  21. A timeline can be instantiated as:
  22. ```js
  23. var timeline = new Timeline(container, data, options);
  24. ```
  25. Where `container` is an HTML element, `data` is an Array with data or a DataSet,
  26. and `options` is an optional object with configuration options for the
  27. component.
  28. # Example
  29. A basic example on loading a Timeline is shown below. More examples can be
  30. found in the examples directories of each component.
  31. ```html
  32. <!DOCTYPE HTML>
  33. <html>
  34. <head>
  35. <title>Timeline basic demo</title>
  36. <script src="../timeline.js"></script>
  37. <link href="../timeline.css" rel="stylesheet" type="text/css" />
  38. <style type="text/css">
  39. body, html {
  40. font-family: sans-serif;
  41. }
  42. </style>
  43. </head>
  44. <body>
  45. <div id="visualization"></div>
  46. <script type="text/javascript">
  47. var container = document.getElementById('visualization');
  48. var data = [
  49. {id: 1, content: 'item 1', start: '2013-04-20'},
  50. {id: 2, content: 'item 2', start: '2013-04-14'},
  51. {id: 3, content: 'item 3', start: '2013-04-18'},
  52. {id: 4, content: 'item 4', start: '2013-04-16', end: '2013-04-19'},
  53. {id: 5, content: 'item 5', start: '2013-04-25'},
  54. {id: 6, content: 'item 6', start: '2013-04-27'}
  55. ];
  56. var options = {};
  57. var timeline = new Timeline(container, data, options);
  58. </script>
  59. </body>
  60. </html>
  61. ```
  62. # Build
  63. To build the library from source, clone the project from github
  64. git clone git://github.com/almende/vis.git
  65. The project uses [jake](https://github.com/mde/jake) as build tool.
  66. To be able to run jake from the command line, jake must be installed globally:
  67. sudo npm install -g jake
  68. Then, the project can be build by executing jake in the root of the project:
  69. cd vis
  70. jake
  71. This will build the library for each of the components. The built libraries can
  72. be found in the directory `bin`, and includes examples.