# File lib/gruff/line.rb, line 123
  def dataxy(name, x_data_points=[], y_data_points=[], color=nil)
    raise ArgumentError, 'x_data_points is nil!' if x_data_points.length == 0

    if x_data_points.all? { |p| p.is_a?(Array) && p.size == 2 }
      x_data_points, y_data_points = x_data_points.map { |p| p[0] }, x_data_points.map { |p| p[1] }
    end

    raise ArgumentError, 'x_data_points.length != y_data_points.length!' if x_data_points.length != y_data_points.length

    # call the existing data routine for the y data.
    self.data(name, y_data_points, color)

    x_data_points = Array(x_data_points) # make sure it's an array
    # append the x data to the last entry that was just added in the @data member
    @data.last[DATA_VALUES_X_INDEX] = x_data_points

    # Update the global min/max values for the x data
    x_data_points.each do |x_data_point|
      next if x_data_point.nil?

      # Setup max/min so spread starts at the low end of the data points
      if @maximum_x_value.nil? && @minimum_x_value.nil?
        @maximum_x_value = @minimum_x_value = x_data_point
      end

      @maximum_x_value = (x_data_point > @maximum_x_value) ?
          x_data_point : @maximum_x_value
      @minimum_x_value = (x_data_point < @minimum_x_value) ?
          x_data_point : @minimum_x_value
    end

  end