-
-
Save ramiroaznar/5b0ddb54e20d5a286082dee836e58363 to your computer and use it in GitHub Desktop.
Set Legend within createVis
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>GIS People | Set Legend within createVis</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="https://cartodb-libs.global.ssl.fastly.net/cartodb.js/v3/3.15/themes/css/cartodb.css" /> | |
</head> | |
<body> | |
<div id="map"></div> | |
<script src="https://cartodb-libs.global.ssl.fastly.net/cartodb.js/v3/3.15/cartodb.js"></script> | |
<script> | |
mapUrl='https://gisp.carto.com/u/gispeople/api/v2/viz/60d4cbe2-2925-11e5-9287-0e9d821ea90d/viz.json' | |
cartodb.createVis('map', mapUrl, { | |
legends:true // set legends to true | |
}) | |
.on('done', function(vis,layers) { | |
console.log(vis); | |
console.log(layers); | |
}).on('error', function() { | |
console.log("some error occurred"); | |
}); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment