I made a scatter plot and want to add a link to each point.
chart.selectAll("scatter-dots")
.data(data)
.enter().append("circle")
.attr("cx", function (d) { return x(d.position[0]); } )
.attr("cy", function (d) { return y(d.position[1]); } )
.attr("r", 4)
.style("fill", "#666")
.style("opacity", 0.5)
.on("click", function(){
var url = "http://somelink.com/link.php?id=";
url += d.link_id;
});
This works if I just put a clean string link, for example window.location = "http://stackoverflow.com" However, if I add requests to the end of the URL from a variable, the page is not redirected.
Neither jquery nor javascript worked (as commented out.)
I also tried an external js file, still failed.
This is in the PHP file if that helps.
source
share