From 94f6e365d0b0533447618b76fdd54bdcd330b4b1 Mon Sep 17 00:00:00 2001 From: Eric Gillingham Date: Wed, 10 Jul 2013 18:02:15 -0700 Subject: [PATCH 1/4] Add a new moveTo function to range to allow a program to recenter the timeline on any given date. --- src/timeline/Range.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/timeline/Range.js b/src/timeline/Range.js index 9f02fe69..ae9b43af 100644 --- a/src/timeline/Range.js +++ b/src/timeline/Range.js @@ -522,3 +522,19 @@ Range.prototype.move = function(moveFactor) { this.start = newStart; this.end = newEnd; }; + +/** + * Move the range to a new center point + * @param {Number} moveTo New center point of the range + */ +Range.prototype.moveTo = function(moveTo) { + var center = (this.start + this.end) / 2; + + var diff = center - moveTo; + + // calculate new start and end + var newStart = this.start - diff; + var newEnd = this.end - diff; + + this.setRange(newStart, newEnd); +} From cc1509caef249bb202920812f81fa63f8fc03268 Mon Sep 17 00:00:00 2001 From: josdejong Date: Tue, 13 Aug 2013 16:25:49 +0200 Subject: [PATCH 2/4] Added index pages to the examples --- docs/dataset.html | 1 - docs/dataview.html | 1 - docs/index.html | 1 - docs/timeline.html | 4 +--- examples/graph/index.html | 35 +++++++++++++++++++++++++++++++++++ examples/index.html | 20 ++++++++++++++++++++ examples/timeline/index.html | 23 +++++++++++++++++++++++ 7 files changed, 79 insertions(+), 6 deletions(-) create mode 100644 examples/graph/index.html create mode 100644 examples/index.html create mode 100644 examples/timeline/index.html diff --git a/docs/dataset.html b/docs/dataset.html index b6590ff2..1847a3b1 100644 --- a/docs/dataset.html +++ b/docs/dataset.html @@ -3,7 +3,6 @@ vis.js | DataSet documentation - diff --git a/docs/dataview.html b/docs/dataview.html index e637a2e0..bb459d9c 100644 --- a/docs/dataview.html +++ b/docs/dataview.html @@ -3,7 +3,6 @@ vis.js | DataView documentation - diff --git a/docs/index.html b/docs/index.html index fbd7bd60..4e1f8215 100644 --- a/docs/index.html +++ b/docs/index.html @@ -3,7 +3,6 @@ vis.js | documentation - diff --git a/docs/timeline.html b/docs/timeline.html index 2b0fb2e1..4bdd9ee7 100644 --- a/docs/timeline.html +++ b/docs/timeline.html @@ -141,9 +141,7 @@ var items = [ start: new Date(2010, 7, 15), end: new Date(2010, 8, 2), // end is optional content: 'Trajectory A' - // Optional: a field 'group' - // Optional: a field 'className' - // Optional: a field 'editable' + // Optional: fields 'id', 'type', 'group', 'className' } // more items... ]); diff --git a/examples/graph/index.html b/examples/graph/index.html new file mode 100644 index 00000000..04691215 --- /dev/null +++ b/examples/graph/index.html @@ -0,0 +1,35 @@ + + + + + vis.js | examples + + + + + + + + \ No newline at end of file diff --git a/examples/index.html b/examples/index.html new file mode 100644 index 00000000..cbac149d --- /dev/null +++ b/examples/index.html @@ -0,0 +1,20 @@ + + + + + vis.js | examples + + + + + +
+ +

vis.js examples

+ +

graph

+

timeline

+ +
+ + \ No newline at end of file diff --git a/examples/timeline/index.html b/examples/timeline/index.html new file mode 100644 index 00000000..faa6b2c4 --- /dev/null +++ b/examples/timeline/index.html @@ -0,0 +1,23 @@ + + + + + vis.js | examples + + + + + + + + \ No newline at end of file From f544c34ef950baa2650c321ec36b1eac8257307b Mon Sep 17 00:00:00 2001 From: josdejong Date: Fri, 16 Aug 2013 16:58:52 +0200 Subject: [PATCH 3/4] Graph example added --- examples/graph/17_network_info.html | 156 ++++++++++++++++++++++++++++ examples/graph/index.html | 5 +- examples/timeline/index.html | 4 +- 3 files changed, 161 insertions(+), 4 deletions(-) create mode 100644 examples/graph/17_network_info.html diff --git a/examples/graph/17_network_info.html b/examples/graph/17_network_info.html new file mode 100644 index 00000000..ebec84f8 --- /dev/null +++ b/examples/graph/17_network_info.html @@ -0,0 +1,156 @@ + + + + Graph | Images + + + + + + + + + + +
+ + + + \ No newline at end of file diff --git a/examples/graph/index.html b/examples/graph/index.html index 04691215..0fd44cfb 100644 --- a/examples/graph/index.html +++ b/examples/graph/index.html @@ -2,7 +2,7 @@ - vis.js | examples + vis.js | graph examples @@ -10,7 +10,7 @@ diff --git a/examples/timeline/index.html b/examples/timeline/index.html index faa6b2c4..937d5dab 100644 --- a/examples/timeline/index.html +++ b/examples/timeline/index.html @@ -2,7 +2,7 @@ - vis.js | examples + vis.js | timeline examples @@ -10,7 +10,7 @@
-

vis.js examples

+

vis.js timeline examples

01_basic.html

02_dataset.html

From 1c200f7dfc8e2fafaa5d8eedcf4cdb547c6ec950 Mon Sep 17 00:00:00 2001 From: josdejong Date: Fri, 30 Aug 2013 08:36:02 +0200 Subject: [PATCH 4/4] Fixed #7: className not working for items --- src/timeline/component/ItemSet.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/timeline/component/ItemSet.js b/src/timeline/component/ItemSet.js index 6e816032..5e643108 100644 --- a/src/timeline/component/ItemSet.js +++ b/src/timeline/component/ItemSet.js @@ -192,9 +192,9 @@ ItemSet.prototype.repaint = function repaint() { itemsData = this.itemsData, items = this.items, dataOptions = { - fields: [(itemsData && itemsData.fieldId || 'id'), 'start', 'end', 'content', 'type'] + // TODO: cleanup + //fields: [(itemsData && itemsData.fieldId || 'id'), 'start', 'end', 'content', 'type'] }; - // TODO: copy options from the itemset itself? // show/hide added/changed/removed items Object.keys(queue).forEach(function (id) {