Sha256: a38e4426924c3a4972c9ca0d022a88221aa67bab5df51e5d1d21cec64411f245

Contents?: true

Size: 1.04 KB

Versions: 20

Compression:

Stored size: 1.04 KB

Contents

module Rubyvis
  def self.Scale
    Rubyvis::Scale
  end
  module Scale
    def self.quantitative(*args)
      Quantitative.new(*args)
    end
    def self.linear(*args)
      Linear.new(*args)
    end
    def self.ordinal(*args)
      Ordinal.new(*args)
    end
    def self.log(*args)
      Log.new(*args)
    end
    def self.interpolator(start,_end)
      if start.is_a? Numeric
        return lambda {|t| t*(_end-start)+start}
      end
      start=Rubyvis.color(start).rgb()
      _end = Rubyvis.color(_end).rgb()
      return lambda {|t|
        a=start.a*(1-t)+_end.a*t
        a=0 if a<1e-5
        return (start.a == 0) ? Rubyvis.rgb(_end.r, _end.g, _end.b, a) : ((_end.a == 0) ? Rubyvis.rgb(start.r, start.g, start.b, a) : Rubyvis.rgb(
        (start.r * (1 - t) + _end.r * t).round,
        (start.g * (1 - t) + _end.g * t).round,
        (start.b * (1 - t) + _end.b * t).round, a))
      }
    end
  end
end
require 'rubyvis/scale/quantitative.rb'
require 'rubyvis/scale/linear.rb'
require 'rubyvis/scale/ordinal.rb'
require 'rubyvis/scale/log.rb'

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
rubyvis-0.7.0 lib/rubyvis/scale.rb
rubyvis-0.6.1 lib/rubyvis/scale.rb
rubyvis-0.6.0 lib/rubyvis/scale.rb
rubyvis-0.5.2 lib/rubyvis/scale.rb
rubyvis-0.5.1 lib/rubyvis/scale.rb
rubyvis-0.5.0 lib/rubyvis/scale.rb
rubyvis-0.4.1 lib/rubyvis/scale.rb
rubyvis-0.4.0 lib/rubyvis/scale.rb
rubyvis-0.3.6 lib/rubyvis/scale.rb
rubyvis-0.3.5 lib/rubyvis/scale.rb
rubyvis-0.3.4 lib/rubyvis/scale.rb
rubyvis-0.3.3 lib/rubyvis/scale.rb
rubyvis-0.3.2 lib/rubyvis/scale.rb
rubyvis-0.3.1 lib/rubyvis/scale.rb
rubyvis-0.3.0 lib/rubyvis/scale.rb
rubyvis-0.2.2 lib/rubyvis/scale.rb
rubyvis-0.2.1 lib/rubyvis/scale.rb
rubyvis-0.2.0 lib/rubyvis/scale.rb
rubyvis-0.1.7 lib/rubyvis/scale.rb
rubyvis-0.1.6 lib/rubyvis/scale.rb