// A very, very simple D3 modular chart based on http://bost.ocks.org/mike/chart/ function histobar() { var width = 720, // default width height = 80; // default height function my(selection) { selection.each(function(d, i) { // Select the svg element, if it exists var svg = d3.select(this).selectAll("svg").data([data]); // Create a g inside the svg var g = svg.enter().append("svg").append("g"); // Set the svg node parameters svg.attr("width", width); svg.attr("height", height); // Render the chart g.append("text").text(d).attr("transform", "translate (0,10)"); }); } my.width = function(value) { if (!arguments.length) return width; width = value; return my; }; my.height = function(value) { if (!arguments.length) return height; height = value; return my; }; return my; }