Sha256: 245790640a07d07f0f575a661a9099ab8aefb2533881476b6cedf22c8867b5e7
Contents?: true
Size: 1.09 KB
Versions: 5
Compression:
Stored size: 1.09 KB
Contents
class WidgetPresenter constructor: (@pageInfos, @model, @el) -> @chartEl = @el.find('#chart')[0] @legendEl = @el.find('#legend')[0] @chart = new Dygraph.GVizChart(@chartEl) @draw() get: (arg) -> @model.get(arg) globalOptions: -> gon.options dateOffset: -> if @globalOptions.useUtc (new Date).getTimezoneOffset() * 60000 else 0 options: -> { labelsDiv: @legendEl labelsSeparateLines: false rightGap: 30 highlightCircleSize: 2 highlightSeriesOpts: strokeWidth: 2 strokeBorderWidth: 1 highlightCircleSize: 5 } mergedOptions: -> pageOptions = if @pageInfos.selected() @pageInfos.selected().get('dygraphsOptions') else {} $.extend(true, @options(), @globalOptions().dygraphsOptions, pageOptions, @get('dygraphsOptions') ) data: -> new google.visualization.DataTable draw: -> @chart.draw @data(), @mergedOptions() WidgetPresenter.create = (pageInfos, model, el) -> type = model.get('type') if type? && type.match(/^\w+$/) presenterClass = eval("#{type.capitalize()}Presenter") new presenterClass(pageInfos, model, el) else null
Version data entries
5 entries across 5 versions & 1 rubygems