Skip to content

Instantly share code, notes, and snippets.

@jrm2k6
Created July 13, 2013 14:42
Show Gist options
  • Select an option

  • Save jrm2k6/5990944 to your computer and use it in GitHub Desktop.

Select an option

Save jrm2k6/5990944 to your computer and use it in GitHub Desktop.
var createCells = function() {
var data = generateCoordinates([1,3,7,5,6]);
var svg = d3.select("svg");
var gs = svg.selectAll("g")
.data(data)
.enter()
.append("g")
.attr("class",function(d){return "cell_" + d.text;});
gs.append("rect")
.attr("y", function(d){return d.y;})
.attr("x", function(d){return d.x;})
.attr("width", 30)
.attr("height", 30)
.style("fill", "white")
.style("stroke", "black")
.style("stroke-width", "2px")
.attr("class", function(d){return "cell_lol" + d.text;})
gs.append("text")
.text(function(d){return d.text;})
.style("alignment-baseline", "central")
.attr("y", function(d){return d.y + 15;})
.attr("x", function(d){return d.x + 2;})
.attr("class", function(d){return "cell_text_" + d.text;})
};
var showPivot = function() {
d3.select("svg").selectAll("g.cell_3")
.transition()
.attr("x",620)
.attr("y", 400);
// d3.selectAll(".cell_text_3")
// .transition()
// .attr("x",620)
// .attr("y", 400);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment