Skip to content

Instantly share code, notes, and snippets.

@iriberri
Last active August 29, 2015 14:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iriberri/df90d4d4662202894d65 to your computer and use it in GitHub Desktop.
Save iriberri/df90d4d4662202894d65 to your computer and use it in GitHub Desktop.
Torque formatter by @rambo
<!DOCTYPE html>
<html>
<head>
<title>Easy example | CartoDB.js</title>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<link rel="shortcut icon" href="http://cartodb.com/assets/favicon.ico" />
<style>
html, body, #map {
height: 100%;
padding: 0;
margin: 0;
}
</style>
<link rel="stylesheet" href="http://libs.cartocdn.com/cartodb.js/v3/3.12/themes/css/cartodb.css" />
</head>
<body>
<div id="map"></div>
<script src="http://libs.cartocdn.com/cartodb.js/v3/3.12/cartodb.js"></script>
<script>
function main() {
cartodb.createVis('map', 'http://andrew.cartodb.com/api/v2/viz/b5cece38-4af4-11e3-bfb4-3085a9a9563c/viz.json', {
shareable: true,
title: true,
description: true,
search: true,
tiles_loader: true,
center_lat: 0,
center_lon: 0,
zoom: 2
})
.done(function(vis, layers) {
var slider = vis.timeSlider;
slider.formatter(function(d) {
return d.getUTCMonth()+"-"+ d.getUTCDay() + " "+ d.getUTCHours() + ":"+ d.getUTCMinutes();
//return "month:" + d.getUTCMonth();
})
})
.error(function(err) {
console.log(err);
});
}
window.onload = main;
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment