(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.ChartJS = (function(superClass) { extend(ChartJS, superClass); function ChartJS() { this.render = bind(this.render, this); return ChartJS.__super__.constructor.apply(this, arguments); } ChartJS.Params = (function(superClass1) { extend(Params, superClass1); function Params() { return Params.__super__.constructor.apply(this, arguments); } return Params; })(Backbone.Model); ChartJS.prototype.tagName = 'canvas'; ChartJS.prototype.initialize = function(options) { var ref; if (options == null) { options = {}; } this.chartConfig = $.extend(true, {}, options.config); if (((ref = this.chartConfig.options) != null ? ref.title : void 0) != null) { $.extend(this.chartConfig.options.title, { fontFamily: 'Roboto', fontStyle: '500' }); } $.extend(this.chartConfig.options, { maintainAspectRatio: false }); this.dataFunction = options.dataFunction; this.params = options.params; return this.listenTo(this.model.get('calculators')[0], "change:" + this.dataFunction, this.render); }; ChartJS.prototype.render = function() { var options; if (this.chart) { this.chart.data = this.model.get('calculators')[0][this.dataFunction](); this.chart.update({ duration: 0 }); } else { options = $.extend(true, {}, this.chartConfig); options.data = this.model.get('calculators')[0][this.dataFunction](); this.chart = new Chart(this.el.getContext('2d'), options); } return this; }; return ChartJS; })(Backbone.Poised.View); }).call(this);