Sort data array when treating it

This commit is contained in:
Phyks 2014-03-28 20:55:19 +01:00
parent 8ce80b2979
commit d121a5bbab
1 changed files with 11 additions and 1 deletions

View File

@ -161,7 +161,17 @@ SVG.scale = function(data) {
}
SVG.addPoints = function (data) {
// TODO : Sort x croissants
data.sort(function (a, b) {
if(a.x < b.x) {
return -1;
}
else if(a.x == b.x) {
return 0;
}
else {
return 1;
}
});
for(point = 0; point < data.length; point++) {
SVG.raw_points.push([data[point].x, data[point].y]);
if(data[point].label !== 'undefined') {