I've pulled out some data and after scaling, I draw a bunch of circles. This works just great.
var gSet = graph1.selectAll("g").data(data).enter().append("g");
gSet.append("circle")
.attr({ cx: posX, cy: posY, r: dotSize })
.attr("class", "dataPoint");
Now, I'd like to connect the dots. Most examples I've seen are about bars, not lines so I've googled some more line charts and decided to use path element, like so.
var gSet = graph1.selectAll("g").data(data).enter().append("g");
gSet.append("circle")
.attr({ cx: posX, cy: posY, r: dotSize })
.attr("class", "dataPoint");
gSet.append("path")
.attr("d", d3.svg.line().x(posX).y(posY))
.attr({ "stroke": "yellow", "stroke-width": "1" });
Nothing new appears on the screen and due to ignorance, I'm not sure where to poke to see what went wrong.
- Should I be using path (or is line, polyline etc. a better choice)?
- Should I be working with the d attribute or is there a more suited one?
- Should I be applying the d3.svg.line() function or is there a smoother way?