(function() { var bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }, extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, hasProp = {}.hasOwnProperty; if (ELA.Views == null) { ELA.Views = {}; } ELA.Views.ChartView = (function(superClass) { extend(ChartView, superClass); function ChartView() { this.render = bind(this.render, this); return ChartView.__super__.constructor.apply(this, arguments); } ChartView.prototype.className = 'view chart-view'; ChartView.prototype.initialize = function(options) { var ref, ref1, ref2; if (options == null) { options = {}; } if (options.name == null) { throw 'ELA.Views.GraphView: option `name` is required'; } if ((ref = options.chart) != null ? ref.view : void 0) { this.ChartView = options.chart.view.toFunction(); } else { this.ChartView = ELA.Views.ChartJS; } this.displayParams = this.model.displayParams[options.name] = new this.ChartView.Params; this.chartConfig = $.extend(true, {}, (ref1 = options.chart) != null ? ref1.config : void 0); this.chartDataFunction = ((ref2 = options.chart) != null ? ref2.dataFunction : void 0) || 'data'; return this.subviews = {}; }; ChartView.prototype.render = function() { var $chart, base, view; $chart = $('
', { "class": 'chart' }); view = (base = this.subviews).chart != null ? base.chart : base.chart = new this.ChartView({ model: this.model, parentView: this, localePrefix: this.localePrefix, params: this.displayParams, dataFunction: this.chartDataFunction, config: this.chartConfig }); $chart.html(view.render().el); this.$el.html($chart); return this; }; return ChartView; })(ELA.Views.ViewportView); }).call(this);