gruff 0.13.0-java → 0.14.0-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +66 -0
- data/.rubocop.yml +6 -10
- data/.rubocop_todo.yml +19 -85
- data/CHANGELOG.md +10 -0
- data/README.md +6 -7
- data/gruff.gemspec +2 -4
- data/lib/gruff.rb +1 -0
- data/lib/gruff/accumulator_bar.rb +3 -1
- data/lib/gruff/area.rb +5 -8
- data/lib/gruff/bar.rb +19 -23
- data/lib/gruff/base.rb +134 -96
- data/lib/gruff/bezier.rb +4 -6
- data/lib/gruff/bullet.rb +11 -10
- data/lib/gruff/dot.rb +10 -10
- data/lib/gruff/font.rb +39 -0
- data/lib/gruff/helper/stacked_mixin.rb +1 -2
- data/lib/gruff/histogram.rb +9 -7
- data/lib/gruff/line.rb +55 -46
- data/lib/gruff/mini/bar.rb +9 -6
- data/lib/gruff/mini/legend.rb +12 -8
- data/lib/gruff/mini/pie.rb +9 -6
- data/lib/gruff/mini/side_bar.rb +9 -6
- data/lib/gruff/net.rb +9 -15
- data/lib/gruff/patch/string.rb +1 -1
- data/lib/gruff/pie.rb +23 -65
- data/lib/gruff/renderer/bezier.rb +8 -9
- data/lib/gruff/renderer/circle.rb +8 -9
- data/lib/gruff/renderer/dash_line.rb +9 -10
- data/lib/gruff/renderer/dot.rb +13 -14
- data/lib/gruff/renderer/ellipse.rb +8 -9
- data/lib/gruff/renderer/line.rb +8 -9
- data/lib/gruff/renderer/polygon.rb +9 -10
- data/lib/gruff/renderer/polyline.rb +8 -9
- data/lib/gruff/renderer/rectangle.rb +7 -8
- data/lib/gruff/renderer/renderer.rb +21 -36
- data/lib/gruff/renderer/text.rb +21 -37
- data/lib/gruff/scatter.rb +41 -46
- data/lib/gruff/scene.rb +15 -13
- data/lib/gruff/side_bar.rb +14 -30
- data/lib/gruff/side_stacked_bar.rb +8 -11
- data/lib/gruff/spider.rb +11 -16
- data/lib/gruff/stacked_area.rb +10 -11
- data/lib/gruff/stacked_bar.rb +9 -9
- data/lib/gruff/store/store.rb +6 -10
- data/lib/gruff/themes.rb +6 -6
- data/lib/gruff/version.rb +1 -1
- data/rails_generators/gruff/templates/controller.rb +1 -1
- metadata +4 -21
- data/.travis.yml +0 -23
- data/assets/plastik/blue.png +0 -0
- data/assets/plastik/green.png +0 -0
- data/assets/plastik/red.png +0 -0
- data/lib/gruff/photo_bar.rb +0 -93
data/lib/gruff/version.rb
CHANGED
@@ -26,7 +26,7 @@ class <%= controller_class_name %>Controller < ApplicationController
|
|
26
26
|
|
27
27
|
g.labels = {0 => '2004', 2 => '2005', 4 => '2006'}
|
28
28
|
|
29
|
-
send_data(g.to_blob, :disposition => 'inline', :type => 'image/png', :filename => "gruff.png")
|
29
|
+
send_data(g.to_image.to_blob, :disposition => 'inline', :type => 'image/png', :filename => "gruff.png")
|
30
30
|
end
|
31
31
|
|
32
32
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gruff
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.14.0
|
5
5
|
platform: java
|
6
6
|
authors:
|
7
7
|
- Geoffrey Grosenbach
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2021-
|
12
|
+
date: 2021-07-11 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
@@ -53,20 +53,6 @@ dependencies:
|
|
53
53
|
- - ">="
|
54
54
|
- !ruby/object:Gem::Version
|
55
55
|
version: '0'
|
56
|
-
- !ruby/object:Gem::Dependency
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - ">="
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '0'
|
62
|
-
name: parallel
|
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
56
|
- !ruby/object:Gem::Dependency
|
71
57
|
requirement: !ruby/object:Gem::Requirement
|
72
58
|
requirements:
|
@@ -118,10 +104,10 @@ extra_rdoc_files: []
|
|
118
104
|
files:
|
119
105
|
- ".editorconfig"
|
120
106
|
- ".github/ISSUE_TEMPLATE.md"
|
107
|
+
- ".github/workflows/ci.yml"
|
121
108
|
- ".gitignore"
|
122
109
|
- ".rubocop.yml"
|
123
110
|
- ".rubocop_todo.yml"
|
124
|
-
- ".travis.yml"
|
125
111
|
- ".yardopts"
|
126
112
|
- CHANGELOG.md
|
127
113
|
- Gemfile
|
@@ -130,9 +116,6 @@ files:
|
|
130
116
|
- assets/fonts/LICENSE.txt
|
131
117
|
- assets/fonts/Roboto-Bold.ttf
|
132
118
|
- assets/fonts/Roboto-Regular.ttf
|
133
|
-
- assets/plastik/blue.png
|
134
|
-
- assets/plastik/green.png
|
135
|
-
- assets/plastik/red.png
|
136
119
|
- gruff.gemspec
|
137
120
|
- init.rb
|
138
121
|
- lib/gruff.rb
|
@@ -143,6 +126,7 @@ files:
|
|
143
126
|
- lib/gruff/bezier.rb
|
144
127
|
- lib/gruff/bullet.rb
|
145
128
|
- lib/gruff/dot.rb
|
129
|
+
- lib/gruff/font.rb
|
146
130
|
- lib/gruff/helper/bar_conversion.rb
|
147
131
|
- lib/gruff/helper/bar_value_label.rb
|
148
132
|
- lib/gruff/helper/stacked_mixin.rb
|
@@ -155,7 +139,6 @@ files:
|
|
155
139
|
- lib/gruff/net.rb
|
156
140
|
- lib/gruff/patch/rmagick.rb
|
157
141
|
- lib/gruff/patch/string.rb
|
158
|
-
- lib/gruff/photo_bar.rb
|
159
142
|
- lib/gruff/pie.rb
|
160
143
|
- lib/gruff/renderer/bezier.rb
|
161
144
|
- lib/gruff/renderer/circle.rb
|
data/.travis.yml
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
language: ruby
|
2
|
-
dist: bionic
|
3
|
-
cache: bundler
|
4
|
-
|
5
|
-
rvm:
|
6
|
-
- 2.4
|
7
|
-
- 2.5
|
8
|
-
- 2.6
|
9
|
-
- 2.7
|
10
|
-
- 3.0
|
11
|
-
- jruby-9.2.14.0
|
12
|
-
|
13
|
-
jobs:
|
14
|
-
include:
|
15
|
-
- name: 'Lint'
|
16
|
-
rvm: 2.4
|
17
|
-
script: bundle exec rubocop
|
18
|
-
|
19
|
-
addons:
|
20
|
-
apt:
|
21
|
-
packages:
|
22
|
-
- gsfonts
|
23
|
-
- ghostscript
|
data/assets/plastik/blue.png
DELETED
Binary file
|
data/assets/plastik/green.png
DELETED
Binary file
|
data/assets/plastik/red.png
DELETED
Binary file
|
data/lib/gruff/photo_bar.rb
DELETED
@@ -1,93 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# EXPERIMENTAL!
|
4
|
-
#
|
5
|
-
# Doesn't work yet.
|
6
|
-
#
|
7
|
-
class Gruff::PhotoBar < Gruff::Base
|
8
|
-
# TODO
|
9
|
-
#
|
10
|
-
# define base and cap in yml
|
11
|
-
# allow for image directory to be located elsewhere
|
12
|
-
# more exact measurements for bar heights (go all the way to the bottom of the graph)
|
13
|
-
# option to tile images instead of use a single image
|
14
|
-
# drop base label a few px lower so photo bar graphs can have a base dropping over the lower marker line
|
15
|
-
#
|
16
|
-
|
17
|
-
# The name of a pre-packaged photo-based theme.
|
18
|
-
attr_reader :theme
|
19
|
-
|
20
|
-
# def initialize(target_width=800)
|
21
|
-
# super
|
22
|
-
# init_photo_bar_graphics()
|
23
|
-
# end
|
24
|
-
|
25
|
-
def draw
|
26
|
-
super
|
27
|
-
return unless data_given?
|
28
|
-
|
29
|
-
return # TODO: Remove for further development
|
30
|
-
|
31
|
-
init_photo_bar_graphics
|
32
|
-
|
33
|
-
#Draw#define_clip_path()
|
34
|
-
#Draw#clip_path(pathname)
|
35
|
-
#Draw#composite....with bar graph image OverCompositeOp
|
36
|
-
#
|
37
|
-
# See also
|
38
|
-
#
|
39
|
-
# Draw.pattern # define an image to tile as the filling of a draw object
|
40
|
-
#
|
41
|
-
|
42
|
-
# Setup spacing.
|
43
|
-
#
|
44
|
-
# Columns sit side-by-side.
|
45
|
-
spacing_factor = 0.9
|
46
|
-
bar_width = store.norm_data[0].color.columns
|
47
|
-
|
48
|
-
store.norm_data.each_with_index do |data_row, row_index|
|
49
|
-
data_row.points.each_with_index do |data_point, point_index|
|
50
|
-
data_point = 0 if data_point.nil?
|
51
|
-
# Use incremented x and scaled y
|
52
|
-
left_x = @graph_left + (bar_width * (row_index + point_index + ((store.length - 1) * point_index)))
|
53
|
-
left_y = @graph_top + (@graph_height - data_point * @graph_height) + 1
|
54
|
-
right_x = left_x + bar_width * spacing_factor
|
55
|
-
right_y = @graph_top + @graph_height - 1
|
56
|
-
|
57
|
-
bar_image_width = data_row.color.columns
|
58
|
-
bar_image_height = right_y.to_f - left_y.to_f
|
59
|
-
|
60
|
-
# Crop to scale for data
|
61
|
-
bar_image = data_row.color.crop(0, 0, bar_image_width, bar_image_height)
|
62
|
-
|
63
|
-
@d.gravity = Magick::NorthWestGravity
|
64
|
-
@d.composite(left_x, left_y, bar_image_width, bar_image_height, bar_image)
|
65
|
-
|
66
|
-
# Calculate center based on bar_width and current row
|
67
|
-
label_center = @graph_left + (store.length * bar_width * point_index) + (store.length * bar_width / 2.0)
|
68
|
-
draw_label(label_center, point_index)
|
69
|
-
end
|
70
|
-
end
|
71
|
-
end
|
72
|
-
|
73
|
-
# Return the chosen theme or the default
|
74
|
-
def theme
|
75
|
-
@theme || 'plastik'
|
76
|
-
end
|
77
|
-
|
78
|
-
protected
|
79
|
-
|
80
|
-
# Sets up colors with a list of images that will be used.
|
81
|
-
# Images should be 340px tall
|
82
|
-
def init_photo_bar_graphics
|
83
|
-
color_list = []
|
84
|
-
theme_dir = File.dirname(__FILE__) + '/../../assets/' + theme
|
85
|
-
|
86
|
-
Dir.open(theme_dir).each do |file|
|
87
|
-
next unless /\.png$/.match(file)
|
88
|
-
|
89
|
-
color_list << Magick::Image.read("#{theme_dir}/#{file}").first
|
90
|
-
end
|
91
|
-
@colors = color_list
|
92
|
-
end
|
93
|
-
end
|