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.

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