mirror of
https://github.com/morrisjs/morris.js.git
synced 2024-09-21 10:41: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
|
||||||
@events = (Morris.parseDate(e) for e in @options.events)
|
if @options.parseTime
|
||||||
|
@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))
|
||||||
|
|
||||||
|
26
morris.js
26
morris.js
@ -267,17 +267,21 @@
|
|||||||
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) {
|
||||||
this.events = (function() {
|
if (this.options.parseTime) {
|
||||||
var _i, _len, _ref, _results;
|
this.events = (function() {
|
||||||
_ref = this.options.events;
|
var _i, _len, _ref, _results;
|
||||||
_results = [];
|
_ref = this.options.events;
|
||||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
_results = [];
|
||||||
e = _ref[_i];
|
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||||
_results.push(Morris.parseDate(e));
|
e = _ref[_i];
|
||||||
}
|
_results.push(Morris.parseDate(e));
|
||||||
return _results;
|
}
|
||||||
}).call(this);
|
return _results;
|
||||||
|
}).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