gruffy 0.1.2 → 0.7.1.dev

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: 5b71279c627c87a1c9b0fc388ffcff8f1692aa21
4
- data.tar.gz: de75567a792366e27fd4bd731905aee354ed36c7
3
+ metadata.gz: 350c312be81553b8300f1a921360a08b7ed47e68
4
+ data.tar.gz: 1c88c8c744854c1db77de4637157b23b30a46d29
5
5
  SHA512:
6
- metadata.gz: 501a0f2033e592833667a342496f22a86507d7f963612c4e997d37f7c82498e1176da4890e8a491966832f454eadd0379b377d02e0f0d682d548f60b366800a5
7
- data.tar.gz: af27bb4eb68837bd656e8867e32bb558a68cbe4d3591cecf17744788293d3f8e0d4ec7b7eca91387e259762d8d76abd86d0b3039f6b293fd97f2827a8744c097
6
+ metadata.gz: b71c385e05abf2ffdad54bd6a8c27ce23e45b93cdc6459b8c9e6c4d24a92d241c1519d48c76549b898c843f010372eb371cfdf8a77d01c63ed742bda6583bc38
7
+ data.tar.gz: 167484a60a6067a5291cf97e4156e3587b9e4715451da7699adf5187ac575c4e21d6ca5b26c8ef86b12b7cbe7e210252946a0ddab19e85a302ce641c573be945
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
@@ -0,0 +1,49 @@
1
+ # Contributor Code of Conduct
2
+
3
+ As contributors and maintainers of this project, and in the interest of
4
+ fostering an open and welcoming community, we pledge to respect all people who
5
+ contribute through reporting issues, posting feature requests, updating
6
+ documentation, submitting pull requests or patches, and other activities.
7
+
8
+ We are committed to making participation in this project a harassment-free
9
+ experience for everyone, regardless of level of experience, gender, gender
10
+ identity and expression, sexual orientation, disability, personal appearance,
11
+ body size, race, ethnicity, age, religion, or nationality.
12
+
13
+ Examples of unacceptable behavior by participants include:
14
+
15
+ * The use of sexualized language or imagery
16
+ * Personal attacks
17
+ * Trolling or insulting/derogatory comments
18
+ * Public or private harassment
19
+ * Publishing other's private information, such as physical or electronic
20
+ addresses, without explicit permission
21
+ * Other unethical or unprofessional conduct
22
+
23
+ Project maintainers have the right and responsibility to remove, edit, or
24
+ reject comments, commits, code, wiki edits, issues, and other contributions
25
+ that are not aligned to this Code of Conduct, or to ban temporarily or
26
+ permanently any contributor for other behaviors that they deem inappropriate,
27
+ threatening, offensive, or harmful.
28
+
29
+ By adopting this Code of Conduct, project maintainers commit themselves to
30
+ fairly and consistently applying these principles to every aspect of managing
31
+ this project. Project maintainers who do not follow or enforce the Code of
32
+ Conduct may be permanently removed from the project team.
33
+
34
+ This code of conduct applies both within project spaces and in public spaces
35
+ when an individual is representing the project or its community.
36
+
37
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
38
+ reported by contacting a project maintainer at hiphopskynew@gmail.com. All
39
+ complaints will be reviewed and investigated and will result in a response that
40
+ is deemed necessary and appropriate to the circumstances. Maintainers are
41
+ obligated to maintain confidentiality with regard to the reporter of an
42
+ incident.
43
+
44
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage],
45
+ version 1.3.0, available at
46
+ [http://contributor-covenant.org/version/1/3/0/][version]
47
+
48
+ [homepage]: http://contributor-covenant.org
49
+ [version]: http://contributor-covenant.org/version/1/3/0/
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in gruffy.gemspec
4
+ gemspec
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2016 Wuttikrai Limsakul
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,41 @@
1
+ # Gruffy
2
+
3
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/gruffy`. To experiment with that code, run `bin/console` for an interactive prompt.
4
+
5
+ TODO: Delete this and the text above, and describe your gem
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'gruffy'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install gruffy
22
+
23
+ ## Usage
24
+
25
+ TODO: Write usage instructions here
26
+
27
+ ## Development
28
+
29
+ After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
30
+
31
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32
+
33
+ ## Contributing
34
+
35
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/gruffy. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
36
+
37
+
38
+ ## License
39
+
40
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
41
+
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+ task :default => :spec
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "gruffy"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,30 @@
1
+ # -*- encoding: utf-8 -*-
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'date'
5
+ require 'gruffy/version'
6
+
7
+ Gem::Specification.new do |s|
8
+ s.name = %q{gruffy}
9
+ s.version = Gruffy::VERSION
10
+ s.authors = ['Geoffrey Grosenbach', 'Uwe Kubosch']
11
+ s.date = Date.today.to_s
12
+ s.description = %q{Beautiful graphs for one or multiple datasets. Can be used on websites or in documents.}
13
+ s.email = %q{boss@topfunky.com}
14
+ s.files = `git ls-files`.split($/).reject{|f| f =~ /^test#{File::ALT_SEPARATOR || File::SEPARATOR}output/}
15
+ s.require_paths = %w(lib)
16
+ s.summary = %q{Beautiful graphs for one or multiple datasets.}
17
+ s.test_files = s.files.grep(%r{^(test|spec|features)/})
18
+ s.executables = s.files.grep(%r{^bin/}).map { |f| File.basename(f) }
19
+ s.specification_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
20
+ s.required_ruby_version = ['>= 1.9.3', '< 3']
21
+
22
+ if defined? JRUBY_VERSION
23
+ s.platform = 'java'
24
+ s.add_dependency 'rmagick4j', '~> 0.3', '>= 0.3.9'
25
+ else
26
+ s.add_dependency 'rmagick', '~> 2.13', '>= 2.13.4'
27
+ end
28
+ s.add_development_dependency('rake')
29
+ s.add_development_dependency('minitest-reporters')
30
+ end
@@ -1,3 +1,3 @@
1
1
  module Gruffy
2
- VERSION = '0.1.2'
2
+ VERSION = '0.7.1.dev'
3
3
  end
metadata CHANGED
@@ -1,14 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gruffy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.7.1.dev
5
5
  platform: ruby
6
6
  authors:
7
- - Wuttikrai Limsakul
7
+ - Geoffrey Grosenbach
8
+ - Uwe Kubosch
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
- date: 2016-06-05 00:00:00.000000000 Z
12
+ date: 2016-06-03 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
15
  name: rmagick
@@ -58,47 +59,28 @@ dependencies:
58
59
  - - ">="
59
60
  - !ruby/object:Gem::Version
60
61
  version: '0'
61
- description: Study only.
62
- email:
63
- - hiphopskynew@gmail.com
64
- executables: []
62
+ description: Beautiful graphs for one or multiple datasets. Can be used on websites
63
+ or in documents.
64
+ email: boss@topfunky.com
65
+ executables:
66
+ - console
67
+ - setup
65
68
  extensions: []
66
69
  extra_rdoc_files: []
67
70
  files:
71
+ - ".gitignore"
72
+ - CODE_OF_CONDUCT.md
73
+ - Gemfile
74
+ - LICENSE.txt
75
+ - README.md
76
+ - Rakefile
77
+ - bin/console
78
+ - bin/setup
79
+ - gruffy.gemspec
68
80
  - lib/gruffy.rb
69
- - lib/gruffy/accumulator_bar.rb
70
- - lib/gruffy/area.rb
71
- - lib/gruffy/bar.rb
72
- - lib/gruffy/bar_conversion.rb
73
- - lib/gruffy/base.rb
74
- - lib/gruffy/bezier.rb
75
- - lib/gruffy/bullet.rb
76
- - lib/gruffy/deprecated.rb
77
- - lib/gruffy/dot.rb
78
- - lib/gruffy/line.rb
79
- - lib/gruffy/mini/bar.rb
80
- - lib/gruffy/mini/legend.rb
81
- - lib/gruffy/mini/pie.rb
82
- - lib/gruffy/mini/side_bar.rb
83
- - lib/gruffy/net.rb
84
- - lib/gruffy/photo_bar.rb
85
- - lib/gruffy/pie.rb
86
- - lib/gruffy/scatter.rb
87
- - lib/gruffy/scene.rb
88
- - lib/gruffy/side_bar.rb
89
- - lib/gruffy/side_stacked_bar.rb
90
- - lib/gruffy/spider.rb
91
- - lib/gruffy/stacked_area.rb
92
- - lib/gruffy/stacked_bar.rb
93
- - lib/gruffy/stacked_mixin.rb
94
- - lib/gruffy/themes.rb
95
81
  - lib/gruffy/version.rb
96
- - rails_generators/gruffy/gruffy_generator.rb
97
- - rails_generators/gruffy/templates/controller.rb
98
- - rails_generators/gruffy/templates/functional_test.rb
99
- homepage: https://rubygems.org/gems/gruffy
100
- licenses:
101
- - MIT
82
+ homepage:
83
+ licenses: []
102
84
  metadata: {}
103
85
  post_install_message:
104
86
  rdoc_options: []
@@ -114,13 +96,13 @@ required_ruby_version: !ruby/object:Gem::Requirement
114
96
  version: '3'
115
97
  required_rubygems_version: !ruby/object:Gem::Requirement
116
98
  requirements:
117
- - - ">="
99
+ - - ">"
118
100
  - !ruby/object:Gem::Version
119
- version: '0'
101
+ version: 1.3.1
120
102
  requirements: []
121
103
  rubyforge_project:
122
- rubygems_version: 2.4.6
104
+ rubygems_version: 2.5.1
123
105
  signing_key:
124
106
  specification_version: 4
125
- summary: Not summary
107
+ summary: Beautiful graphs for one or multiple datasets.
126
108
  test_files: []
@@ -1,18 +0,0 @@
1
- require File.dirname(__FILE__) + '/base'
2
-
3
- ##
4
- # A special bar graph that shows a single dataset as a set of
5
- # stacked bars. The bottom bar shows the running total and
6
- # the top bar shows the new value being added to the array.
7
-
8
- class Gruffy::AccumulatorBar < Gruffy::StackedBar
9
- def draw
10
- raise(Gruffy::IncorrectNumberOfDatasetsException) unless @data.length == 1
11
-
12
- accum_array = @data.first[DATA_VALUES_INDEX][0..-2].inject([0]) { |a, v| a << a.last + v}
13
- data 'Accumulator', accum_array
14
- set_colors
15
- @data.reverse!
16
- super
17
- end
18
- end
@@ -1,51 +0,0 @@
1
-
2
- require File.dirname(__FILE__) + '/base'
3
-
4
- class Gruffy::Area < Gruffy::Base
5
- def initialize(*)
6
- super
7
- @sorted_drawing = true
8
- end
9
-
10
- def draw
11
- super
12
-
13
- return unless @has_data
14
-
15
- @x_increment = @graph_width / (@column_count - 1).to_f
16
- @d = @d.stroke 'transparent'
17
-
18
- @norm_data.each do |data_row|
19
- poly_points = Array.new
20
- prev_x = prev_y = 0.0
21
- @d = @d.fill data_row[DATA_COLOR_INDEX]
22
-
23
- data_row[DATA_VALUES_INDEX].each_with_index do |data_point, index|
24
- # Use incremented x and scaled y
25
- new_x = @graph_left + (@x_increment * index)
26
- new_y = @graph_top + (@graph_height - data_point * @graph_height)
27
-
28
- poly_points << new_x
29
- poly_points << new_y
30
-
31
- draw_label(new_x, index)
32
-
33
- prev_x = new_x
34
- prev_y = new_y
35
- end
36
-
37
- # Add closing points, draw polygon
38
- poly_points << @graph_right
39
- poly_points << @graph_bottom - 1
40
- poly_points << @graph_left
41
- poly_points << @graph_bottom - 1
42
-
43
- @d = @d.polyline(*poly_points)
44
-
45
- end
46
-
47
- @d.draw(@base_image)
48
- end
49
-
50
-
51
- end
@@ -1,108 +0,0 @@
1
- require File.dirname(__FILE__) + '/base'
2
- require File.dirname(__FILE__) + '/bar_conversion'
3
-
4
- class Gruffy::Bar < Gruffy::Base
5
-
6
- # Spacing factor applied between bars
7
- attr_accessor :bar_spacing
8
-
9
- def initialize(*args)
10
- super
11
- @spacing_factor = 0.9
12
- end
13
-
14
- def draw
15
- # Labels will be centered over the left of the bar if
16
- # there are more labels than columns. This is basically the same
17
- # as where it would be for a line graph.
18
- @center_labels_over_point = (@labels.keys.length > @column_count ? true : false)
19
-
20
- super
21
- return unless @has_data
22
-
23
- draw_bars
24
- end
25
-
26
- # Can be used to adjust the spaces between the bars.
27
- # Accepts values between 0.00 and 1.00 where 0.00 means no spacing at all
28
- # and 1 means that each bars' width is nearly 0 (so each bar is a simple
29
- # line with no x dimension).
30
- #
31
- # Default value is 0.9.
32
- def spacing_factor=(space_percent)
33
- raise ArgumentError, 'spacing_factor must be between 0.00 and 1.00' unless (space_percent >= 0 and space_percent <= 1)
34
- @spacing_factor = (1 - space_percent)
35
- end
36
-
37
- protected
38
-
39
- def draw_bars
40
- # Setup spacing.
41
- #
42
- # Columns sit side-by-side.
43
- @bar_spacing ||= @spacing_factor # space between the bars
44
- @bar_width = @graph_width / (@column_count * @data.length).to_f
45
- padding = (@bar_width * (1 - @bar_spacing)) / 2
46
-
47
- @d = @d.stroke_opacity 0.0
48
-
49
- # Setup the BarConversion Object
50
- conversion = Gruffy::BarConversion.new()
51
- conversion.graph_height = @graph_height
52
- conversion.graph_top = @graph_top
53
-
54
- # Set up the right mode [1,2,3] see BarConversion for further explanation
55
- if @minimum_value >= 0 then
56
- # all bars go from zero to positiv
57
- conversion.mode = 1
58
- else
59
- # all bars go from 0 to negativ
60
- if @maximum_value <= 0 then
61
- conversion.mode = 2
62
- else
63
- # bars either go from zero to negativ or to positiv
64
- conversion.mode = 3
65
- conversion.spread = @spread
66
- conversion.minimum_value = @minimum_value
67
- conversion.zero = -@minimum_value/@spread
68
- end
69
- end
70
-
71
- # iterate over all normalised data
72
- @norm_data.each_with_index do |data_row, row_index|
73
-
74
- data_row[DATA_VALUES_INDEX].each_with_index do |data_point, point_index|
75
- # Use incremented x and scaled y
76
- # x
77
- left_x = @graph_left + (@bar_width * (row_index + point_index + ((@data.length - 1) * point_index))) + padding
78
- right_x = left_x + @bar_width * @bar_spacing
79
- # y
80
- conv = []
81
- conversion.get_left_y_right_y_scaled( data_point, conv )
82
-
83
- # create new bar
84
- @d = @d.fill data_row[DATA_COLOR_INDEX]
85
- @d = @d.rectangle(left_x, conv[0], right_x, conv[1])
86
-
87
- # Calculate center based on bar_width and current row
88
- label_center = @graph_left +
89
- (@data.length * @bar_width * point_index) +
90
- (@data.length * @bar_width / 2.0)
91
-
92
- # Subtract half a bar width to center left if requested
93
- draw_label(label_center - (@center_labels_over_point ? @bar_width / 2.0 : 0.0), point_index)
94
- if @show_labels_for_bar_values
95
- val = (@label_formatting || '%.2f') % @norm_data[row_index][3][point_index]
96
- draw_value_label(left_x + (right_x - left_x)/2, conv[0]-30, val.commify, true)
97
- end
98
- end
99
-
100
- end
101
-
102
- # Draw the last label if requested
103
- draw_label(@graph_right, @column_count) if @center_labels_over_point
104
-
105
- @d.draw(@base_image)
106
- end
107
-
108
- end