Sha256: b87c44e33f4a3594c85210e100dc64433e3032d13178093c345ccbbfd29c861f

Contents?: true

Size: 853 Bytes

Versions: 4

Compression:

Stored size: 853 Bytes

Contents

class window.StaticLine
  constructor: (@yvalue, @legend, @yaxis = 1, @formatter = Format.identity) ->
    @enabled = true
    @data = []
    @static = true
    @color = 'black'
  
  set_data: (data) ->
    @data = []
    
    $.each data, (t, v) =>
      @data.push( [Time.server_to_client(t), v] )
    
  get_data: ->
    @data
  
  format: (v) ->
    @formatter(v)
  
  set_legend_color: (element) ->
    tr = $(element).parent()
    tr.toggleClass('transparent', not @enabled)
  
  set_enabled: (new_state) ->
    @enabled = new_state
  
  toggle_enabled: () ->
    this.set_enabled(not @enabled)
  
  get_definition: (from, to) ->
    @data = [
        [Time.server_to_client(from), @yvalue],
        [Time.server_to_client(to), @yvalue]
      ]
    
    {
      data: @data,
      label: @legend,
      yaxis: @yaxis,
      color: @color
    }


Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rrd-grapher-1.0.3 lib/rrd-grapher/assets/javascripts/classes/static_line.coffee
rrd-grapher-1.0.2 lib/rrd-grapher/assets/javascripts/classes/static_line.coffee
rrd-grapher-1.0.1 lib/rrd-grapher/assets/javascripts/classes/static_line.coffee
rrd-grapher-1.0.0 lib/rrd-grapher/assets/javascripts/classes/static_line.coffee