mirror of
https://github.com/morrisjs/morris.js.git
synced 2024-09-21 18:51:32 +02:00
Adds the ability to mark events on a non-time-based line graph
This commit is contained in:
parent
a738317adb
commit
b162e18cce
@ -186,8 +186,11 @@ class Morris.Grid extends Morris.EventEmitter
|
|||||||
@xmax = @data[@data.length - 1].x
|
@xmax = @data[@data.length - 1].x
|
||||||
|
|
||||||
@events = []
|
@events = []
|
||||||
if @options.parseTime and @options.events.length > 0
|
if @options.events.length > 0
|
||||||
|
if @options.parseTime
|
||||||
@events = (Morris.parseDate(e) for e in @options.events)
|
@events = (Morris.parseDate(e) for e in @options.events)
|
||||||
|
else
|
||||||
|
@events = @options.events
|
||||||
@xmax = Math.max(@xmax, Math.max.apply(null, @events))
|
@xmax = Math.max(@xmax, Math.max.apply(null, @events))
|
||||||
@xmin = Math.min(@xmin, Math.min.apply(null, @events))
|
@xmin = Math.min(@xmin, Math.min.apply(null, @events))
|
||||||
|
|
||||||
|
@ -267,7 +267,8 @@
|
|||||||
this.xmin = this.data[0].x;
|
this.xmin = this.data[0].x;
|
||||||
this.xmax = this.data[this.data.length - 1].x;
|
this.xmax = this.data[this.data.length - 1].x;
|
||||||
this.events = [];
|
this.events = [];
|
||||||
if (this.options.parseTime && this.options.events.length > 0) {
|
if (this.options.events.length > 0) {
|
||||||
|
if (this.options.parseTime) {
|
||||||
this.events = (function() {
|
this.events = (function() {
|
||||||
var _i, _len, _ref, _results;
|
var _i, _len, _ref, _results;
|
||||||
_ref = this.options.events;
|
_ref = this.options.events;
|
||||||
@ -278,6 +279,9 @@
|
|||||||
}
|
}
|
||||||
return _results;
|
return _results;
|
||||||
}).call(this);
|
}).call(this);
|
||||||
|
} else {
|
||||||
|
this.events = this.options.events;
|
||||||
|
}
|
||||||
this.xmax = Math.max(this.xmax, Math.max.apply(null, this.events));
|
this.xmax = Math.max(this.xmax, Math.max.apply(null, this.events));
|
||||||
this.xmin = Math.min(this.xmin, Math.min.apply(null, this.events));
|
this.xmin = Math.min(this.xmin, Math.min.apply(null, this.events));
|
||||||
}
|
}
|
||||||
|
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