(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.GraphView = (function(superClass) { extend(GraphView, superClass); function GraphView() { this.render = bind(this.render, this); return GraphView.__super__.constructor.apply(this, arguments); } GraphView.prototype.initialize = function(options) { var axis, props, ref, ref1, ref2, ref3, ref4, ref5, ref6, ref7; if (options == null) { options = {}; } if (options.name == null) { throw 'ELA.Views.GraphView: option `name` is required'; } if ((ref = options.graph) != null ? ref.view : void 0) { this.GraphView = options.graph.view.toFunction(); } else { this.GraphView = ELA.Views.InterpolatedGraph; } this.displayParams = this.model.displayParams[options.name] = new this.GraphView.Params; if (options.legend !== false) { if (_.isObject(options.legend) && (options.legend.view != null)) { this.LegendView = options.legend.view.toFunction(); this.legendValueAttribute = options.legend.valueAttribute; } else { this.LegendView = ELA.Views.Legend; } if (this.legendValueAttribute == null) { this.legendValueAttribute = (ref1 = options.graph) != null ? (ref2 = ref1.axes) != null ? (ref3 = ref2.x) != null ? ref3.attribute : void 0 : void 0 : void 0; } } if (((ref4 = options.graphOverlay) != null ? ref4.view : void 0) != null) { this.GraphOverlayView = options.graphOverlay.view.toFunction(); } ref6 = (ref5 = options.graph) != null ? ref5.axes : void 0; for (axis in ref6) { props = ref6[axis]; if (props.handler) { ({ attribute: props.attribute, position: (function() { switch (axis) { case 'x': return this.bottomAxisHandler = { attribute: props.attribute }; case 'y': return this.leftAxisHandler = { attribute: props.attribute }; } }).call(this) }); } } if (((ref7 = options.graph) != null ? ref7.curves : void 0) != null) { this.curves = options.graph.curves.slice(); this.axisLabelingForCurve = this.model.curves.find((function(_this) { return function(curve) { return curve.get('function') === _this.curves[0]; }; })(this)); } else { this.axisLabelingForCurve = this.model.curves.first(); } return this.subviews = {}; }; GraphView.prototype.render = function() { var $horizontalWrapper, base, base1, base2, base3, view; this.$el.empty(); if (this.LegendView != null) { view = (base = this.subviews).legend != null ? base.legend : base.legend = new this.LegendView({ model: this.model, parentView: this, localePrefix: this.localePrefix, valueAttribute: this.legendValueAttribute, curves: this.curves, displayParams: this.displayParams }); this.$el.append(view.render().el); } if (this.GraphOverlayView != null) { view = (base1 = this.subviews).graphOverlay != null ? base1.graphOverlay : base1.graphOverlay = new this.GraphOverlayView({ model: this.model, parentView: this, localePrefix: this.localePrefix }); this.$el.append(view.render().el); } $horizontalWrapper = $('