Browse Source

tweaked graph2d based on timeline. Introduced ignoreStacking for items, used in background item type.

v3_develop
Alex de Mulder 10 years ago
parent
commit
d9e27b5d20
6 changed files with 25474 additions and 25458 deletions
  1. +25458
    -25450
      dist/vis.js
  2. +9
    -6
      lib/timeline/Graph2d.js
  3. +1
    -1
      lib/timeline/Stack.js
  4. +1
    -0
      lib/timeline/Timeline.js
  5. +3
    -1
      lib/timeline/component/item/BackgroundItem.js
  6. +2
    -0
      lib/timeline/component/item/Item.js

+ 25458
- 25450
dist/vis.js
File diff suppressed because it is too large
View File


+ 9
- 6
lib/timeline/Graph2d.js View File

@ -141,13 +141,16 @@ Graph2d.prototype.setItems = function(items) {
this.itemsData = newDataSet; this.itemsData = newDataSet;
this.linegraph && this.linegraph.setItems(newDataSet); this.linegraph && this.linegraph.setItems(newDataSet);
if (initialLoad && ('start' in this.options || 'end' in this.options)) {
this.fit();
if (initialLoad) {
if (this.options.start != undefined || this.options.end != undefined) {
var start = this.options.start != undefined ? this.options.start : null;
var end = this.options.end != undefined ? this.options.end : null;
var start = ('start' in this.options) ? util.convert(this.options.start, 'Date') : null;
var end = ('end' in this.options) ? util.convert(this.options.end, 'Date') : null;
this.setWindow(start, end);
this.setWindow(start, end, {animate: false});
}
else {
this.fit({animate: false});
}
} }
}; };

+ 1
- 1
lib/timeline/Stack.js View File

@ -59,7 +59,7 @@ exports.stack = function(items, margin, force) {
var collidingItem = null; var collidingItem = null;
for (var j = 0, jj = items.length; j < jj; j++) { for (var j = 0, jj = items.length; j < jj; j++) {
var other = items[j]; var other = items[j];
if (other.top !== null && other !== item && exports.collision(item, other, margin.item)) {
if (other.top !== null && other !== item && other.ignoreStacking == false && exports.collision(item, other, margin.item)) {
collidingItem = other; collidingItem = other;
break; break;
} }

+ 1
- 0
lib/timeline/Timeline.js View File

@ -144,6 +144,7 @@ Timeline.prototype.setItems = function(items) {
// set items // set items
this.itemsData = newDataSet; this.itemsData = newDataSet;
this.itemSet && this.itemSet.setItems(newDataSet); this.itemSet && this.itemSet.setItems(newDataSet);
if (initialLoad) { if (initialLoad) {
if (this.options.start != undefined || this.options.end != undefined) { if (this.options.start != undefined || this.options.end != undefined) {
var start = this.options.start != undefined ? this.options.start : null; var start = this.options.start != undefined ? this.options.start : null;

+ 3
- 1
lib/timeline/component/item/BackgroundItem.js View File

@ -31,8 +31,10 @@ function BackgroundItem (data, conversion, options) {
} }
} }
this.emptyContent = false;
Item.call(this, data, conversion, options); Item.call(this, data, conversion, options);
this.ignoreStacking = true; // this is not used when stacking
this.emptyContent = false;
} }
BackgroundItem.prototype = new Item (null, null, null); BackgroundItem.prototype = new Item (null, null, null);

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

@ -25,6 +25,8 @@ function Item (data, conversion, options) {
this.left = null; this.left = null;
this.width = null; this.width = null;
this.height = null; this.height = null;
this.ignoreStacking = false;
} }
/** /**

Loading…
Cancel
Save