问题
I am using the SVG terminal in Gnuplot 4.7 and trying to have both hypertext and hyperlink work on the browser, activated by mouse hover and mouse click respectively on the plotted data points. The mouse hover works thanks to the help from stackoverflow on my previous question.
My data input file looks like this:
X Y Label Color Hyperlink
0 0 net0 2 net0.txt
1 1 net1 2 net1.txt
2 2 net2 2 net2.txt
3 4 net3_outlier 1 outlier.txt
4 4 net4 2 net4.txt
My script script.gp looks like this:
set terminal svg/canvas enhanced mousing
set palette model RGB defined (0 'blue', 1 'red', 2 'green')
plot 'test.txt' using 1:2:3:4 with labels hypertext point pt 7 ps var lc variable
Result: I am able to have the plot color the points in red and green based on the 4th column in the file and hovering hypertext labels from column3 in the file. My trial is to have the column5 in the data to be a hyperlink to file from the point in the plot. So hovering over the point, displays the hypertext and clicking it should open the hyperlink..Is this possible? I am OK with postprocessing the html file produced if necessary, just dont know what to add and where.
Testing: I am using gnuplot 4.7 and firefox 5.0
Output html file looks like this: I see some hrefs here, but couldnt figure if I can add hyperlinks to files in here. Also I preferred Canvas because of the XY table that came up showing the mouse co-ordinates.
<g id="gnuplot_plot_1" ><title>gnuplot_plot_1</title>
<g fill="none" color="black" stroke="currentColor" stroke-width="1.00" stroke-linecap="butt" stroke-linejoin="miter">
<g onmousemove="gnuplot_svg.showHypertext(evt,'net0')" onmouseout="gnuplot_svg.hideHypertext()"><title> </title>
<use xlink:href='#gpPt6' transform='translate(45.6,444.0) scale(4.50)' color='green'/></g>
<g onmousemove="gnuplot_svg.showHypertext(evt,'net1')" onmouseout="gnuplot_svg.hideHypertext()"><title> </title>
<use xlink:href='#gpPt6' transform='translate(89.7,411.5) scale(4.50)' color='green'/></g>
<g onmousemove="gnuplot_svg.showHypertext(evt,'net2')" onmouseout="gnuplot_svg.hideHypertext()"><title> </title>
<use xlink:href='#gpPt6' transform='translate(133.8,379.0) scale(4.50)' color='green'/></g>
<g onmousemove="gnuplot_svg.showHypertext(evt,'net3')" onmouseout="gnuplot_svg.hideHypertext()"><title> </title>
<use xlink:href='#gpPt6' transform='translate(178.0,346.5) scale(4.50)' color='green'/></g>
<g onmousemove="gnuplot_svg.showHypertext(evt,'net4')" onmouseout="gnuplot_svg.hideHypertext()"><title> </title>
<use xlink:href='#gpPt6' transform='translate(222.1,314.0) scale(4.50)' color='green'/></g>
<g onmousemove="gnuplot_svg.showHypertext(evt,'net5')" onmouseout="gnuplot_svg.hideHypertext()"><title> </title>
<use xlink:href='#gpPt6' transform='translate(266.2,281.5) scale(4.50)' color='green'/></g>
<g onmousemove="gnuplot_svg.showHypertext(evt,'net7')" onmouseout="gnuplot_svg.hideHypertext()"><title> </title>
<use xlink:href='#gpPt6' transform='translate(354.4,216.6) scale(4.50)' color='green'/></g>
<g onmousemove="gnuplot_svg.showHypertext(evt,'net_outlier')" onmouseout="gnuplot_svg.hideHypertext()"><title> </title>
<use xlink:href='#gpPt6' transform='translate(354.4,151.6) scale(4.50)' color='red'/></g>
<g onmousemove="gnuplot_svg.showHypertext(evt,'net8')" onmouseout="gnuplot_svg.hideHypertext()"><title> </title>
<use xlink:href='#gpPt6' transform='translate(398.5,184.1) scale(4.50)' color='green'/></g>
<g onmousemove="gnuplot_svg.showHypertext(evt,'net9')" onmouseout="gnuplot_svg.hideHypertext()"><title> </title>
<use xlink:href='#gpPt6' transform='translate(442.7,151.6) scale(4.50)' color='green'/></g>
<g onmousemove="gnuplot_svg.showHypertext(evt,'net10')" onmouseout="gnuplot_svg.hideHypertext()"><title> </title>
<use xlink:href='#gpPt6' transform='translate(486.8,119.1) scale(4.50)' color='green'/></g>
<g onmousemove="gnuplot_svg.showHypertext(evt,'net11')" onmouseout="gnuplot_svg.hideHypertext()"><title> </title>
<use xlink:href='#gpPt6' transform='translate(530.9,86.6) scale(4.50)' color='green'/></g>
</g>
</g>
Help appreciated. I am new to Gnuplot but trying on ramping up fairly quick.
来源:https://stackoverflow.com/questions/23022545/gnuplot-4-7-hyperlink-hypertext-with-svg-terminal