HumbleSoftware / Flotr2

Graphs and Charts for Canvas in JavaScript.
http://www.humblesoftware.com/flotr2/
MIT License
2.44k stars 526 forks source link

Flotr2 mouse track does not work correctly with time points #301

Open kpeng94 opened 9 years ago

kpeng94 commented 9 years ago

It seems that Flotr2 mouse tracking does not work with time points. I copy and pasted this into the examples page, located at http://www.humblesoftware.com/flotr2 . The mouse is only able to track points on one of the graphs, but it should be able to track points on both graphs.

(function basic(container) {

  var datas = [
         [[new Date("Thu Jan 01 1903 00:00:00 GMT-0500 (EST)").getTime(), 0.537],
          [new Date("Fri Jan 01 1904 00:00:00 GMT-0500 (EST)").getTime(), 0.609],
          [new Date("Sun Jan 01 1905 00:00:00 GMT-0500 (EST)").getTime(), 0.477],
          [new Date("Mon Jan 01 1906 00:00:00 GMT-0500 (EST)").getTime(), 0.596],
          [new Date("Tue Jan 01 1907 00:00:00 GMT-0500 (EST)").getTime(), 0.473],
          [new Date("Wed Jan 01 1908 00:00:00 GMT-0500 (EST)").getTime(), 0.331]],
         [[new Date('Thu Jan 01 1903 00:00:00 GMT-0500 (EST)').getTime(), 0.659],
          [new Date('Fri Jan 01 1904 00:00:00 GMT-0500 (EST)').getTime(), 0.617],
          [new Date('Sun Jan 01 1905 00:00:00 GMT-0500 (EST)').getTime(), 0.513],
          [new Date('Mon Jan 01 1906 00:00:00 GMT-0500 (EST)').getTime(), 0.318],
          [new Date('Tue Jan 01 1907 00:00:00 GMT-0500 (EST)').getTime(), 0.396],
          [new Date('Wed Jan 01 1908 00:00:00 GMT-0500 (EST)').getTime(), 0.487]]
              ];
  var i, graph;

  // Generate first data set

  // Draw Graph
  graph = Flotr.draw(container, datas, {
    xaxis: {
      mode: "time",
      minorTickFreq: 4
    }, 
    grid: {
      minorVerticalLines: true
    },
    mouse : {
      track : true
    } // this seems to produce a problem
  });
})(document.getElementById("editor-render-0"));