mirror of
https://github.com/morrisjs/morris.js.git
synced 2024-11-10 21:36:34 +01:00
Accept DOM element in options.element (closes #11).
This commit is contained in:
parent
dc0a34dcbb
commit
0453724887
@ -8,7 +8,10 @@ class Morris.Line
|
||||
constructor: (options) ->
|
||||
if not (this instanceof Morris.Line)
|
||||
return new Morris.Line(options)
|
||||
@el = $ document.getElementById(options.element)
|
||||
if typeof options.element is 'string'
|
||||
@el = $ document.getElementById(options.element)
|
||||
else
|
||||
@el = $ options.element
|
||||
@options = $.extend {}, @defaults, options
|
||||
# bail if there's no data
|
||||
if @options.data is undefined or @options.data.length is 0
|
||||
|
@ -7,7 +7,11 @@
|
||||
|
||||
function Line(options) {
|
||||
if (!(this instanceof Morris.Line)) return new Morris.Line(options);
|
||||
this.el = $(document.getElementById(options.element));
|
||||
if (typeof options.element === 'string') {
|
||||
this.el = $(document.getElementById(options.element));
|
||||
} else {
|
||||
this.el = $(options.element);
|
||||
}
|
||||
this.options = $.extend({}, this.defaults, options);
|
||||
if (this.options.data === void 0 || this.options.data.length === 0) return;
|
||||
this.el.addClass('graph-initialised');
|
||||
|
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