javascript - Add a link to another page with d3.js -


this straight forward. i'm looking add link page. i'm trying add through d3. add attribute in js? iv tried .attr("src", "newpage.html") , .attr("url", "newpage.html") neither work.

any advice appreciated. thanks.

   //js    var newlink = d3.select(".chart")       .append("div")       .html("trend graph")       .attr("class", "populationtrend")       //css    .populationtrend{        font-weight:400;        margin-top:-15%;        cursor:pointer;        padding-left:70%;        background-color:#039;     }    

to add "normal" link (i.e. anchor tag), can do

d3.select(".chart")   .append("a")   .attr("href", "newpage.html")   .html("new page"); 

or even

d3.select(".chart")   .append("div")   .html("<a href='newpage.html'>new page</a>"); 

Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -