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.

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