charts - Adding a X-value line on nvd3 -


i'm using chart similar sample linechart example. want implement x-value line on chart, similar this flot examples.

i tried following, can't work. here's jsfiddle. ideas?

   svg.on("mousemove",function(){         //this attempt not working         m1 = d3.mouse(this);         var line = svg.append("line")                    .attr("y1",0)                    .attr("y2",height)                    .attr("x1", m1[0])                    .attr("x2",m1[0]);      }); 

i updated jsfiddle here http://jsfiddle.net/mygqn/5/

let's first make line adding

 svg.append("line").attr("id","rline"); 

after our declaring svg variable

then change code be

svg.on("mousemove",function(){     m1 = d3.mouse(this);     svg.selectall("#rline")                .attr("y1",0)                .attr("y2",height)                .attr("x1", m1[0])                .attr("x2",m1[0])                 .attr("stroke","red")                 .attr("stroke-width",2);  }); 

Comments

Popular posts from this blog

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -