mirror of
https://github.com/morrisjs/morris.js.git
synced 2024-11-10 21:36:34 +01:00
Merge pull request #314 from abrinkman/master
Adds the ability to mark events on a non-time-based line and area charts.
This commit is contained in:
commit
3cba9e5769
@ -186,8 +186,11 @@ class Morris.Grid extends Morris.EventEmitter
|
||||
@xmax = @data[@data.length - 1].x
|
||||
|
||||
@events = []
|
||||
if @options.parseTime and @options.events.length > 0
|
||||
@events = (Morris.parseDate(e) for e in @options.events)
|
||||
if @options.events.length > 0
|
||||
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))
|
||||
@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.xmax = this.data[this.data.length - 1].x;
|
||||
this.events = [];
|
||||
if (this.options.parseTime && this.options.events.length > 0) {
|
||||
this.events = (function() {
|
||||
var _i, _len, _ref, _results;
|
||||
_ref = this.options.events;
|
||||
_results = [];
|
||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||
e = _ref[_i];
|
||||
_results.push(Morris.parseDate(e));
|
||||
}
|
||||
return _results;
|
||||
}).call(this);
|
||||
if (this.options.events.length > 0) {
|
||||
if (this.options.parseTime) {
|
||||
this.events = (function() {
|
||||
var _i, _len, _ref, _results;
|
||||
_ref = this.options.events;
|
||||
_results = [];
|
||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||
e = _ref[_i];
|
||||
_results.push(Morris.parseDate(e));
|
||||
}
|
||||
return _results;
|
||||
}).call(this);
|
||||
} else {
|
||||
this.events = this.options.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));
|
||||
}
|
||||
|
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