diff options
| author | Pliable Pixels <pliablepixels@gmail.com> | 2016-10-28 13:31:36 -0700 |
|---|---|---|
| committer | Pliable Pixels <pliablepixels@gmail.com> | 2016-10-28 13:31:36 -0700 |
| commit | 05e761abca3ff42dbba371af0560b82707dfe7c0 (patch) | |
| tree | 268cc06b931357a0ffad684961ff6d24eeec3b4b /www/lib/vis/examples/timeline/dataHandling/loadExternalData.html | |
| parent | 55a9e628760dc31400457099e4aaabc767beed70 (diff) | |
updated vis
Diffstat (limited to 'www/lib/vis/examples/timeline/dataHandling/loadExternalData.html')
| -rw-r--r-- | www/lib/vis/examples/timeline/dataHandling/loadExternalData.html | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/www/lib/vis/examples/timeline/dataHandling/loadExternalData.html b/www/lib/vis/examples/timeline/dataHandling/loadExternalData.html new file mode 100644 index 00000000..a5002726 --- /dev/null +++ b/www/lib/vis/examples/timeline/dataHandling/loadExternalData.html @@ -0,0 +1,58 @@ +<!DOCTYPE HTML> +<html> +<head> + <title>Timeline | External data</title> + + <style type="text/css"> + body, html { + font-family: sans-serif; + } + </style> + + <!-- Load jquery for ajax support --> + <script src="http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> + + <script src="../../../dist/vis.js"></script> + <link href="../../../dist/vis.css" rel="stylesheet" type="text/css" /> + <script src="../../googleAnalytics.js"></script> +</head> +<body> +<p> + This demo shows how to load external data via an ajax call. +</p> +<div id="visualization"></div> +<div id="loading">loading...</div> + +<script type="text/javascript"> + // load data via an ajax request. When the data is in, load the timeline + $.ajax({ + url: '../resources/data/basic.json', + success: function (data) { + // hide the "loading..." message + document.getElementById('loading').style.display = 'none'; + + // DOM element where the Timeline will be attached + var container = document.getElementById('visualization'); + + // Create a DataSet (allows two way data-binding) + var items = new vis.DataSet(data); + + // Configuration for the Timeline + var options = {}; + + // Create a Timeline + var timeline = new vis.Timeline(container, items, options); + }, + error: function (err) { + console.log('Error', err); + if (err.status === 0) { + alert('Failed to load data/basic.json.\nPlease run this example on a server.'); + } + else { + alert('Failed to load data/basic.json.'); + } + } + }); +</script> +</body> +</html>
\ No newline at end of file |
