Module: Daru::Plotting::Category::GruffLibrary

Defined in:
lib/daru/plotting/gruff/category.rb

Instance Method Summary collapse

Instance Method Details

#plot(opts = {}) {|plot| ... } ⇒ Object

Yields:



5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/daru/plotting/gruff/category.rb', line 5

def plot opts={}
  type = opts[:type] || :bar
  size = opts[:size] || 500
  case type
  when :bar, :pie, :sidebar
    plot = send("category_#{type}_plot".to_sym, size, opts[:method])
  else
    raise ArgumentError, 'This type of plot is not supported.'
  end
  yield plot if block_given?
  plot
end