Class: Charty::Plotters::SizeMapper

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

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.



325
326
327
# File 'lib/charty/plotters/relational_plotter.rb', line 325

def levels
  @levels
end

#lookup_tableObject (readonly)

Returns the value of attribute lookup_table.



325
326
327
# File 'lib/charty/plotters/relational_plotter.rb', line 325

def lookup_table
  @lookup_table
end

#map_typeObject (readonly)

Returns the value of attribute map_type.



325
326
327
# File 'lib/charty/plotters/relational_plotter.rb', line 325

def map_type
  @map_type
end

#normObject (readonly)

Returns the value of attribute norm.



325
326
327
# File 'lib/charty/plotters/relational_plotter.rb', line 325

def norm
  @norm
end

#orderObject (readonly)

Returns the value of attribute order.



325
326
327
# File 'lib/charty/plotters/relational_plotter.rb', line 325

def order
  @order
end

#paletteObject (readonly)

Returns the value of attribute palette.



325
326
327
# File 'lib/charty/plotters/relational_plotter.rb', line 325

def palette
  @palette
end

Instance Method Details

#lookup_single_value(key) ⇒ Object



327
328
329
330
331
332
333
334
335
336
# File 'lib/charty/plotters/relational_plotter.rb', line 327

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