westdc-zf1/htdocs/js/timemap.2.0.1/examples/progressive.html

69 lines
2.9 KiB
HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<title>Progressive Loading Example</title>
<script src="http://maps.google.com/maps?file=api&v=2&key=ABQIAAAASI0kCI-azC8RgbOZzWc3VRRarOQe_TKf_51Omf6UUSOFm7EABRRhO0PO4nBAO9FCmVDuowVwROLo3w"
type="text/javascript"></script>
<script type="text/javascript" src="../lib/jquery-1.6.2.min.js"></script>
<script type="text/javascript" src="../lib/mxn/mxn.js?(google)"></script>
<script type="text/javascript" src="../lib/timeline-2.3.0.js"></script>
<script src="../src/timemap.js" type="text/javascript"></script>
<script src="../src/loaders/json.js" type="text/javascript"></script>
<script src="../src/loaders/progressive.js" type="text/javascript"></script>
<script type="text/javascript">
var tm;
$(function() {
tm = TimeMap.init({
mapId: "map", // Id of map div element (required)
timelineId: "timeline", // Id of timeline div element (required)
options: {
eventIconPath: "../images/"
},
datasets: [
{
title: "Progressive Dataset",
theme: "green",
type: "progressive",
options: {
// Data to be loaded in JSON from a remote URL
type: "json",
// url with start/end placeholders
url: "http://www.nickrabinowitz.com/projects/timemap/progsvc.php?start=[start]&end=[end]&callback=?",
start: "2004-10-15",
// lower cutoff date for data
dataMinDate: "2004-10-15",
// four months in milliseconds
interval: 10368000000,
// function to turn date into string appropriate for service
formatDate: function(d) {
return TimeMap.util.formatDate(d, 1);
}
}
}
],
bandIntervals: "wk"
});
});
</script>
<link href="examples.css" type="text/css" rel="stylesheet"/>
</head>
<body>
<div id="help">
<h1>Progressive Loading</h1>
In this example, we're loading data from a JSON service that takes start and end date parameters; data is loaded progressively as the user scrolls the timeline. This is a good idea for very large datasets spread out over a long period of time. (For this demonstration, I'm just using a mock service that returns random data - <a href="https://gist.github.com/1129009">see the PHP code here.</a>)
</div>
<div id="timemap">
<div id="timelinecontainer">
<div id="timeline"></div>
</div>
<div id="mapcontainer">
<div id="map"></div>
</div>
</div>
</body>
</html>