prawn-graph 0.9.0 → 0.9.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7f559509a2d42727ad3f43c832bdf0d1ffb4ae75
4
- data.tar.gz: 36890cc039e4a960e951556c919a2419e623ecc9
3
+ metadata.gz: 4d0a4c3175c0641db328c6713e13f86db27d04a2
4
+ data.tar.gz: 0604788d0fdfcba265040cc8f82cc2061fc3e86b
5
5
  SHA512:
6
- metadata.gz: 20d72a8d89a71c0cb37f2cff77c465144816e9ce8ce3cd65c7b5ec6c534b3838ee14fc022ce339a0dc7083f6621f0f25ebcc104012988dbbf5b65f13a2ae0a7e
7
- data.tar.gz: 684e3032cdddde58412e9037ed5d28f0f33f8dbdbfd75222b2f4c4bb3d68450b005aecf89b2cb9b34f64fe4d6a0a385e1d0e17b001b62aa3b229e56a3922b271
6
+ metadata.gz: 0b22c30fc8ec27404d3cf5482ac90e8b23204929eadf7982014be9993ad0197cb77c04808ef99dd47a55bcfb2cc7ab9bed314343d7c8022cebbb6b8d011b3bd0
7
+ data.tar.gz: f4b3bae5bdc387dc4ce5e93871b924313a1f16c1ed630e42a2d1d0c489a2037b0f07ef8f3cbead3def6de31e9336dc5a288cb12f8e311a9f1eb7718f1ceff0b1
data/README.md CHANGED
@@ -52,7 +52,7 @@ ability to change the colors used to render the graph.
52
52
  To use prawn-graph, you can add the following to your `Gemfile`:
53
53
 
54
54
  ```Gemfile
55
- gem 'prawn-graph', '0.9.0'
55
+ gem 'prawn-graph', ' ~> 0.9'
56
56
  ```
57
57
 
58
58
  Alternatively, you can use Rubygems directly: `gem install prawn-graph`.
@@ -104,16 +104,19 @@ Option | Data type | Description
104
104
  require 'prawn-graph'
105
105
 
106
106
  series = []
107
- series << Prawn::Graph::Series.new([5,4,3,2,1,1,2,8,7,5,4,9,2], title: "Some more numbers", type: :bar)
108
- series << Prawn::Graph::Series.new([5,4,3,2,1,1,2,8,7,5,4,9,2].reverse, title: "Some more numbers", type: :bar)
109
- series << Prawn::Graph::Series.new([1,2,3,4,5,9,6,4,5,6,3,2,9], title: "Some numbers", type: :bar)
110
- series << Prawn::Graph::Series.new([1,2,3,4,5,9,6,4,5,6,3,2,9].shuffle, title: "Some numbers", type: :line)
107
+ series << Prawn::Graph::Series.new([5,4,3,2,1,1,2,8,7,5,4,9,2], title: "A label for a series", type: :bar)
108
+ series << Prawn::Graph::Series.new([5,4,3,2,1,1,2,8,7,5,4,9,2].reverse, title: "Another label", type: :bar)
109
+ series << Prawn::Graph::Series.new([1,2,3,4,5,9,6,4,5,6,3,2,9], title: "Yet another label", type: :bar)
110
+ series << Prawn::Graph::Series.new([1,2,3,4,5,9,6,4,5,6,3,2,9].shuffle, title: "One final label", type: :line)
111
111
 
112
112
  Prawn::Document.generate('test.pdf') do
113
- graph series, width: 500, height: 200, title: "A very long title will porbably be clipped", at: [10,700]
113
+ graph series, width: 500, height: 200, title: "A Title for the chart", at: [10,700]
114
114
  end
115
115
  ```
116
116
 
117
+ ### Output
118
+ <img src="http://prawn-graph.ryanstenhouse.jp/img/prawn-graph-output.png" alt="Prawn Graph Example Output" width="933" height="420">
119
+
117
120
  ## Development
118
121
 
119
122
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can
@@ -123,7 +123,6 @@ module Prawn
123
123
  num_points = @series[0].size
124
124
  width_per_point = (@plot_area_width / num_points).round(2).to_f
125
125
  width = ((width_per_point * BigDecimal('0.9')) / @series.size).round(2).to_f
126
- spacing = (width_per_point - (width * @series.size).to_f / 2.0)
127
126
 
128
127
  num_points.times do |point|
129
128
 
@@ -160,7 +159,7 @@ module Prawn
160
159
  # the series.
161
160
  #
162
161
  def point_height_percentage(value)
163
- ((BigDecimal(value, 10)/BigDecimal(@series[0].max, 10)) * BigDecimal(1)).round(2)
162
+ ((BigDecimal(value, 10)/BigDecimal(@series.collect(&:max).max, 10)) * BigDecimal(1)).round(2)
164
163
  end
165
164
 
166
165
  def prawn
@@ -1,5 +1,5 @@
1
1
  module Prawn
2
2
  module Graph
3
- VERSION = "0.9.0"
3
+ VERSION = "0.9.1"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: prawn-graph
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0
4
+ version: 0.9.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Stenhouse