Class: Charty::Plotters::SizeMapper

Inherits:
BaseMapper show all
Defined in:
lib/charty/plotters/relational_plotter.rb

Defined Under Namespace

Classes: SimpleNormalizer

Instance Attribute Summary collapse

Attributes inherited from BaseMapper

#plotter

Instance Method Summary collapse

Methods inherited from BaseMapper

#[], #initialize

Constructor Details

This class inherits a constructor from Charty::Plotters::BaseMapper

Instance Attribute Details

#levelsObject (readonly)

Returns the value of attribute levels.



252
253
254
# File 'lib/charty/plotters/relational_plotter.rb', line 252

def levels
  @levels
end

#normObject (readonly)

Returns the value of attribute norm.



252
253
254
# File 'lib/charty/plotters/relational_plotter.rb', line 252

def norm
  @norm
end

#orderObject (readonly)

Returns the value of attribute order.



252
253
254
# File 'lib/charty/plotters/relational_plotter.rb', line 252

def order
  @order
end

#paletteObject (readonly)

Returns the value of attribute palette.



252
253
254
# File 'lib/charty/plotters/relational_plotter.rb', line 252

def palette
  @palette
end

Instance Method Details

#lookup_single_value(key) ⇒ Object



254
255
256
257
258
259
260
261
262
263
# File 'lib/charty/plotters/relational_plotter.rb', line 254

def lookup_single_value(key)
  if @lookup_table.key?(key)
    @lookup_table[key]
  else
    normed = @norm.(key) || Float::NAN
    size_values = @lookup_table.values
    min, max = size_values.min, size_values.max
    min + normed * (max - min)
  end
end