[ Launch: reusable API snippet ] 9262903 by DeBraid
-
-
Save DeBraid/9262903 to your computer and use it in GitHub Desktop.
reusable API snippet
This file contains hidden or 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
{"description":"reusable API snippet","endpoint":"","display":"svg","public":true,"require":[],"fileconfigs":{"inlet.js":{"default":true,"vim":false,"emacs":false,"fontSize":12}},"fullscreen":false,"play":false,"loop":false,"restart":false,"autoinit":true,"pause":true,"loop_type":"pingpong","bv":false,"nclones":15,"clone_opacity":0.4,"duration":3000,"ease":"linear","dt":0.01} |
This file contains hidden or 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
// using datum to bind multiple array | |
// pattern allows us to create 1 section to draw the charts | |
// and pass it complex data (2, 3, n-element arrays) | |
// and it will just draw the chart | |
/* | |
Links: | |
http://bl.ocks.org/biovisualize/5372077 | |
*/ | |
var foo = [70, 30, 60]; | |
var bar = [33, 44, 55]; | |
var baz = [31,12,43]; | |
var data = [foo, bar, baz]; | |
var canvas = d3.select("svg").attr({"height", width}); | |
canvas.selectAll('div') | |
.data().enter() | |
.datum(function(d){ return d}) | |
.call(reusable chart function barChart();); | |
// combine the above with: | |
function exports (_selection) { | |
_selection.each(function (_data) { | |
// d3 charting code here | |
// .. | |
// margins, scales, axes, etc | |
}) | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment