How to correctly forbid a plot in the past ?

19 views
Skip to first unread message

FbTlse

unread,
Jan 11, 2016, 11:00:44 AM1/11/16
to Flot graphs
Hi all,

I am trying to draw manually a plot line and it works fine but:
My x axis is a time axis (in ms) and when i am trying to forbid a plot in the past it did not work.

What i am missing ?
If someone could help me i would be grateful to him for it.
Find hereafter my code:

 $("#plottime").text("0.0");
var newPlot =[];
var i2=0;
$("#placeholder").bind("plotclick", function (event, pos) {
var str = "(" + pos.x.toFixed(2) + ", " + pos.y.toFixed(2) + ")";
var i = pos.x.toFixed(2);
var j = pos.y.toFixed(2);
var i2= parseFloat($("#plottime").text()).toFixed(2); /*ugly!*/

//It is not allowed to set a plot in the past.
if ((i>i2)){
   
    $("#clickdata").text(" - click point in grid: x axis " + i +" :y axis : "+j );
    newPlot.push([i,j]);
    plot.setData(newPlot);
    plot.setData([{data:newPlot}]);
    plot.draw();
    $("#plottime").text(i);
}
});//end bind plotclick
Reply all
Reply to author
Forward
0 new messages