Skip to content

Instantly share code, notes, and snippets.

@tylerdmace
Created July 20, 2015 11:54
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 tylerdmace/6de92b0aaf9f0c499f72 to your computer and use it in GitHub Desktop.
Save tylerdmace/6de92b0aaf9f0c499f72 to your computer and use it in GitHub Desktop.
Promises & D3
node.append('text')
.attr('text-anchor', 'middle')
.attr('dominant-baseline', 'central')
.style('font-family','FontAwesome')
.style('font-size','24px')
.text(getIcon)
.style('fill', function (d) {
return color(d.group);
});
function getIcon(d) {
myPromise.then(function(data) {
if(data.value) {
return '\uf108';
} else { return '\uf233'; }
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment