little_graphs 1.0.2 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- little_graphs (1.0.1)
4
+ little_graphs (1.0.2)
5
5
  quick_magick
6
6
 
7
7
  GEM
data/README.mkd CHANGED
@@ -5,6 +5,7 @@
5
5
  ```ruby
6
6
  require 'little_graphs'
7
7
  graph = LittleGraphs.new()
8
+ graph.draw([1, 2, 4, 5, 4]) # returns a blob
8
9
  graph.draw([12, 3, 0, 9, 10, 8, 2, 4, 1], "example.jpeg")
9
10
  ```
10
11
  ![example graph](https://raw.github.com/absperf/little_graphs/master/example.jpeg)
data/lib/little_graphs.rb CHANGED
@@ -38,10 +38,13 @@ class LittleGraphs
38
38
  end
39
39
 
40
40
  def translate_datapoints(datapoints)
41
- height = @height - 5 # add a margin
42
- point_space = height/(datapoints.max - datapoints.min)
41
+ height = @height # add a margin
42
+ point_space = height/(datapoints.max - datapoints.min + 1)
43
43
 
44
- datapoints.map { |datapoint| @height - datapoint * point_space - datapoints.min * point_space }
44
+ datapoints.map do |datapoint|
45
+ puts @height
46
+ @height - (datapoint - datapoints.min) * point_space
47
+ end
45
48
  end
46
49
 
47
50
  end
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'little_graphs'
3
- s.version = '1.0.2'
3
+ s.version = '1.0.3'
4
4
  s.date = '2012-10-15'
5
5
  s.summary = 'Sparklines'
6
6
  s.authors = ['J. Cheng']
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: little_graphs
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: