Stack Overflow : Radio buttons using d3 not horizontally alligned
by Blake Dietz
JavaScript
var shapeData = ["Arrow", "Cross", "Hexagon", "Star", "Triangle"],
j = 3; // Choose the star as default
// Create the shape selectors
var form = d3.select("body").append("form");
labels = form.selectAll("label")
.data(shapeData)
.enter()
.append("label")
.text(function(d) {return d;})
.append("input")
.attr({
type: "radio",
class: "shape",
name: "mode",
value: function(d, i) {return i;}
})
.attr(function(d, i) {return i==j?"selected":null;});