diff --git a/HISTORY.md b/HISTORY.md index ccfb6928..cbc644c4 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -1,9 +1,11 @@ vis.js history http://visjs.org -## +## version 0.0.6 - Css is now packaged in the javascript file, and automatically loaded. +- The library has neat namespacing now, is in a closure and, and can be used + with require.js. ## 2012-04-16, version 0.0.5 diff --git a/Jakefile.js b/Jakefile.js index 1e412574..a6ad052b 100644 --- a/Jakefile.js +++ b/Jakefile.js @@ -16,7 +16,7 @@ task('default', ['vis'], function () { }); /** - * vis.js, vis.css + * build the visualization library vis.js */ desc('Build the visualization library vis.js'); task('vis', function () { @@ -39,7 +39,8 @@ task('vis', function () { concat({ dest: VIS, src: [ - './src/header.js', + './src/module.js', + './src/util.js', './src/events.js', './src/timestep.js', @@ -47,7 +48,6 @@ task('vis', function () { './src/stack.js', './src/range.js', './src/controller.js', - './src/module.js', './src/component/component.js', './src/component/panel.js', @@ -60,11 +60,16 @@ task('vis', function () { './lib/moment.js' ], + + header: read('./src/header.js') + '\n' + + '(function () { ', // start of closure + separator: '\n', // Note: we insert the css as a string in the javascript code here // the css will be injected on load of the javascript library - footer: 'loadCss(' + cssText + ');' + footer: 'loadCss(' + cssText + ');\n' + + '})();' // end of closure }); // minify javascript diff --git a/README.md b/README.md index 65ceee62..95296e82 100644 --- a/README.md +++ b/README.md @@ -23,12 +23,36 @@ Or download the library from the github project: ## Load -To use a component, include the javascript file of vis in your webpage. +To use a component, include the javascript file of vis in your webpage: ```html - + + +
+ + + + + + +``` + +or load vis.js using require.js: + +```js +require.config({ + paths: { + vis: 'path/to/vis', + } +}); +require(['vis'], function (math) { + // ... load a visualization +}); ``` + A timeline can be instantiated as: ```js diff --git a/examples/timeline/01_basic.html b/examples/timeline/01_basic.html index 6e4811fc..7d73e901 100644 --- a/examples/timeline/01_basic.html +++ b/examples/timeline/01_basic.html @@ -2,13 +2,14 @@diff --git a/examples/timeline/03_requirejs/03_requirejs.html b/examples/timeline/03_requirejs/03_requirejs.html new file mode 100644 index 00000000..764a75ba --- /dev/null +++ b/examples/timeline/03_requirejs/03_requirejs.html @@ -0,0 +1,11 @@ + + +
+
+ + + +
+