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.

169 lines
4.1 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 and css files of vis in your web page:
  24. ```html
  25. <!DOCTYPE HTML>
  26. <html>
  27. <head>
  28. <script src="components/vis/dist/vis.js"></script>
  29. <link href="components/vis/dist/vis.css" rel="stylesheet" type="text/css" />
  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. Note that vis.css must be loaded too.
  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="vis/dist/vis.js"></script>
  66. <link href="vis/dist/vis.css" rel="stylesheet" type="text/css" />
  67. <style type="text/css">
  68. body, html {
  69. font-family: sans-serif;
  70. }
  71. </style>
  72. </head>
  73. <body>
  74. <div id="visualization"></div>
  75. <script type="text/javascript">
  76. var container = document.getElementById('visualization');
  77. var data = [
  78. {id: 1, content: 'item 1', start: '2013-04-20'},
  79. {id: 2, content: 'item 2', start: '2013-04-14'},
  80. {id: 3, content: 'item 3', start: '2013-04-18'},
  81. {id: 4, content: 'item 4', start: '2013-04-16', end: '2013-04-19'},
  82. {id: 5, content: 'item 5', start: '2013-04-25'},
  83. {id: 6, content: 'item 6', start: '2013-04-27'}
  84. ];
  85. var options = {};
  86. var timeline = new vis.Timeline(container, data, options);
  87. </script>
  88. </body>
  89. </html>
  90. ```
  91. ## Build
  92. To build the library from source, clone the project from github
  93. git clone git://github.com/almende/vis.git
  94. The project uses [jake](https://github.com/mde/jake) as build tool.
  95. The build script uses [Browserify](http://browserify.org/) to
  96. bundle the source code into a library,
  97. and uses [UglifyJS](http://lisperator.net/uglifyjs/) to minify the code.
  98. The source code uses the module style of node (require and module.exports) to
  99. organize dependencies.
  100. To install all dependencies and build the library, run `npm install` in the
  101. root of the project.
  102. cd vis
  103. npm install
  104. Then, the project can be build running:
  105. npm run build
  106. ## Test
  107. To test the library, install the project dependencies once:
  108. npm install
  109. Then run the tests:
  110. npm test
  111. ## License
  112. Copyright (C) 2010-2014 Almende B.V.
  113. Licensed under the Apache License, Version 2.0 (the "License");
  114. you may not use this file except in compliance with the License.
  115. You may obtain a copy of the License at
  116. http://www.apache.org/licenses/LICENSE-2.0
  117. Unless required by applicable law or agreed to in writing, software
  118. distributed under the License is distributed on an "AS IS" BASIS,
  119. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  120. See the License for the specific language governing permissions and
  121. limitations under the License.