Class: Palindromes::Chart

Inherits:
Object
  • Object
show all
Defined in:
lib/palindromes/chart.rb

Class Method Summary collapse

Class Method Details

.generate(data, chart_file) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/palindromes/chart.rb', line 6

def generate(data, chart_file)
  g = Gruff::Bar.new
  g.title = "histogram"

  c = 0
  data.each do |key, value|
    g.labels.merge( c => key )
    g.data(key, [value])
    c += 1
  end

  g.minimum_value = 0
  g.write(chart_file)
end