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.

161 lines
4.1 KiB

11 years ago
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 the following components:
  7. - Timeline. Display different types of data on a timeline.
  8. The timeline and the items on the timeline can be interactively moved,
  9. zoomed, and manipulated.
  10. - Graph. Display a graph of network with nodes and edges.
  11. - DataSet and DataView. A flexible key/value based data set.
  12. Add, update, and remove items. Subscribe on changes in the data set.
  13. Filter, order, and cast data.
  14. Vis.js Library is part of [CHAP](http://chap.almende.com),
  15. the Common Hybrid Agent Platform, developed by [Almende B.V](http://almende.com).
  16. ## Install
  17. Install via npm:
  18. npm install vis
  19. Install via bower:
  20. bower install vis
  21. Or download the library from the github project:
  22. [https://github.com/almende/vis.git](https://github.com/almende/vis.git).
  23. ## Load
  24. To use a component, include the javascript file of vis in your web page:
  25. ```html
  26. <!DOCTYPE HTML>
  27. <html>
  28. <head>
  29. <script src="components/vis/vis.js"></script>
  30. </head>
  31. <body>
  32. <script type="text/javascript">
  33. // ... load a visualization
  34. </script>
  35. </body>
  36. </html>
  37. ```
  38. or load vis.js using require.js:
  39. ```js
  40. require.config({
  41. paths: {
  42. vis: 'path/to/vis',
  43. }
  44. });
  45. require(['vis'], function (math) {
  46. // ... load a visualization
  47. });
  48. ```
  49. A timeline can be instantiated as:
  50. ```js
  51. var timeline = new vis.Timeline(container, data, options);
  52. ```
  53. Where `container` is an HTML element, `data` is an Array with data or a DataSet,
  54. and `options` is an optional object with configuration options for the
  55. component.
  56. ## Example
  57. A basic example on loading a Timeline is shown below. More examples can be
  58. found in the [examples directory](https://github.com/almende/vis/tree/master/examples)
  59. of the project.
  60. ```html
  61. <!DOCTYPE HTML>
  62. <html>
  63. <head>
  64. <title>Timeline basic demo</title>
  65. <script src="components/vis/vis.js"></script>
  66. <style type="text/css">
  67. body, html {
  68. font-family: sans-serif;
  69. }
  70. </style>
  71. </head>
  72. <body>
  73. <div id="visualization"></div>
  74. <script type="text/javascript">
  75. var container = document.getElementById('visualization');
  76. var data = [
  77. {id: 1, content: 'item 1', start: '2013-04-20'},
  78. {id: 2, content: 'item 2', start: '2013-04-14'},
  79. {id: 3, content: 'item 3', start: '2013-04-18'},
  80. {id: 4, content: 'item 4', start: '2013-04-16', end: '2013-04-19'},
  81. {id: 5, content: 'item 5', start: '2013-04-25'},
  82. {id: 6, content: 'item 6', start: '2013-04-27'}
  83. ];
  84. var options = {};
  85. var timeline = new vis.Timeline(container, data, options);
  86. </script>
  87. </body>
  88. </html>
  89. ```
  90. ## Build
  91. To build the library from source, clone the project from github
  92. git clone git://github.com/almende/vis.git
  93. The project uses [jake](https://github.com/mde/jake) as build tool.
  94. The build script uses [Browserify](http://browserify.org/) to
  95. bundle the source code into a library,
  96. and uses [UglifyJS](http://lisperator.net/uglifyjs/) to minify the code.
  97. The source code uses the module style of node (require and module.exports) to
  98. organize dependencies.
  99. To install all dependencies and build the library, run `npm install` in the
  100. root of the project.
  101. cd vis
  102. npm install
  103. To be able to run jake from the command line, jake must be installed globally:
  104. sudo npm install -g jake
  105. Then, the project can be build by executing jake in the root of the project:
  106. jake
  107. ## License
  108. Copyright (C) 2010-2013 Almende B.V.
  109. Licensed under the Apache License, Version 2.0 (the "License");
  110. you may not use this file except in compliance with the License.
  111. You may obtain a copy of the License at
  112. http://www.apache.org/licenses/LICENSE-2.0
  113. Unless required by applicable law or agreed to in writing, software
  114. distributed under the License is distributed on an "AS IS" BASIS,
  115. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  116. See the License for the specific language governing permissions and
  117. limitations under the License.