def domain(*arguments)
      array,min,max=arguments
      o=nil
      if (arguments.size>0)
        if array.is_a? Array 
          min = Rubyvis.identity if (arguments.size < 2)
          max = min if (arguments.size < 3)
          o = [array[0]].min if array.size>0
          @d = array.size>0 ? [Rubyvis.min(array, min), Rubyvis.max(array, max)] : []
        else 
          o = array
          @d = arguments.map {|i| i.to_f}
        end
        
        if !@d.size 
          @d = [-Infinity, Infinity];
        elsif (@d.size == 1) 
          @d = [@d.first, @d.first]
        end
        
        @n = (@d.first.to_f<0 or @d.last.to_f<0)
        @l=@d.map{|v| @f.call(v)}
        
        @type = (o.is_a? Time) ? :time : :number;
        return self
      end
      # TODO: Fix this.
      @d.map{|v| 
        case @type
        when :number
          v.to_f
        when :time
          Time.at(v)
        else 
          v
        end
      }
    end
def domain(*arguments)
      array,min,max=arguments
      o=nil
      if (arguments.size>0)
        if array.is_a? Array 
          min = Rubyvis.identity if (arguments.size < 2)
          max = min if (arguments.size < 3)
          o = [array[0]].min if array.size>0
          @d = array.size>0 ? [Rubyvis.min(array, min), Rubyvis.max(array, max)] : []
        else 
          o = array
          @d = arguments.map {|i| i.to_f}
        end
        
        if !@d.size 
          @d = [-Infinity, Infinity];
        elsif (@d.size == 1) 
          @d = [@d.first, @d.first]
        end
        
        @n = (@d.first.to_f<0 or @d.last.to_f<0)
        @l=@d.map{|v| @f.call(v)}
        
        @type = (o.is_a? Time) ? :time : :number;
        return self
      end
      # TODO: Fix this.
      @d.map{|v| 
        case @type
        when :number
          v.to_f
        when :time
          Time.at(v)
        else 
          v
        end
      }
    end
Sets or gets the input domain. This method can be invoked several ways:

 <p>1. <tt>domain(min, ..., max)</tt>

 <p>Specifying the domain as a series of numbers is the most explicit and
 recommended approach. Most commonly, two numbers are specified: the minimum
 and maximum value. However, for a diverging scale, or other subdivided
 non-uniform scales, multiple values can be specified. Values can be derived
 from data using Rubyvis.min and Rubyvis.max. For example:

   .domain(0, Rubyvis.max(array))

 An alternative method for deriving minimum and maximum values from data
 follows.

 <p>2. <tt>domain(array, minf, maxf)</tt>

 <p>When both the minimum and maximum value are derived from data, the
 arguments to the <tt>domain</tt> method can be specified as the array of
 data, followed by zero, one or two accessor functions. For example, if the
 array of data is just an array of numbers:

   .domain(array)

 On the other hand, if the array elements are objects representing stock
 values per day, and the domain should consider the stock's daily low and
 daily high:

   .domain(array, lambda {|d|  d.low}, lambda {|d| d.high})

 The first method of setting the domain is preferred because it is more
 explicit; setting the domain using this second method should be used only
 if brevity is required.

 <p>3. <tt>domain()</tt>

 <p>Invoking the <tt>domain</tt> method with no arguments returns the
 current domain as an array of numbers.