Class: Charty::Plotters::ColorMapper
- Inherits:
-
BaseMapper
- Object
- BaseMapper
- Charty::Plotters::ColorMapper
- Defined in:
- lib/charty/plotters/relational_plotter.rb
Instance Attribute Summary collapse
-
#levels ⇒ Object
readonly
Returns the value of attribute levels.
-
#lookup_table ⇒ Object
readonly
Returns the value of attribute lookup_table.
-
#map_type ⇒ Object
readonly
Returns the value of attribute map_type.
-
#norm ⇒ Object
readonly
Returns the value of attribute norm.
-
#palette ⇒ Object
readonly
Returns the value of attribute palette.
Attributes inherited from BaseMapper
Instance Method Summary collapse
Methods inherited from BaseMapper
Constructor Details
This class inherits a constructor from Charty::Plotters::BaseMapper
Instance Attribute Details
#levels ⇒ Object (readonly)
Returns the value of attribute levels.
193 194 195 |
# File 'lib/charty/plotters/relational_plotter.rb', line 193 def levels @levels end |
#lookup_table ⇒ Object (readonly)
Returns the value of attribute lookup_table.
193 194 195 |
# File 'lib/charty/plotters/relational_plotter.rb', line 193 def lookup_table @lookup_table end |
#map_type ⇒ Object (readonly)
Returns the value of attribute map_type.
193 194 195 |
# File 'lib/charty/plotters/relational_plotter.rb', line 193 def map_type @map_type end |
#norm ⇒ Object (readonly)
Returns the value of attribute norm.
193 194 195 |
# File 'lib/charty/plotters/relational_plotter.rb', line 193 def norm @norm end |
#palette ⇒ Object (readonly)
Returns the value of attribute palette.
193 194 195 |
# File 'lib/charty/plotters/relational_plotter.rb', line 193 def palette @palette end |
Instance Method Details
#inverse_lookup_table ⇒ Object
195 196 197 |
# File 'lib/charty/plotters/relational_plotter.rb', line 195 def inverse_lookup_table lookup_table.invert end |
#lookup_single_value(key) ⇒ Object
199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 |
# File 'lib/charty/plotters/relational_plotter.rb', line 199 def lookup_single_value(key) if @lookup_table.key?(key) @lookup_table[key] elsif @norm # Use the colormap to interpolate between existing datapoints begin normed = @norm.(key) @cmap[normed] rescue ArgumentError, TypeError => err if Util.nan?(key) return "#000000" else raise err end end end end |