prawn-graph 0.0.4 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (56) hide show
  1. checksums.yaml +7 -0
  2. data/.codeclimate.yml +16 -0
  3. data/.gitignore +9 -0
  4. data/.rspec +2 -0
  5. data/.rubocop.yml +1168 -0
  6. data/.travis.yml +17 -0
  7. data/CODE_OF_CONDUCT.md +49 -0
  8. data/CONTRIBUTORS.md +6 -0
  9. data/Gemfile +4 -0
  10. data/LICENSE.txt +21 -0
  11. data/README.md +142 -0
  12. data/Rakefile +7 -43
  13. data/bin/console +14 -0
  14. data/bin/setup +8 -0
  15. data/lib/prawn-graph.rb +16 -0
  16. data/lib/prawn/graph/calculations.rb +1 -0
  17. data/lib/prawn/graph/calculations/layout_calculator.rb +108 -0
  18. data/lib/prawn/graph/chart_components.rb +2 -0
  19. data/lib/prawn/graph/chart_components/canvas.rb +138 -0
  20. data/lib/prawn/graph/chart_components/series_renderer.rb +173 -0
  21. data/lib/prawn/graph/charts.rb +4 -0
  22. data/lib/prawn/graph/charts/bar.rb +18 -0
  23. data/lib/prawn/graph/charts/base.rb +69 -0
  24. data/lib/prawn/graph/charts/legacy.rb +4 -0
  25. data/lib/prawn/graph/charts/legacy/bar.rb +28 -0
  26. data/lib/prawn/graph/charts/legacy/base.rb +193 -0
  27. data/lib/prawn/graph/charts/legacy/grid.rb +51 -0
  28. data/lib/prawn/graph/charts/legacy/line.rb +39 -0
  29. data/lib/prawn/graph/charts/line.rb +18 -0
  30. data/lib/prawn/graph/extension.rb +59 -0
  31. data/lib/prawn/graph/series.rb +79 -0
  32. data/lib/prawn/graph/theme.rb +41 -0
  33. data/lib/prawn/graph/version.rb +5 -0
  34. data/prawn-graph.gemspec +42 -0
  35. metadata +156 -80
  36. data/README.markdown +0 -64
  37. data/examples/example_helper.rb +0 -10
  38. data/examples/graph/advanced_bar_chart.rb +0 -22
  39. data/examples/graph/bar_chart.pdf +0 -185
  40. data/examples/graph/bar_chart.rb +0 -18
  41. data/examples/graph/line_chart.pdf +0 -219
  42. data/examples/graph/line_chart.rb +0 -18
  43. data/examples/graph/themed_bar_chart.rb +0 -18
  44. data/examples/graph/themed_line_chart.rb +0 -18
  45. data/lib/prawn/graph.rb +0 -94
  46. data/lib/prawn/graph/bar.rb +0 -64
  47. data/lib/prawn/graph/base.rb +0 -231
  48. data/lib/prawn/graph/chart.rb +0 -4
  49. data/lib/prawn/graph/errors.rb +0 -7
  50. data/lib/prawn/graph/grid.rb +0 -50
  51. data/lib/prawn/graph/line.rb +0 -74
  52. data/lib/prawn/graph/themes.rb +0 -116
  53. data/lib/prawn/graph/themes/37signals.yml +0 -14
  54. data/lib/prawn/graph/themes/keynote.yml +0 -14
  55. data/lib/prawn/graph/themes/monochome.yml +0 -8
  56. data/lib/prawn/graph/themes/odeo.yml +0 -14
@@ -0,0 +1,5 @@
1
+ module Prawn
2
+ module Graph
3
+ VERSION = "0.9.0"
4
+ end
5
+ end
@@ -0,0 +1,42 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'prawn/graph/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "prawn-graph"
8
+ spec.version = Prawn::Graph::VERSION
9
+ spec.authors = [
10
+ "Ryan Stenhouse",
11
+ "株式会社アルム (Allm Inc)",
12
+ ]
13
+ spec.email = [
14
+ "ryan@ryanstenhouse.jp",
15
+ "r.stenhouse@allm.net",
16
+ ]
17
+
18
+ spec.summary = %q{Easily add graphs to Prawn PDF documents}
19
+ spec.description = %q{Prawn::Graph adds straightforward native graph drawing to Prawn without the need to depend on anything else. All generated graphs are pure PDF Vector Images. It results in smaller document sizes and less complication.}
20
+ spec.homepage = "http://prawn-graph.ryanstenhouse.jp"
21
+ spec.license = "MIT"
22
+
23
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
24
+ spec.bindir = "exe"
25
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
26
+ spec.require_paths = ["lib"]
27
+
28
+ spec.add_development_dependency "bundler", "~> 1.11"
29
+ spec.add_development_dependency "rake", "~> 10.0"
30
+ spec.add_development_dependency "rspec", "~> 3.0"
31
+ spec.add_development_dependency "codeclimate-test-reporter"
32
+ spec.add_development_dependency "yard"
33
+
34
+ spec.required_ruby_version = '>= 2.0.0'
35
+
36
+ spec.add_runtime_dependency "prawn", ">= 0.11.1", "< 3"
37
+
38
+ spec.metadata = {
39
+ "issue_tracker" => "https://github.com/HHRy/prawn-graph/issues",
40
+ "source_code" => "https://github.com/HHRy/prawn-graph"
41
+ }
42
+ end
metadata CHANGED
@@ -1,98 +1,174 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: prawn-graph
3
- version: !ruby/object:Gem::Version
4
- prerelease: false
5
- segments:
6
- - 0
7
- - 0
8
- - 4
9
- version: 0.0.4
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.9.0
10
5
  platform: ruby
11
- authors:
6
+ authors:
12
7
  - Ryan Stenhouse
8
+ - 株式会社アルム (Allm Inc)
13
9
  autorequire:
14
- bindir: bin
10
+ bindir: exe
15
11
  cert_chain: []
16
-
17
- date: 2010-02-27 00:00:00 +00:00
18
- default_executable:
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
21
- name: prawn
12
+ date: 2016-06-13 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: bundler
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - "~>"
19
+ - !ruby/object:Gem::Version
20
+ version: '1.11'
21
+ type: :development
22
+ prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - "~>"
26
+ - !ruby/object:Gem::Version
27
+ version: '1.11'
28
+ - !ruby/object:Gem::Dependency
29
+ name: rake
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - "~>"
33
+ - !ruby/object:Gem::Version
34
+ version: '10.0'
35
+ type: :development
36
+ prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - "~>"
40
+ - !ruby/object:Gem::Version
41
+ version: '10.0'
42
+ - !ruby/object:Gem::Dependency
43
+ name: rspec
44
+ requirement: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - "~>"
47
+ - !ruby/object:Gem::Version
48
+ version: '3.0'
49
+ type: :development
22
50
  prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
24
- requirements:
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - "~>"
54
+ - !ruby/object:Gem::Version
55
+ version: '3.0'
56
+ - !ruby/object:Gem::Dependency
57
+ name: codeclimate-test-reporter
58
+ requirement: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - ">="
61
+ - !ruby/object:Gem::Version
62
+ version: '0'
63
+ type: :development
64
+ prerelease: false
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - ">="
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ - !ruby/object:Gem::Dependency
71
+ name: yard
72
+ requirement: !ruby/object:Gem::Requirement
73
+ requirements:
25
74
  - - ">="
26
- - !ruby/object:Gem::Version
27
- segments:
28
- - 0
29
- version: "0"
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
77
+ type: :development
78
+ prerelease: false
79
+ version_requirements: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - ">="
82
+ - !ruby/object:Gem::Version
83
+ version: '0'
84
+ - !ruby/object:Gem::Dependency
85
+ name: prawn
86
+ requirement: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - ">="
89
+ - !ruby/object:Gem::Version
90
+ version: 0.11.1
91
+ - - "<"
92
+ - !ruby/object:Gem::Version
93
+ version: '3'
30
94
  type: :runtime
31
- version_requirements: *id001
32
- description: " An extension to Prawn that provides the ability to draw basic graphs and charts natively in your PDFs.\n"
33
- email: " ryan@ryanstenhouse.eu"
95
+ prerelease: false
96
+ version_requirements: !ruby/object:Gem::Requirement
97
+ requirements:
98
+ - - ">="
99
+ - !ruby/object:Gem::Version
100
+ version: 0.11.1
101
+ - - "<"
102
+ - !ruby/object:Gem::Version
103
+ version: '3'
104
+ description: Prawn::Graph adds straightforward native graph drawing to Prawn without
105
+ the need to depend on anything else. All generated graphs are pure PDF Vector Images.
106
+ It results in smaller document sizes and less complication.
107
+ email:
108
+ - ryan@ryanstenhouse.jp
109
+ - r.stenhouse@allm.net
34
110
  executables: []
35
-
36
111
  extensions: []
37
-
38
- extra_rdoc_files:
39
- - README.markdown
40
- files:
41
- - examples/example_helper.rb
42
- - examples/graph/advanced_bar_chart.rb
43
- - examples/graph/bar_chart.pdf
44
- - examples/graph/bar_chart.rb
45
- - examples/graph/line_chart.pdf
46
- - examples/graph/line_chart.rb
47
- - examples/graph/themed_bar_chart.rb
48
- - examples/graph/themed_line_chart.rb
49
- - lib/prawn/graph/bar.rb
50
- - lib/prawn/graph/base.rb
51
- - lib/prawn/graph/chart.rb
52
- - lib/prawn/graph/errors.rb
53
- - lib/prawn/graph/grid.rb
54
- - lib/prawn/graph/line.rb
55
- - lib/prawn/graph/themes/37signals.yml
56
- - lib/prawn/graph/themes/keynote.yml
57
- - lib/prawn/graph/themes/monochome.yml
58
- - lib/prawn/graph/themes/odeo.yml
59
- - lib/prawn/graph/themes.rb
60
- - lib/prawn/graph.rb
112
+ extra_rdoc_files: []
113
+ files:
114
+ - ".codeclimate.yml"
115
+ - ".gitignore"
116
+ - ".rspec"
117
+ - ".rubocop.yml"
118
+ - ".travis.yml"
119
+ - CODE_OF_CONDUCT.md
120
+ - CONTRIBUTORS.md
121
+ - Gemfile
122
+ - LICENSE.txt
123
+ - README.md
61
124
  - Rakefile
62
- - README.markdown
63
- has_rdoc: true
64
- homepage: http://ryanstenhouse.eu
65
- licenses: []
66
-
125
+ - bin/console
126
+ - bin/setup
127
+ - lib/prawn-graph.rb
128
+ - lib/prawn/graph/calculations.rb
129
+ - lib/prawn/graph/calculations/layout_calculator.rb
130
+ - lib/prawn/graph/chart_components.rb
131
+ - lib/prawn/graph/chart_components/canvas.rb
132
+ - lib/prawn/graph/chart_components/series_renderer.rb
133
+ - lib/prawn/graph/charts.rb
134
+ - lib/prawn/graph/charts/bar.rb
135
+ - lib/prawn/graph/charts/base.rb
136
+ - lib/prawn/graph/charts/legacy.rb
137
+ - lib/prawn/graph/charts/legacy/bar.rb
138
+ - lib/prawn/graph/charts/legacy/base.rb
139
+ - lib/prawn/graph/charts/legacy/grid.rb
140
+ - lib/prawn/graph/charts/legacy/line.rb
141
+ - lib/prawn/graph/charts/line.rb
142
+ - lib/prawn/graph/extension.rb
143
+ - lib/prawn/graph/series.rb
144
+ - lib/prawn/graph/theme.rb
145
+ - lib/prawn/graph/version.rb
146
+ - prawn-graph.gemspec
147
+ homepage: http://prawn-graph.ryanstenhouse.jp
148
+ licenses:
149
+ - MIT
150
+ metadata:
151
+ issue_tracker: https://github.com/HHRy/prawn-graph/issues
152
+ source_code: https://github.com/HHRy/prawn-graph
67
153
  post_install_message:
68
- rdoc_options:
69
- - --title
70
- - Prawn Documentation
71
- - --main
72
- - README
73
- - -q
74
- require_paths:
154
+ rdoc_options: []
155
+ require_paths:
75
156
  - lib
76
- required_ruby_version: !ruby/object:Gem::Requirement
77
- requirements:
157
+ required_ruby_version: !ruby/object:Gem::Requirement
158
+ requirements:
78
159
  - - ">="
79
- - !ruby/object:Gem::Version
80
- segments:
81
- - 0
82
- version: "0"
83
- required_rubygems_version: !ruby/object:Gem::Requirement
84
- requirements:
160
+ - !ruby/object:Gem::Version
161
+ version: 2.0.0
162
+ required_rubygems_version: !ruby/object:Gem::Requirement
163
+ requirements:
85
164
  - - ">="
86
- - !ruby/object:Gem::Version
87
- segments:
88
- - 0
89
- version: "0"
165
+ - !ruby/object:Gem::Version
166
+ version: '0'
90
167
  requirements: []
91
-
92
- rubyforge_project: prawn
93
- rubygems_version: 1.3.6
168
+ rubyforge_project:
169
+ rubygems_version: 2.5.1
94
170
  signing_key:
95
- specification_version: 3
96
- summary: An extension to Prawn that provides the ability to draw basic graphs and charts natively in your PDFs.
171
+ specification_version: 4
172
+ summary: Easily add graphs to Prawn PDF documents
97
173
  test_files: []
98
-
174
+ has_rdoc:
data/README.markdown DELETED
@@ -1,64 +0,0 @@
1
- # Prawn::Graph - Easy Graphing for Prawn
2
-
3
- Prawn::Graph copyrighted free software by Ryan Stenhouse
4
- <ryan@ryanstenhouse.eu> with contributions form the community.
5
-
6
- It extends Prawn::Core to add the ability for people to natively
7
- draw graphs and charts in their PDFs.
8
-
9
- Because Prawn::Graph only uses the native PDF drawing functions
10
- exposed by Prawn, it removes the need to depend on projects like
11
- Gruff to insert graphs in your documents. The results may not be
12
- as pretty (yet), but the file-size differences are dramatic.
13
-
14
- By default, graphs are drawn in monochrome, as that's likely how
15
- they will be printed. You can pass an option to each of the graph
16
- methods which will draw them in colour.
17
-
18
- **Notice!** Much like Prawn, this software should be considered to
19
- be in early alpha state at best. It's not recommended for use in
20
- a production environment unless you're happy to put up with bugs and
21
- are willing to help fix them!
22
-
23
- ## Installing & Using through RubyGems
24
-
25
- Installing and running prawn-graph is very easy:
26
-
27
- * <tt>gem install prawn-graph</tt>
28
-
29
- Gem version 0.3 is compatible with the latest 0.8 stable release
30
- of prawn. If you're still using 0.7, then install version 0.2 of
31
- prawn-graph.
32
-
33
- Using graphs in your PDF is as straightforward as:
34
-
35
- <pre>
36
- require 'rubygems'
37
- require 'prawn/core'
38
- require 'prawn/graph'
39
-
40
- data = [ ['A', 10], ['B', 11], ['C' 12] ]
41
-
42
- Prawn::Document.generate('test.pdf') do
43
- test 'Graph Example'
44
- bar_graph data at => [10,10]
45
- end
46
- </pre>
47
-
48
- ## Using Themes
49
-
50
- At the moment, work is underway on implementing 'Themes' within
51
- Prawn::Graph, which are hugely inspired by (and are indeed based on
52
- the actual themes from) Gruff.
53
-
54
- To find the list of available themes, use:
55
-
56
- Prawn::Chart::Themes.list
57
-
58
- The default theme which will be used for rendering is:
59
-
60
- Prawn::Chart::Theme.monochrome
61
-
62
- This in-line with the design decision of Prawn::Graph to render in
63
- monochrome by default, since most of our users are likely to be
64
- printing these documents!
@@ -1,10 +0,0 @@
1
- $LOAD_PATH.unshift(File.join(File.dirname(__FILE__),
2
- %w[.. vendor prawn-core lib]))
3
- $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
4
-
5
- require "rubygems"
6
- require "prawn/core"
7
- require "prawn/graph"
8
-
9
- Prawn.debug = true
10
-
@@ -1,22 +0,0 @@
1
-
2
- require "#{File.dirname(__FILE__)}/../example_helper.rb"
3
-
4
- options = {
5
- :title => 'Average litter size per kind of animal',
6
- :label_x => 'Kind of animal',
7
- :label_y => 'Average litter size',
8
- :at => [10,10]
9
- }
10
-
11
- data = [
12
- ['Raccoons', 4],
13
- ['Mice', 11],
14
- ['Dogs', 6],
15
- ['Panda', 1],
16
- ['Gorilla', 1],
17
- ['Cats', 4]
18
- ]
19
-
20
- Prawn::Document.generate('advanced_bar_chart.pdf') do
21
- bar_chart data, options
22
- end
@@ -1,185 +0,0 @@
1
- %PDF-1.3
2
- %����
3
- 1 0 obj
4
- << /Creator (Prawn)
5
- /Producer (Prawn)
6
- >>
7
- endobj
8
- 2 0 obj
9
- << /Count 1
10
- /Type /Pages
11
- /Kids [5 0 R]
12
- >>
13
- endobj
14
- 3 0 obj
15
- << /Pages 2 0 R
16
- /Type /Catalog
17
- >>
18
- endobj
19
- 4 0 obj
20
- << /Length 1307
21
- >>
22
- stream
23
- /DeviceRGB cs
24
- 0.000 0.000 0.000 scn
25
- /DeviceRGB CS
26
- 0.000 0.000 0.000 SCN
27
- q
28
- 0.000 0.000 0.000 scn
29
- 46.000 46.000 500.000 200.000 re
30
- b
31
- 1.000 1.000 1.000 SCN
32
- 61.000 66.000 m
33
- 0.5 w
34
- 546.000 66.000 l
35
- S
36
- 61.000 86.000 m
37
- 0.5 w
38
- 546.000 86.000 l
39
- S
40
- 61.000 106.000 m
41
- 0.5 w
42
- 546.000 106.000 l
43
- S
44
- 61.000 126.000 m
45
- 0.5 w
46
- 546.000 126.000 l
47
- S
48
- 61.000 146.000 m
49
- 0.5 w
50
- 546.000 146.000 l
51
- S
52
- 61.000 166.000 m
53
- 0.5 w
54
- 546.000 166.000 l
55
- S
56
- 61.000 186.000 m
57
- 0.5 w
58
- 546.000 186.000 l
59
- S
60
- 61.000 206.000 m
61
- 0.5 w
62
- 546.000 206.000 l
63
- S
64
- 61.000 226.000 m
65
- 0.5 w
66
- 546.000 226.000 l
67
- S
68
- 61.000 246.000 m
69
- 0.5 w
70
- 546.000 246.000 l
71
- S
72
- 61.000 46.000 m
73
- 2 w
74
- 61.000 246.000 l
75
- S
76
- 61.000 46.000 m
77
- 2 w
78
- 546.000 46.000 l
79
- S
80
- 61.000 246.000 m
81
- 0.000 0.000 0.000 SCN
82
- 1 w
83
- 61.000 46.000 m
84
-
85
- BT
86
- 47 247.0 Td
87
- /F1.0 5 Tf
88
- [<3435>] TJ
89
- ET
90
-
91
-
92
- BT
93
- 47 47.0 Td
94
- /F1.0 5 Tf
95
- [<30>] TJ
96
- ET
97
-
98
-
99
- BT
100
- 122 32.0 Td
101
- /F1.0 5 Tf
102
- [<43617473>] TJ
103
- ET
104
-
105
-
106
- BT
107
- 243 32.0 Td
108
- /F1.0 5 Tf
109
- [<446f6773>] TJ
110
- ET
111
-
112
-
113
- BT
114
- 364 32.0 Td
115
- /F1.0 5 Tf
116
- [<48616d7374657273>] TJ
117
- ET
118
-
119
-
120
- BT
121
- 485 32.0 Td
122
- /F1.0 5 Tf
123
- [<476f6c6466697368>] TJ
124
- ET
125
-
126
- 60 w
127
- 88.000 47.000 m
128
- 0.408 0.525 0.706 SCN
129
- 88.000 135.000 l
130
- S
131
- 209.000 47.000 m
132
- 0.992 0.847 0.306 SCN
133
- 209.000 207.000 l
134
- S
135
- 330.000 47.000 m
136
- 0.447 0.682 0.431 SCN
137
- 330.000 247.000 l
138
- S
139
- 451.000 47.000 m
140
- 0.820 0.412 0.369 SCN
141
- 451.000 69.000 l
142
- S
143
- 1 w
144
- 0.000 0.000 0.000 SCN
145
- 0.000 0.000 0.000 scn
146
- 61.000 46.000 m
147
- Q
148
-
149
- endstream
150
- endobj
151
- 5 0 obj
152
- << /Contents 4 0 R
153
- /Type /Page
154
- /Parent 2 0 R
155
- /Resources << /Font << /F1.0 6 0 R
156
- >>
157
- /ProcSet [/PDF /Text /ImageB /ImageC /ImageI]
158
- >>
159
- /MediaBox [0 0 612.0 792.0]
160
- >>
161
- endobj
162
- 6 0 obj
163
- << /Encoding /WinAnsiEncoding
164
- /Subtype /Type1
165
- /Type /Font
166
- /BaseFont /Helvetica
167
- >>
168
- endobj
169
- xref
170
- 0 7
171
- 0000000000 65535 f
172
- 0000000015 00000 n
173
- 0000000071 00000 n
174
- 0000000128 00000 n
175
- 0000000177 00000 n
176
- 0000001536 00000 n
177
- 0000001714 00000 n
178
- trailer
179
- << /Root 3 0 R
180
- /Info 1 0 R
181
- /Size 7
182
- >>
183
- startxref
184
- 1811
185
- %%EOF