HumbleSoftware / Flotr2

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

Wrong sort by in spreadsheet plugin #316

Open NisSAM opened 7 years ago

NisSAM commented 7 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);
    });