Class: Charty::Plotters::ColorMapper

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.



99
100
101
# File 'lib/charty/plotters/relational_plotter.rb', line 99

def levels
  @levels
end

#lookup_tableObject (readonly)

Returns the value of attribute lookup_table.



99
100
101
# File 'lib/charty/plotters/relational_plotter.rb', line 99

def lookup_table
  @lookup_table
end

#map_typeObject (readonly)

Returns the value of attribute map_type.



99
100
101
# File 'lib/charty/plotters/relational_plotter.rb', line 99

def map_type
  @map_type
end

#normObject (readonly)

Returns the value of attribute norm.



99
100
101
# File 'lib/charty/plotters/relational_plotter.rb', line 99

def norm
  @norm
end

#orderObject (readonly)

Returns the value of attribute order.



99
100
101
# File 'lib/charty/plotters/relational_plotter.rb', line 99

def order
  @order
end

#paletteObject (readonly)

Returns the value of attribute palette.



99
100
101
# File 'lib/charty/plotters/relational_plotter.rb', line 99

def palette
  @palette
end

Instance Method Details

#inverse_lookup_tableObject



101
102
103
# File 'lib/charty/plotters/relational_plotter.rb', line 101

def inverse_lookup_table
  lookup_table.invert
end

#lookup_single_value(key) ⇒ Object



105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
# File 'lib/charty/plotters/relational_plotter.rb', line 105

def lookup_single_value(key)
  if @lookup_table.key?(key)
    @lookup_table[key]
  elsif @norm
    # Use the colormap to interpolate between existing datapoints
    raise NotImplementedError,
          "Palette interpolation is not implemented yet"
    # begin
    #   normed = @norm.(key)
    # rescue ArgumentError, TypeError => err
    #   if key.respond_to?(:nan?) && key.nan?
    #     return "#000000"
    #   else
    #     raise err
    #   end
    # end
  end
end