First, run the following gnuplot plotting script.
set term svg mouse jsdir "./js" set output "sincos.svg" plot sin(x) w l lc rgb"#ff0000", cos(x) w l lc rgb"#00ff00" set output
And a file called "sincos.svg" is plotted. As we specified in the script that the javascript file is in directory "./js", "gnuplot-dir/share/js" have to be copied to the current directory (windows operating system, and if you use linux maybe the directory should be /usr/local/share/gnuplot/gnuplot-version/js). This time open the file, and you can find when you click the graph, the coordinate of the current point will be displayed. And when you click the legend, the cooresponding line will be invisible, and click it again, the line will visible.
The jsdir can also be a url location. And this is is usually appropriate if you are embedding the svg into a web page. For example, command --- set term svg mouse jsdir "http://gnuplot.sourceforge.net/demo_svg_4.6/" can be used.
set term svg mouse jsdir "http://gnuplot.sourceforge.net/demo_svg_4.6/" set output "sincos.svg" plot sin(x) w l lc rgb"#ff0000", cos(x) w l lc rgb"#00ff00" set output