Class: RETerm::Components::Histogram

Inherits:
RETerm::Component show all
Includes:
RETerm::CDKComponent
Defined in:
lib/reterm/components/histogram.rb

Overview

CDK Histogram Widget

Constant Summary

Constants included from LogHelpers

LogHelpers::LOG_FILE

Instance Attribute Summary collapse

Attributes inherited from RETerm::Component

#activatable, #activate_focus, #highlight_focus, #window

Instance Method Summary collapse

Methods included from RETerm::CDKComponent

#activatable?, #activate!, #bind_key, #cdk?, #colors=, #component, #deactivate!, #draw!, #early_exit?, #erase, #escape_hit?, #init?, #init_cdk, #normal_exit?, #strip_formatting, #title_attrib=

Methods inherited from RETerm::Component

#activatable?, #activate!, #activate_focus?, #cdk?, #colored?, #colors=, #deactivate!, #deactivate?, #distance_from, #extra_padding, #finalize!, #highlight_focus?, #reactivate!, #resize, #sync!, #sync_getch

Methods included from KeyBindings

#bind_key, #invoke_key_bindings, #key_bindings, #key_bound?

Methods included from LogHelpers

#logger

Methods included from EventDispatcher

#dispatch, #handle

Constructor Details

#initialize(args = {}) ⇒ Histogram

Initialize the Histogram component

Parameters:

  • args (Hash) (defaults to: {})

    label params

Options Hash (args):

  • :title (String)

    title of Histogram

  • :min (Integer)

    min histogram value

  • :max (Integer)

    max histogram value



27
28
29
30
31
32
# File 'lib/reterm/components/histogram.rb', line 27

def initialize(args={})
  super
  @title = args[:title] || ""
  @min   = args[:min]   || 0
  @max   = args[:max]   || 10
end

Instance Attribute Details

#valueObject

Returns the value of attribute value.



7
8
9
# File 'lib/reterm/components/histogram.rb', line 7

def value
  @value
end

Instance Method Details

#requested_colsObject



38
39
40
# File 'lib/reterm/components/histogram.rb', line 38

def requested_cols
  50
end

#requested_rowsObject



34
35
36
# File 'lib/reterm/components/histogram.rb', line 34

def requested_rows
  4
end