Gnuplot 4.7超链接&具有SVG终端的超文本

时间:2014-04-11 21:04:01

标签: canvas svg hyperlink gnuplot mouseover

我正在使用Gnuplot 4.7中的SVG终端并尝试在浏览器上同时使用超文本和超链接,通过鼠标悬停和鼠标点击分别在绘制的数据点上激活。鼠标悬停工作得益于我之前提问的stackoverflow的帮助。

我的数据输入文件如下所示:

X Y标签颜色超链接

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

我的脚本script.gp如下所示:

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

结果: 我可以根据文件中的第4列以及文件中第3列的悬停超文本标签,使用红色和绿色点绘制颜色。我的试验是让数据中的column5成为从图中点开始的文件的超链接。所以将鼠标悬停在该点上,显示超文本并单击它应打开超链接。这可能吗?如果有必要,我可以对后处理生成的html文件进行后处理,只是不知道要添加什么以及在哪里。

测试: 我正在使用gnuplot 4.7和firefox 5.0

输出html文件如下所示: 我在这里看到一些hrefs,但无法确定我是否可以在这里添加文件的超链接。此外,我更喜欢Canvas,因为XY桌子显示出鼠标坐标。

<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>

帮助表示感谢。我是Gnuplot的新手,但试图加快速度。

0 个答案:

没有答案