HumbleSoftware / Flotr2

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

Wrong sort by in spreadsheet plugin #316

Open NisSAM opened 8 years ago

NisSAM commented 8 years ago

If x point value is a number but not an integer _.sortBy will be at least unstable and in worst case wrong. To keep compatibility as much as we can I propose to change from

    this.seriesData = _.sortBy(rows, function(row, x){
      return parseInt(x, 10);
    });

to

    this.seriesData = _.sortBy(rows, function(row, x){
      return (typeof row[0] === 'number') ? row[0] : parseInt(row[0], 10);
    });