I'm striving to create a graph that includes lines and dots.
Although I have successfully drawn lines and dots with zoom and brush functionalities, the issue arises when I try to zoom in or out - the dots do not adjust accordingly.
Being relatively new to D3 graphs, I have used the following code to plot the dots:
g.selectAll(".dot")
.data(dots)
.enter()
.append("circle")
.attr("class", "dot")
.attr("r", 3.5)
.attr("cx", function(d) { return x(new Date(d.date)); })
.attr("cy", function(d) { return y(d.price); })
.on("mouseover", function(d){
return tooltip.style("visibility", "visible").html("Expected value is: "+d.expected_value + "<br/>" + "value : "+d.close +"<br/>" + "deviation is: "+d.deviation_expected)
})
.on("mousemove", function(){return tooltip.style("top", (event.pageY-10)+"px").style("left",(event.pageX+10)+"px");})
.on("mouseout", function(){return tooltip.style("visibility", "hidden");});
You can find my progress on this jsfiddle link.
Your assistance would be greatly appreciated.