From b51585043b8ecb56954860b734aa5caf7c21e654 Mon Sep 17 00:00:00 2001 From: jos Date: Tue, 9 Sep 2014 11:07:02 +0200 Subject: [PATCH] Added an example on loading external data --- examples/timeline/25_templates.html | 3 +- examples/timeline/26_external_data.html | 58 +++++++++ examples/timeline/data/basic.json | 34 ++++++ examples/timeline/data/wk2014.json | 152 ++++++++++++++++++++++++ examples/timeline/index.html | 1 + 5 files changed, 247 insertions(+), 1 deletion(-) create mode 100644 examples/timeline/26_external_data.html create mode 100644 examples/timeline/data/basic.json create mode 100644 examples/timeline/data/wk2014.json diff --git a/examples/timeline/25_templates.html b/examples/timeline/25_templates.html index 9fb3f500..834f106b 100644 --- a/examples/timeline/25_templates.html +++ b/examples/timeline/25_templates.html @@ -1,7 +1,7 @@ - Timeline | Basic demo + Timeline | Templates @@ -77,6 +77,7 @@ // Create a DataSet (allows two way data-binding) var items = new vis.DataSet([ + // round of 16 { player1: 'Brazil', abbr1: 'br', diff --git a/examples/timeline/26_external_data.html b/examples/timeline/26_external_data.html new file mode 100644 index 00000000..df8e68d4 --- /dev/null +++ b/examples/timeline/26_external_data.html @@ -0,0 +1,58 @@ + + + + Timeline | External data + + + + + + + + + + +

Load external data

+

+ This demo shows how to load external data via an ajax call. +

+
+
loading...
+ + + + \ No newline at end of file diff --git a/examples/timeline/data/basic.json b/examples/timeline/data/basic.json new file mode 100644 index 00000000..711dd8e2 --- /dev/null +++ b/examples/timeline/data/basic.json @@ -0,0 +1,34 @@ +[ + { + "id": 1, + "content": "item 1", + "start": "2014-04-20" + }, + { + "id": 2, + "content": "item 2", + "start": "2014-04-14" + }, + { + "id": 3, + "content": "item 3", + "start": "2014-04-18" + }, + { + "id": 4, + "content": "item 4", + "start": "2014-04-16", + "end": "2014-04-19" + }, + { + "id": 5, + "content": "item 5", + "start": "2014-04-25" + }, + { + "id": 6, + "content": "item 6", + "start": "2014-04-27", + "type": "point" + } +] \ No newline at end of file diff --git a/examples/timeline/data/wk2014.json b/examples/timeline/data/wk2014.json new file mode 100644 index 00000000..2bcb3d75 --- /dev/null +++ b/examples/timeline/data/wk2014.json @@ -0,0 +1,152 @@ +[ + { + "player1": "Brazil", + "abbr1": "br", + "score1": "1 (3)", + "player2": "Chile", + "abbr2": "cl", + "score2": "1 (2)", + "description": "round of 16", + "start": "2014-06-28 13:00" + }, + { + "player1": "Colombia", + "abbr1": "co", + "score1": 2, + "player2": "Uruguay", + "abbr2": "uy", + "score2": 0, + "description": "round of 16", + "start": "2014-06-28 17:00" + }, + { + "player1": "Netherlands", + "abbr1": "nl", + "score1": 2, + "player2": "Mexico", + "abbr2": "mx", + "score2": 1, + "description": "round of 16", + "start": "2014-06-29 13:00" + }, + { + "player1": "Costa Rica", + "abbr1": "cr", + "score1": "1 (5)", + "player2": "Greece", + "abbr2": "gr", + "score2": "1 (3)", + "description": "round of 16", + "start": "2014-06-29 17:00" + }, + { + "player1": "France", + "abbr1": "fr", + "score1": 2, + "player2": "Nigeria", + "abbr2": "ng", + "score2": 0, + "description": "round of 16", + "start": "2014-06-30 13:00" + }, + { + "player1": "Germany", + "abbr1": "de", + "score1": 2, + "player2": "Algeria", + "abbr2": "dz", + "score2": 1, + "description": "round of 16", + "start": "2014-06-30 17:00" + }, + { + "player1": "Argentina", + "abbr1": "ar", + "score1": 1, + "player2": "Switzerland", + "abbr2": "ch", + "score2": 0, + "description": "round of 16", + "start": "2014-07-01 13:00" + }, + { + "player1": "Belgium", + "abbr1": "be", + "score1": 2, + "player2": "USA", + "abbr2": "us", + "score2": 1, + "description": "round of 16", + "start": "2014-07-01 17:00" + }, + { + "player1": "France", + "abbr1": "fr", + "score1": 0, + "player2": "Germany", + "abbr2": "de", + "score2": 1, + "description": "quarter-finals", + "start": "2014-07-04 13:00" + }, + { + "player1": "Brazil", + "abbr1": "br", + "score1": 2, + "player2": "Colombia", + "abbr2": "co", + "score2": 1, + "description": "quarter-finals", + "start": "2014-07-04 17:00" + }, + { + "player1": "Argentina", + "abbr1": "ar", + "score1": 1, + "player2": "Belgium", + "abbr2": "be", + "score2": 0, + "description": "quarter-finals", + "start": "2014-07-05 13:00" + }, + { + "player1": "Netherlands", + "abbr1": "nl", + "score1": "0 (4)", + "player2": "Costa Rica", + "abbr2": "cr", + "score2": "0 (3)", + "description": "quarter-finals", + "start": "2014-07-05 17:00" + }, + { + "player1": "Brazil", + "abbr1": "br", + "score1": 1, + "player2": "Germany", + "abbr2": "de", + "score2": 7, + "description": "semi-finals", + "start": "2014-07-08 17:00" + }, + { + "player1": "Netherlands", + "abbr1": "nl", + "score1": "0 (2)", + "player2": "Argentina", + "abbr2": "ar", + "score2": "0 (4)", + "description": "semi-finals", + "start": "2014-07-09 17:00" + }, + { + "player1": "Germany", + "score1": 1, + "abbr1": "de", + "player2": "Argentina", + "abbr2": "ar", + "score2": 0, + "description": "final", + "start": "2014-07-13 16:00" + } +] \ No newline at end of file diff --git a/examples/timeline/index.html b/examples/timeline/index.html index eb85a0ff..89389e96 100644 --- a/examples/timeline/index.html +++ b/examples/timeline/index.html @@ -37,6 +37,7 @@

23_data_attributes.html

24_background_areas.html

25_templates.html

+

26_external_data.html

requirejs_example.html