Method: Charty::Plotters::ColorMapper#lookup_single_value

Defined in:
lib/charty/plotters/relational_plotter.rb

#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