Browse Source

Reworked all examples to use vis.DataSet

css_transitions
jos 10 years ago
parent
commit
d83b929c95
10 changed files with 36 additions and 17 deletions
  1. +9
    -2
      docs/timeline.html
  2. +9
    -2
      examples/timeline/01_basic.html
  3. +5
    -0
      examples/timeline/02_interactive.html
  4. +2
    -2
      examples/timeline/04_html_data.html
  5. +1
    -1
      examples/timeline/07_custom_time_bar.html
  6. +2
    -2
      examples/timeline/10_limit_move_and_zoom.html
  7. +2
    -2
      examples/timeline/11_points.html
  8. +2
    -2
      examples/timeline/12_custom_styling.html
  9. +2
    -2
      examples/timeline/15_item_class_names.html
  10. +2
    -2
      examples/timeline/16_navigation_menu.html

+ 9
- 2
docs/timeline.html View File

@ -68,16 +68,23 @@
<div id="visualization"></div> <div id="visualization"></div>
<script type="text/javascript"> <script type="text/javascript">
// DOM element where the Timeline will be attached
var container = document.getElementById('visualization'); var container = document.getElementById('visualization');
var items = [
// Create a DataSet (allows two way data-binding)
var items = new vis.DataSet([
{id: 1, content: 'item 1', start: '2013-04-20'}, {id: 1, content: 'item 1', start: '2013-04-20'},
{id: 2, content: 'item 2', start: '2013-04-14'}, {id: 2, content: 'item 2', start: '2013-04-14'},
{id: 3, content: 'item 3', start: '2013-04-18'}, {id: 3, content: 'item 3', start: '2013-04-18'},
{id: 4, content: 'item 4', start: '2013-04-16', end: '2013-04-19'}, {id: 4, content: 'item 4', start: '2013-04-16', end: '2013-04-19'},
{id: 5, content: 'item 5', start: '2013-04-25'}, {id: 5, content: 'item 5', start: '2013-04-25'},
{id: 6, content: 'item 6', start: '2013-04-27'} {id: 6, content: 'item 6', start: '2013-04-27'}
];
]);
// Configuration for the Timeline
var options = {}; var options = {};
// Create a Timeline
var timeline = new vis.Timeline(container, items, options); var timeline = new vis.Timeline(container, items, options);
</script> </script>
</body> </body>

+ 9
- 2
examples/timeline/01_basic.html View File

@ -16,16 +16,23 @@
<div id="visualization"></div> <div id="visualization"></div>
<script type="text/javascript"> <script type="text/javascript">
// DOM element where the Timeline will be attached
var container = document.getElementById('visualization'); var container = document.getElementById('visualization');
var items = [
// Create a DataSet (allows two way data-binding)
var items = new vis.DataSet([
{id: 1, content: 'item 1', start: '2014-04-20'}, {id: 1, content: 'item 1', start: '2014-04-20'},
{id: 2, content: 'item 2', start: '2014-04-14'}, {id: 2, content: 'item 2', start: '2014-04-14'},
{id: 3, content: 'item 3', start: '2014-04-18'}, {id: 3, content: 'item 3', start: '2014-04-18'},
{id: 4, content: 'item 4', start: '2014-04-16', end: '2014-04-19'}, {id: 4, content: 'item 4', start: '2014-04-16', end: '2014-04-19'},
{id: 5, content: 'item 5', start: '2014-04-25'}, {id: 5, content: 'item 5', start: '2014-04-25'},
{id: 6, content: 'item 6', start: '2014-04-27', type: 'point'} {id: 6, content: 'item 6', start: '2014-04-27', type: 'point'}
];
]);
// Configuration for the Timeline
var options = {}; var options = {};
// Create a Timeline
var timeline = new vis.Timeline(container, items, options); var timeline = new vis.Timeline(container, items, options);
</script> </script>
</body> </body>

+ 5
- 0
examples/timeline/02_interactive.html View File

@ -21,9 +21,14 @@
<script> <script>
// create a dataset with items // create a dataset with items
// we specify the type of the fields `start` and `end` here to be strings
// containing an ISO date. The fields will be outputted as ISO dates
// automatically getting data from the DataSet via items.get().
var items = new vis.DataSet({ var items = new vis.DataSet({
type: { start: 'ISODate', end: 'ISODate' } type: { start: 'ISODate', end: 'ISODate' }
}); });
// add items to the DataSet
items.add([ items.add([
{id: 1, content: 'item 1<br>start', start: '2014-01-23'}, {id: 1, content: 'item 1<br>start', start: '2014-01-23'},
{id: 2, content: 'item 2', start: '2014-01-18'}, {id: 2, content: 'item 2', start: '2014-01-18'},

+ 2
- 2
examples/timeline/04_html_data.html View File

@ -58,7 +58,7 @@
// create data and a Timeline // create data and a Timeline
var container = document.getElementById('visualization'); var container = document.getElementById('visualization');
var items = [
var items = new vis.DataSet([
{id: 1, content: item1, start: '2013-04-20'}, {id: 1, content: item1, start: '2013-04-20'},
{id: 2, content: item2, start: '2013-04-14'}, {id: 2, content: item2, start: '2013-04-14'},
{id: 3, content: item3, start: '2013-04-18'}, {id: 3, content: item3, start: '2013-04-18'},
@ -66,7 +66,7 @@
{id: 5, content: item5, start: '2013-04-25'}, {id: 5, content: item5, start: '2013-04-25'},
{id: 6, content: item6, start: '2013-04-27'}, {id: 6, content: item6, start: '2013-04-27'},
{id: 7, content: item7, start: '2013-04-21'} {id: 7, content: item7, start: '2013-04-21'}
];
]);
var options = {}; var options = {};
var timeline = new vis.Timeline(container, items, options); var timeline = new vis.Timeline(container, items, options);
</script> </script>

+ 1
- 1
examples/timeline/07_custom_time_bar.html View File

@ -34,7 +34,7 @@
<script type="text/javascript"> <script type="text/javascript">
var container = document.getElementById('visualization'); var container = document.getElementById('visualization');
var items = [];
var items = new vis.DataSet();
var options = { var options = {
showCurrentTime: true, showCurrentTime: true,
showCustomTime: true, showCustomTime: true,

+ 2
- 2
examples/timeline/10_limit_move_and_zoom.html View File

@ -28,10 +28,10 @@
<script> <script>
// create some items // create some items
// note that months are zero-based in the JavaScript Date object, so month 4 is May // note that months are zero-based in the JavaScript Date object, so month 4 is May
var items = [
var items = new vis.DataSet([
{'start': new Date(2012, 4, 25), 'content': 'First'}, {'start': new Date(2012, 4, 25), 'content': 'First'},
{'start': new Date(2012, 4, 26), 'content': 'Last'} {'start': new Date(2012, 4, 26), 'content': 'Last'}
];
]);
// create visualization // create visualization
var container = document.getElementById('visualization'); var container = document.getElementById('visualization');

+ 2
- 2
examples/timeline/11_points.html View File

@ -23,7 +23,7 @@
var container = document.getElementById('visualization'); var container = document.getElementById('visualization');
// note that months are zero-based in the JavaScript Date object // note that months are zero-based in the JavaScript Date object
var items = [
var items = new vis.DataSet([
{start: new Date(1939,8,1), content: 'German Invasion of Poland'}, {start: new Date(1939,8,1), content: 'German Invasion of Poland'},
{start: new Date(1940,4,10), content: 'Battle of France and the Low Countries'}, {start: new Date(1940,4,10), content: 'Battle of France and the Low Countries'},
{start: new Date(1940,7,13), content: 'Battle of Britain - RAF vs. Luftwaffe'}, {start: new Date(1940,7,13), content: 'Battle of Britain - RAF vs. Luftwaffe'},
@ -44,7 +44,7 @@
{start: new Date(1944,1,19), content: 'American Landings on Iwo Jima'}, {start: new Date(1944,1,19), content: 'American Landings on Iwo Jima'},
{start: new Date(1945,3,1), content: 'US Invasion of Okinawa'}, {start: new Date(1945,3,1), content: 'US Invasion of Okinawa'},
{start: new Date(1945,3,16), content: 'Battle of Berlin - End of the Third Reich'} {start: new Date(1945,3,16), content: 'Battle of Berlin - End of the Third Reich'}
];
]);
var options = { var options = {
// Set global item type. Type can also be specified for items individually // Set global item type. Type can also be specified for items individually

+ 2
- 2
examples/timeline/12_custom_styling.html View File

@ -67,7 +67,7 @@
var container = document.getElementById('visualization'); var container = document.getElementById('visualization');
// note that months are zero-based in the JavaScript Date object // note that months are zero-based in the JavaScript Date object
var items = [
var items = new vis.DataSet([
{start: new Date(2010,7,23), content: '<div>Conversation</div><img src="img/community-users-icon.png" style="width:32px; height:32px;">'}, {start: new Date(2010,7,23), content: '<div>Conversation</div><img src="img/community-users-icon.png" style="width:32px; height:32px;">'},
{start: new Date(2010,7,23,23,0,0), content: '<div>Mail from boss</div><img src="img/mail-icon.png" style="width:32px; height:32px;">'}, {start: new Date(2010,7,23,23,0,0), content: '<div>Mail from boss</div><img src="img/mail-icon.png" style="width:32px; height:32px;">'},
{start: new Date(2010,7,24,16,0,0), content: 'Report'}, {start: new Date(2010,7,24,16,0,0), content: 'Report'},
@ -76,7 +76,7 @@
{start: new Date(2010,7,29), content: '<div>Phone call</div><img src="img/Hardware-Mobile-Phone-icon.png" style="width:32px; height:32px;">'}, {start: new Date(2010,7,29), content: '<div>Phone call</div><img src="img/Hardware-Mobile-Phone-icon.png" style="width:32px; height:32px;">'},
{start: new Date(2010,7,31), end: new Date(2010,8,3), content: 'Traject B'}, {start: new Date(2010,7,31), end: new Date(2010,8,3), content: 'Traject B'},
{start: new Date(2010,8,4,12,0,0), content: '<div>Report</div><img src="img/attachment-icon.png" style="width:32px; height:32px;">'} {start: new Date(2010,8,4,12,0,0), content: '<div>Report</div><img src="img/attachment-icon.png" style="width:32px; height:32px;">'}
];
]);
var options = { var options = {
editable: true, editable: true,

+ 2
- 2
examples/timeline/15_item_class_names.html View File

@ -74,7 +74,7 @@
<script type="text/javascript"> <script type="text/javascript">
// create data // create data
// note that months are zero-based in the JavaScript Date object // note that months are zero-based in the JavaScript Date object
var data = [
var data = new vis.DataSet([
{ {
'start': new Date(2012,7,19), 'start': new Date(2012,7,19),
'content': 'default' 'content': 'default'
@ -100,7 +100,7 @@
'content': 'magenta', 'content': 'magenta',
'className': 'magenta' 'className': 'magenta'
} }
];
]);
// specify options // specify options
var options = { var options = {

+ 2
- 2
examples/timeline/16_navigation_menu.html View File

@ -38,14 +38,14 @@
<script type="text/javascript"> <script type="text/javascript">
// create a timeline with some data // create a timeline with some data
var container = document.getElementById('visualization'); var container = document.getElementById('visualization');
var items = [
var items = new DataSet([
{id: 1, content: 'item 1', start: '2014-04-20'}, {id: 1, content: 'item 1', start: '2014-04-20'},
{id: 2, content: 'item 2', start: '2014-04-14'}, {id: 2, content: 'item 2', start: '2014-04-14'},
{id: 3, content: 'item 3', start: '2014-04-18'}, {id: 3, content: 'item 3', start: '2014-04-18'},
{id: 4, content: 'item 4', start: '2014-04-16', end: '2014-04-19'}, {id: 4, content: 'item 4', start: '2014-04-16', end: '2014-04-19'},
{id: 5, content: 'item 5', start: '2014-04-25'}, {id: 5, content: 'item 5', start: '2014-04-25'},
{id: 6, content: 'item 6', start: '2014-04-27', type: 'point'} {id: 6, content: 'item 6', start: '2014-04-27', type: 'point'}
];
]);
var options = {}; var options = {};
var timeline = new vis.Timeline(container, items, options); var timeline = new vis.Timeline(container, items, options);

Loading…
Cancel
Save