Last active
June 12, 2018 15:47
-
-
Save davidrs/e3dc314c7e230f40b813 to your computer and use it in GitHub Desktop.
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
<!-- | |
1. Load legend json from the service | |
--> | |
<script> | |
var myService = 'http://fake.com/arcgis/rest/services/Timor/IlliteracyRate/MapServer'; | |
$.ajax({ | |
url: myService + '/legend', | |
data:{f: 'pjson'}, | |
dataType: 'jsonp' | |
}).then(function(esriLegend){ | |
_.template(Template)({esriLegend: esriLegend}); | |
}); | |
</script> | |
<!-- HTML for a _.template file that parses the json, and creates images for it. | |
<% _.each(esriLegend, function(legend) { | |
if (legend.label && legend.imageData) { | |
%> | |
<div> | |
<img src="data:<%= legend.contentType %>;base64,<%= legend.imageData %>" class="color-block" /> | |
<%= legend.label %> | |
</div> | |
<% } | |
}); %> | |
<% } %> |
Do you have a working example of this? I'd like to try to implement it, but have never worked with whatever is going on at line 16. What kind of tag is that?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
👍