Browse Source

Merge remote-tracking branch 'origin/develop' into alex_dev

Conflicts:
	dist/vis.js
	dist/vis.min.js
css_transitions
Alex de Mulder 10 years ago
parent
commit
0e17f34dc7
24 changed files with 242 additions and 84 deletions
  1. +1
    -1
      HISTORY.md
  2. +10
    -7
      Jakefile.js
  3. +1
    -1
      NOTICE
  4. +18
    -9
      README.md
  5. +1
    -1
      bower.json
  6. +1
    -1
      docs/graph.html
  7. BIN
      docs/img/vis_overview.odg
  8. BIN
      docs/img/vis_overview.png
  9. +1
    -1
      docs/index.html
  10. +80
    -0
      misc/how_to_publish.md
  11. +3
    -2
      package.json
  12. +1
    -1
      src/module/header.js
  13. +9
    -0
      src/timeline/Timeline.js
  14. +9
    -0
      src/timeline/component/Group.js
  15. +20
    -0
      src/timeline/component/GroupSet.js
  16. +72
    -2
      src/timeline/component/ItemSet.js
  17. +8
    -0
      src/timeline/component/css/item.css
  18. +2
    -0
      src/timeline/component/item/Item.js
  19. +0
    -18
      src/timeline/component/item/ItemBox.js
  20. +0
    -18
      src/timeline/component/item/ItemPoint.js
  21. +2
    -19
      src/timeline/component/item/ItemRange.js
  22. +1
    -1
      test/dataset.js
  23. +1
    -1
      test/dataview.js
  24. +1
    -1
      test/eventbus.js

+ 1
- 1
HISTORY.md View File

@ -2,7 +2,7 @@ vis.js history
http://visjs.org
## <not yet released>, version 0.3.0
## 2014-01-14, version 0.3.0
- Moved the generated library to folder `./dist`
- Css stylesheet must be loaded explicitly now.

+ 10
- 7
Jakefile.js View File

@ -9,16 +9,17 @@ var jake = require('jake'),
require('jake-utils');
// constants
var VIS = './dist/vis.js';
var VIS_CSS = './dist/vis.css';
var VIS_TMP = './vis.js.tmp';
var VIS_MIN = './dist/vis.min.js';
var DIST = './dist';
var VIS = DIST + '/vis.js';
var VIS_CSS = DIST + '/vis.css';
var VIS_TMP = DIST + '/vis.js.tmp';
var VIS_MIN = DIST + '/vis.min.js';
/**
* default task
*/
desc('Execute all tasks: build all libraries');
task('default', ['build', 'minify', 'test'], function () {
desc('Default task: build all libraries');
task('default', ['build', 'minify'], function () {
console.log('done');
});
@ -27,6 +28,8 @@ task('default', ['build', 'minify', 'test'], function () {
*/
desc('Build the visualization library vis.js');
task('build', {async: true}, function () {
jake.mkdirP(DIST);
// concatenate and stringify the css files
concat({
src: [
@ -139,7 +142,7 @@ task('minify', function () {
* test task
*/
desc('Test the library');
task('test', ['build'], function () {
task('test', function () {
// TODO: use a testing suite for testing: nodeunit, mocha, tap, ...
var filelist = new jake.FileList();
filelist.include([

+ 1
- 1
NOTICE View File

@ -1,5 +1,5 @@
Vis.js
Copyright 2010-2013 Almende B.V.
Copyright 2010-2014 Almende B.V.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.

+ 18
- 9
README.md View File

@ -34,13 +34,14 @@ Or download the library from the github project:
## Load
To use a component, include the javascript file of vis in your web page:
To use a component, include the javascript and css files of vis in your web page:
```html
<!DOCTYPE HTML>
<html>
<head>
<script src="components/vis/vis.js"></script>
<script src="components/vis/dist/vis.js"></script>
<link href="components/vis/dist/vis.css" rel="stylesheet" type="text/css" />
</head>
<body>
<script type="text/javascript">
@ -50,7 +51,7 @@ To use a component, include the javascript file of vis in your web page:
</html>
```
or load vis.js using require.js:
or load vis.js using require.js. Note that vis.css must be loaded too.
```js
require.config({
@ -86,7 +87,8 @@ of the project.
<html>
<head>
<title>Timeline basic demo</title>
<script src="components/vis/vis.js"></script>
<script src="vis/dist/vis.js"></script>
<link href="vis/dist/vis.css" rel="stylesheet" type="text/css" />
<style type="text/css">
body, html {
@ -134,18 +136,25 @@ root of the project.
cd vis
npm install
To be able to run jake from the command line, jake must be installed globally:
Then, the project can be build running:
sudo npm install -g jake
npm run build
Then, the project can be build by executing jake in the root of the project:
jake
## Test
To test teh library, install the project dependencies once:
npm install
Then run the tests:
npm test
## License
Copyright (C) 2010-2013 Almende B.V.
Copyright (C) 2010-2014 Almende B.V.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.

+ 1
- 1
bower.json View File

@ -1,6 +1,6 @@
{
"name": "vis",
"version": "0.3.0-SNAPSHOT",
"version": "0.4.0-SNAPSHOT",
"description": "A dynamic, browser-based visualization library.",
"homepage": "http://visjs.org/",
"repository": {

+ 1
- 1
docs/graph.html View File

@ -118,7 +118,7 @@
</p>
<pre class="prettyprint lang-html">
&lt;script type="text/javascript" src="vis/vis.js"&gt;&lt;/script&gt;
&lt;script type="text/javascript" src="vis/dist/vis.js"&gt;&lt;/script&gt;
</pre>

BIN
docs/img/vis_overview.odg View File


BIN
docs/img/vis_overview.png View File

Before After
Width: 768  |  Height: 912  |  Size: 48 KiB Width: 936  |  Height: 1008  |  Size: 62 KiB

+ 1
- 1
docs/index.html View File

@ -179,7 +179,7 @@ var timeline = new vis.Timeline(container, data, options);
<h2 id="license">License</h2>
<p>
Copyright (C) 2010-2013 Almende B.V.
Copyright (C) 2010-2014 Almende B.V.
</p>
<p>

+ 80
- 0
misc/how_to_publish.md View File

@ -0,0 +1,80 @@
# How to publish vis.js
This document describes how to publish vis.js.
## Build
- Change the version number of the library in both `package.json` and `bower.json`.
- Open `HISTORY.md`, write down the changes, version number, and release date.
- Build the library by running:
npm update
npm run build
This generates the vis.js library in the folder `./dist`.
## Test
- Test the library:
npm test
- Open some of the example in your browser and visually check if it works as expected.
## Commit
- Commit the changes to the `develop` branch.
- Merge the `develop` branch into the `master` branch.
- Push the brances to github
- Create a version tag (with the new version number) and push it to github:
git tag v0.3.0
git push --tags
## Publish
- Publish at npm:
npm publish
- Test the published library:
- Go to a temp directory
- Install the library from npm:
npm install vis
Verify if it installs the just released version, and verify if it works.
- Install the libarry via bower:
bower install vis
Verify if it installs the just released version, and verify if it works.
## Update website
- Copy the `dist` folder from the `master` branch to the `github-pages` branch.
- Copy the `examples` folder from the `master` branch to the `github-pages` branch.
- Copy the `docs` folder from the `master` branch to the `github-pages` branch.
- Create a packaged version of vis.js. Go to the `master` branch and run:
zip vis.zip dist docs examples README.md HISTORY.md LICENSE NOTICE -r
- Move the created zip file `vis.zip` to the `download` folder in the
`github-pages` branch. TODO: this should be automated.
- Go to the `github-pages` branch and run the following script:
node updateversion.js
## Prepare next version
- Switch to the `develop` branch.
- Change version numbers in `package.json` and `bower.json` to a snapshot
version like `0.4.0-SNAPSHOT`.

+ 3
- 2
package.json View File

@ -1,6 +1,6 @@
{
"name": "vis",
"version": "0.3.0-SNAPSHOT",
"version": "0.4.0-SNAPSHOT",
"description": "A dynamic, browser-based visualization library.",
"homepage": "http://visjs.org/",
"repository": {
@ -21,7 +21,8 @@
"browser"
],
"scripts": {
"test": "jake test --trace"
"test": "jake test --trace",
"build": "jake --trace"
},
"dependencies": {},
"devDependencies": {

+ 1
- 1
src/module/header.js View File

@ -8,7 +8,7 @@
* @date @@date
*
* @license
* Copyright (C) 2011-2013 Almende B.V, http://almende.com
* Copyright (C) 2011-2014 Almende B.V, http://almende.com
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy

+ 9
- 0
src/timeline/Timeline.js View File

@ -340,3 +340,12 @@ Timeline.prototype.getItemRange = function getItemRange() {
max: (max != null) ? new Date(max) : null
};
};
/**
* Change the item selection, and/or get currently selected items
* @param {Array} [ids] An array with zero or more ids of the items to be selected.
* @return {Array} ids The ids of the selected items
*/
Timeline.prototype.select = function select(ids) {
return this.content ? this.content.select(ids) : [];
};

+ 9
- 0
src/timeline/component/Group.js View File

@ -75,6 +75,15 @@ Group.prototype.setItems = function setItems(items) {
}
};
/**
* Change the item selection, and/or get currently selected items
* @param {Array} [ids] An array with zero or more ids of the items to be selected.
* @return {Array} ids The ids of the selected items
*/
Group.prototype.select = function select(ids) {
return this.itemset ? this.itemset.select(ids) : [];
};
/**
* Repaint the item
* @return {Boolean} changed

+ 20
- 0
src/timeline/component/GroupSet.js View File

@ -149,6 +149,26 @@ GroupSet.prototype.getGroups = function getGroups() {
return this.groupsData;
};
/**
* Change the item selection, and/or get currently selected items
* @param {Array} [ids] An array with zero or more ids of the items to be selected.
* @return {Array} ids The ids of the selected items
*/
GroupSet.prototype.select = function select(ids) {
var selection = [],
groups = this.groups;
// iterate over each of the groups
for (var id in groups) {
if (groups.hasOwnProperty(id)) {
var group = groups[id];
selection = selection.concat(group.select(ids));
}
}
return selection;
};
/**
* Repaint the component
* @return {Boolean} changed

+ 72
- 2
src/timeline/component/ItemSet.js View File

@ -53,8 +53,9 @@ function ItemSet(parent, depends, options) {
}
};
this.items = {}; // object with an Item for every data item
this.queue = {}; // queue with id/actions: 'add', 'update', 'delete'
this.items = {}; // object with an Item for every data item
this.selection = []; // list with the ids of all selected nodes
this.queue = {}; // queue with id/actions: 'add', 'update', 'delete'
this.stack = new Stack(this, Object.create(this.options));
this.conversion = null;
@ -110,6 +111,69 @@ ItemSet.prototype.setRange = function setRange(range) {
this.range = range;
};
/**
* Change the item selection, and/or get currently selected items
* @param {Array} [ids] An array with zero or more ids of the items to be selected.
* @return {Array} ids The ids of the selected items
*/
ItemSet.prototype.select = function select(ids) {
var i, ii, id, item, selection;
if (ids) {
if (!Array.isArray(ids)) {
throw new TypeError('Array expected');
}
// unselect currently selected items
for (i = 0, ii = this.selection.length; i < ii; i++) {
id = this.selection[i];
item = this.items[id];
if (item) item.unselect();
}
// select items
this.selection = [];
for (i = 0, ii = ids.length; i < ii; i++) {
id = ids[i];
item = this.items[id];
if (item) {
this.selection.push(id);
item.select();
}
}
// trigger a select event
selection = this.selection.concat([]);
events.trigger(this, 'select', {
ids: selection
});
if (this.controller) {
this.requestRepaint();
}
}
else {
selection = this.selection.concat([]);
}
return selection;
};
/**
* Deselect a selected item
* @param {String | Number} id
* @private
*/
ItemSet.prototype._deselect = function _deselect(id) {
var selection = this.selection;
for (var i = 0, ii = selection.length; i < ii; i++) {
if (selection[i] == id) { // non-strict comparison!
selection.splice(i, 1);
break;
}
}
};
/**
* Repaint the component
* @return {Boolean} changed
@ -234,6 +298,7 @@ ItemSet.prototype.repaint = function repaint() {
// create item
if (constructor) {
item = new constructor(me, itemData, options, defaultOptions);
item.id = id;
changed++;
}
else {
@ -253,6 +318,11 @@ ItemSet.prototype.repaint = function repaint() {
case 'remove':
if (item) {
// remove the item from the set selected items
if (item.selected) {
me._deselect(id);
}
// remove DOM of the item
changed += item.hide();
}

+ 8
- 0
src/timeline/component/css/item.css View File

@ -13,6 +13,14 @@
z-index: 999;
}
.vis.timeline .item.point.selected {
background-color: #FFF785;
z-index: 999;
}
.vis.timeline .item.point.selected .dot {
border-color: #FFC200;
}
.vis.timeline .item.cluster {
/* TODO: use another color or pattern? */
background: #97B0F8 url('img/cluster_bg.png');

+ 2
- 0
src/timeline/component/item/Item.js View File

@ -27,6 +27,7 @@ function Item (parent, data, options, defaultOptions) {
*/
Item.prototype.select = function select() {
this.selected = true;
if (this.visible) this.repaint();
};
/**
@ -34,6 +35,7 @@ Item.prototype.select = function select() {
*/
Item.prototype.unselect = function unselect() {
this.selected = false;
if (this.visible) this.repaint();
};
/**

+ 0
- 18
src/timeline/component/item/ItemBox.js View File

@ -29,24 +29,6 @@ function ItemBox (parent, data, options, defaultOptions) {
ItemBox.prototype = new Item (null, null);
/**
* Select the item
* @override
*/
ItemBox.prototype.select = function select() {
this.selected = true;
// TODO: select and unselect
};
/**
* Unselect the item
* @override
*/
ItemBox.prototype.unselect = function unselect() {
this.selected = false;
// TODO: select and unselect
};
/**
* Repaint the item
* @return {Boolean} changed

+ 0
- 18
src/timeline/component/item/ItemPoint.js View File

@ -26,24 +26,6 @@ function ItemPoint (parent, data, options, defaultOptions) {
ItemPoint.prototype = new Item (null, null);
/**
* Select the item
* @override
*/
ItemPoint.prototype.select = function select() {
this.selected = true;
// TODO: select and unselect
};
/**
* Unselect the item
* @override
*/
ItemPoint.prototype.unselect = function unselect() {
this.selected = false;
// TODO: select and unselect
};
/**
* Repaint the item
* @return {Boolean} changed

+ 2
- 19
src/timeline/component/item/ItemRange.js View File

@ -21,24 +21,6 @@ function ItemRange (parent, data, options, defaultOptions) {
ItemRange.prototype = new Item (null, null);
/**
* Select the item
* @override
*/
ItemRange.prototype.select = function select() {
this.selected = true;
// TODO: select and unselect
};
/**
* Unselect the item
* @override
*/
ItemRange.prototype.unselect = function unselect() {
this.selected = false;
// TODO: select and unselect
};
/**
* Repaint the item
* @return {Boolean} changed
@ -86,7 +68,8 @@ ItemRange.prototype.repaint = function repaint() {
}
// update class
var className = this.data.className ? (' ' + this.data.className) : '';
var className = (this.data.className? ' ' + this.data.className : '') +
(this.selected ? ' selected' : '');
if (this.className != className) {
this.className = className;
dom.box.className = 'item range' + className;

+ 1
- 1
test/dataset.js View File

@ -1,6 +1,6 @@
var assert = require('assert'),
moment = require('moment'),
vis = require('../vis.js'),
vis = require('../dist/vis.js'),
DataSet = vis.DataSet;
var now = new Date();

+ 1
- 1
test/dataview.js View File

@ -1,6 +1,6 @@
var assert = require('assert'),
moment = require('moment'),
vis = require('../vis.js'),
vis = require('../dist/vis.js'),
DataSet = vis.DataSet,
DataView = vis.DataView;

+ 1
- 1
test/eventbus.js View File

@ -1,7 +1,7 @@
// test vis.EventBus
var assert = require('assert'),
vis = require('../vis');
vis = require('../dist/vis');
var bus = new vis.EventBus();

Loading…
Cancel
Save