Browse Source

Fixed #11: initial empty range in the Timeline in case of a single item

css_transitions
josdejong 10 years ago
parent
commit
b8e8bf7141
7 changed files with 19 additions and 16 deletions
  1. +1
    -0
      HISTORY.md
  2. +1
    -5
      examples/graph/17_network_info.html
  3. +4
    -0
      src/timeline/Timeline.js
  4. +0
    -1
      src/timeline/component/Group.js
  5. +1
    -1
      src/timeline/component/ItemSet.js
  6. +7
    -4
      vis.js
  7. +5
    -5
      vis.min.js

+ 1
- 0
HISTORY.md View File

@ -4,6 +4,7 @@ http://visjs.org
## (not yet released), version 0.1.1
- Fixed initial empty range in the Timeline in case of a single item.
- Fixed field `className` not working for items.

+ 1
- 5
examples/graph/17_network_info.html View File

@ -24,11 +24,7 @@
var edges = null;
var graph = null;
var DIR = 'img/refresh-cl/',
SWITCH = DIR + 'Network-Pipe-icon.png',
COMPUTER = DIR + 'Hardware-My-Computer-3-icon.png',
PRINTER = DIR + 'Hardware-Printer-Blue-icon.png',
LENGTH_MAIN = 350,
var LENGTH_MAIN = 350,
LENGTH_SERVER = 150,
LENGTH_SUB = 50,
GREEN = 'green',

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

@ -174,6 +174,10 @@ Timeline.prototype.setItems = function(items) {
var max = dataRange.max;
if (min != null && max != null) {
var interval = (max.valueOf() - min.valueOf());
if (interval <= 0) {
// prevent an empty interval
interval = 24 * 60 * 60 * 1000; // 1 day
}
min = new Date(min.valueOf() - interval * 0.05);
max = new Date(max.valueOf() + interval * 0.05);
}

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

@ -11,7 +11,6 @@ function Group (parent, groupId, options) {
this.parent = parent;
this.groupId = groupId;
this.itemsData = null; // DataSet
this.itemset = null; // ItemSet
this.options = options || {};
this.options.top = 0;

+ 1
- 1
src/timeline/component/ItemSet.js View File

@ -193,7 +193,7 @@ ItemSet.prototype.repaint = function repaint() {
items = this.items,
dataOptions = {
// TODO: cleanup
//fields: [(itemsData && itemsData.fieldId || 'id'), 'start', 'end', 'content', 'type']
// fields: [(itemsData && itemsData.fieldId || 'id'), 'start', 'end', 'content', 'type', 'className']
};
// show/hide added/changed/removed items

+ 7
- 4
vis.js View File

@ -5,7 +5,7 @@
* A dynamic, browser-based visualization library.
*
* @version 0.2.0-SNAPSHOT
* @date 2013-09-02
* @date 2013-09-09
*
* @license
* Copyright (C) 2011-2013 Almende B.V, http://almende.com
@ -3002,7 +3002,7 @@ function Range(options) {
this.start = 0; // Number
this.end = 0; // Number
// this.options = options || {}; // TODO
// this.options = options || {}; // TODO: fix range options
this.options = {
min: null,
max: null,
@ -4893,7 +4893,7 @@ ItemSet.prototype.repaint = function repaint() {
items = this.items,
dataOptions = {
// TODO: cleanup
//fields: [(itemsData && itemsData.fieldId || 'id'), 'start', 'end', 'content', 'type']
// fields: [(itemsData && itemsData.fieldId || 'id'), 'start', 'end', 'content', 'type', 'className']
};
// show/hide added/changed/removed items
@ -6150,7 +6150,6 @@ function Group (parent, groupId, options) {
this.parent = parent;
this.groupId = groupId;
this.itemsData = null; // DataSet
this.itemset = null; // ItemSet
this.options = options || {};
this.options.top = 0;
@ -6919,6 +6918,10 @@ Timeline.prototype.setItems = function(items) {
var max = dataRange.max;
if (min != null && max != null) {
var interval = (max.valueOf() - min.valueOf());
if (interval <= 0) {
// prevent an empty interval
interval = 24 * 60 * 60 * 1000; // 1 day
}
min = new Date(min.valueOf() - interval * 0.05);
max = new Date(max.valueOf() + interval * 0.05);
}

+ 5
- 5
vis.min.js
File diff suppressed because it is too large
View File


Loading…
Cancel
Save