Skip to content

Instantly share code, notes, and snippets.

@michellechandra
Created January 7, 2016 19:43
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 michellechandra/83304e8e63fec7b6c155 to your computer and use it in GitHub Desktop.
Save michellechandra/83304e8e63fec7b6c155 to your computer and use it in GitHub Desktop.
Custom Legend - Create Vis
<!DOCTYPE html>
<html>
<head>
<title>Custom Legend Example</title>
<link rel="stylesheet" href="http://libs.cartodb.com/cartodb.js/v3/3.15/themes/css/cartodb.css" />
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<style>
html, body, #map {
height: 100%;
padding: 0;
margin: 0;
}
#map .cartodb-legend-stack {
position: absolute;
left: 20px;
width: 80px;
top:100px;
padding: 2px;
z-index: 99;
bottom: auto;}
</style>
</head>
<body>
<div class="map" id="map"></div>
<script src="http://libs.cartodb.com/cartodb.js/v3/3.15/cartodb.js"></script>
<script>
function main() {
cartodb.createVis('map', 'https://team.cartodb.com/u/chandra/api/v2/viz/f8a5125c-b56f-11e5-a5c9-0e787de82d45/viz.json', {legends:true})
.done(function(vis, layers) {
})
.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