I have been working for a while on a web interface related to my work. I have some data that I fit with a model iteratively. In every iteration I create a Gnuplot figure that goes online to help me keep track of the process. It works very well, however, I have some minor problems related to the canvas terminal that I couldn't fix for a long time. I use Gnuplot 4.6.5 and several browsers. They all behave consistently.
Here is an example of such a page, with two figures: http://stelweb.asu.cas.cz/~nemeth/xtgrid_log/xtgrid_008_r1458384bfCsdd_dat.html
I have a struggle with the x-axis tics and resolution, and I think these problems may be related:
1 - x-axis coordinate below the figure does not show decimals. I think the x coordinate is truncated by Gnuplot.
2 - Axis tics disappear when we zoom in.
3 - I have some labels defined with: "set label at x,screen 0.2 '...some label...' " These labels disappear when zooming in, even though they are set to the screen y coordinate (0.2).
4 - Zoom resets in figure 1 when mouse is moved over to figure 2 and back to 1 again. This might be a html/java issue.
A Gnuplot script to generate these figures looks like this:
set encoding iso_8859_1
set terminal canvas solid butt size 1024,410 name figure1 mousing lw 0.7
set output "figure1.js"
set samples 50, 50
set size ratio 0.4
set xtics autofreq 200
set mxtics 4
set xr [4000:5000]
set ylab "Relative flux"
set xlab "Wavelength (\305)"
set format y "%1.1e"
load 'lines.gnp' # just a bunch of labels
plot " ... some file ... "
I wonder if there is a general fix to these inconveniences.
To problem #4: The Gnuplot generated javascript starts like this:
function ALue310128bfCsdd_dat_7_0()
{
canvas = document.getElementById("ALue310128bfCsdd_dat_7_0");
ctx = canvas.getContext("2d");
// Reinitialize mouse tracking and zoom for this particular plot
if ((typeof(gnuplot.active_plot) == "undefined" || gnuplot.active_plot != ALue310128bfCsdd_dat_7_0) && typeof(gnuplot.mouse_update) != "undefined")
{
gnuplot.active_plot_name = "ALue310128bfCsdd_dat_7_0";
gnuplot.active_plot = ALue310128bfCsdd_dat_7_0;
canvas.onmousemove = gnuplot.mouse_update;
canvas.onmouseup = gnuplot.zoom_in;
canvas.onmousedown = gnuplot.saveclick;
canvas.onkeypress = gnuplot.do_hotkey;
if (canvas.attachEvent) {canvas.attachEvent('mouseover', ALue310128bfCsdd_dat_7_0);
}
else if (canvas.addEventListener)
{canvas.addEventListener('mouseover', ALue310128bfCsdd_dat_7_0, false);}
gnuplot.zoomed = false;
gnuplot.zoom_axis_width = 0;
gnuplot.zoom_in_progress = false;
gnuplot.polar_mode = false;
ctx.clearRect(0,0,1280,513);
}
The gnuplot.zoomed
and gnuplot.zoom_in_progress
variables seem like they have something to do with the reinitialization of the zoom level.