Sort data array when treating it
This commit is contained in:
parent
8ce80b2979
commit
d121a5bbab
12
timeline.js
12
timeline.js
@ -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') {
|
||||
|
Loading…
Reference in New Issue
Block a user