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.

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