Built with blockbuilder.org
Last active
March 4, 2017 13:39
-
-
Save zidom/69d7e73940207fc0ace5576c5f8ae59c to your computer and use it in GitHub Desktop.
fresh block
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
license: mit |
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> | |
<head> | |
<meta charset="utf-8"> | |
<script src="https://d3js.org/d3.v4.min.js"></script> | |
<style> | |
body { margin:0;position:fixed;top:0;right:0;bottom:0;left:0; } | |
</style> | |
</head> | |
<body> | |
<script> | |
functon SimpleWidgit(dest){ | |
var instance = {}; | |
var headline, description; | |
instance.render = function(){ | |
var div = d3.select('body').append('div'); | |
div.append('h3').text(headline); | |
div.attr('class','box') | |
.attr('style', 'color:' + spec.color) | |
.append('p') | |
text(description); | |
return instance; | |
}; | |
instance.headline = function(h){ | |
if(!arguments.length) h; | |
headline = h; | |
return instance; | |
}; | |
instance.description = function(desc){ | |
if(!arguments.length) desc; | |
description = desc; | |
return instance; | |
}; | |
return instance; | |
} | |
var widget = SimpleWidget({color:'#6495ed'}) | |
.headline("Simple Widget") | |
.description('This is test Widget!!!!'); | |
widget.render(); | |
</script> | |
</body> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment