mirror of
https://github.com/morrisjs/morris.js.git
synced 2024-11-10 21:36:34 +01:00
Don't sort data when parseTime is false. Fixes #83.
This commit is contained in:
parent
2903d086c6
commit
7775332aeb
@ -96,7 +96,11 @@ class Morris.Line
|
||||
setData: (data, redraw = true) ->
|
||||
# shallow copy & sort data
|
||||
@options.data = data.slice(0)
|
||||
@options.data.sort (a, b) => (a[@options.xkey] < b[@options.xkey]) - (b[@options.xkey] < a[@options.xkey])
|
||||
if @options.parseTime
|
||||
@options.data.sort (a, b) =>
|
||||
(a[@options.xkey] < b[@options.xkey]) - (b[@options.xkey] < a[@options.xkey])
|
||||
else
|
||||
@options.data.reverse()
|
||||
# extract labels
|
||||
@columnLabels = $.map @options.data, (d) => d[@options.xkey]
|
||||
|
||||
|
10
morris.js
10
morris.js
@ -392,9 +392,13 @@
|
||||
redraw = true;
|
||||
}
|
||||
this.options.data = data.slice(0);
|
||||
this.options.data.sort(function(a, b) {
|
||||
return (a[_this.options.xkey] < b[_this.options.xkey]) - (b[_this.options.xkey] < a[_this.options.xkey]);
|
||||
});
|
||||
if (this.options.parseTime) {
|
||||
this.options.data.sort(function(a, b) {
|
||||
return (a[_this.options.xkey] < b[_this.options.xkey]) - (b[_this.options.xkey] < a[_this.options.xkey]);
|
||||
});
|
||||
} else {
|
||||
this.options.data.reverse();
|
||||
}
|
||||
this.columnLabels = $.map(this.options.data, function(d) {
|
||||
return d[_this.options.xkey];
|
||||
});
|
||||
|
2
morris.min.js
vendored
2
morris.min.js
vendored
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user