Adding Grid to D3.js Line Chart -
i have line chart here:
jsfiddle.net/yfqq4/
my problem is, don't proper grid in background working legend (y , x-axis) this: http://lab.creativebrains.net/linechart.png
can can post me code snippet how should implement or that?
thanks!
you can draw background grid this:
//vertical lines svg.selectall(".vline").data(d3.range(26)).enter() .append("line") .attr("x1", function (d) { return d * 20; }) .attr("x2", function (d) { return d * 20; }) .attr("y1", function (d) { return 0; }) .attr("y2", function (d) { return 500; }) .style("stroke", "#eee"); // horizontal lines svg.selectall(".vline").data(d3.range(26)).enter() .append("line") .attr("y1", function (d) { return d * 20; }) .attr("y2", function (d) { return d * 20; }) .attr("x1", function (d) { return 0; }) .attr("x2", function (d) { return 500; }) .style("stroke", "#eee");
you can see here how works jsfiddle (updated): http://jsfiddle.net/cuckovic/phzvy/
Comments
Post a Comment