gruff 0.31.0 → 0.32.0
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 +4 -4
- data/.github/workflows/ci.yml +3 -3
- data/CHANGELOG.md +17 -0
- data/lib/gruff/bar.rb +0 -5
- data/lib/gruff/base.rb +89 -92
- data/lib/gruff/dot.rb +0 -5
- data/lib/gruff/renderer/rectangle.rb +14 -5
- data/lib/gruff/side_bar.rb +0 -5
- data/lib/gruff/stacked_bar.rb +0 -5
- data/lib/gruff/version.rb +1 -1
- data/sig/generated/gruff/bar.rbs +0 -3
- data/sig/generated/gruff/base.rbs +22 -17
- data/sig/generated/gruff/dot.rbs +0 -3
- data/sig/generated/gruff/renderer/rectangle.rbs +2 -1
- data/sig/generated/gruff/side_bar.rbs +0 -3
- data/sig/generated/gruff/stacked_bar.rbs +0 -3
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e181e214f060da981e6c156e2d6944cd95d4027755508ecc7e2b21a04a167f10
|
|
4
|
+
data.tar.gz: 07a12faf510f8210d5265f1b1861a9996df22d57cc17141c4d7e3406ffccccc7
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1bf50811b2efbfe2020b1b68dbc1547f6c60e25e4d1de62f327f920944b158fe210d0b24da4687ea2cf66c0952bae37a9b6d1fd7d8f9bc5ac5d91b4943db1e73
|
|
7
|
+
data.tar.gz: 585d55b1c181ec016e8add6ca4499f500adcc4ab805fef949c703a913f138d1735ca364271d52c0096d18a4da47c13204b5dde97d55ca9e1bceeeabfd6531b54
|
data/.github/workflows/ci.yml
CHANGED
|
@@ -17,7 +17,7 @@ jobs:
|
|
|
17
17
|
matrix:
|
|
18
18
|
ruby-version: ['4.0']
|
|
19
19
|
imagemagick-version:
|
|
20
|
-
- { full: 7.1.2-
|
|
20
|
+
- { full: 7.1.2-22, major-minor: '7.1' }
|
|
21
21
|
name: Lint (Ruby ${{ matrix.ruby-version }}, ImageMagick ${{ matrix.imagemagick-version.major-minor }})
|
|
22
22
|
steps:
|
|
23
23
|
- uses: actions/checkout@v6
|
|
@@ -51,7 +51,7 @@ jobs:
|
|
|
51
51
|
matrix:
|
|
52
52
|
ruby-version: ['4.0']
|
|
53
53
|
imagemagick-version:
|
|
54
|
-
- { full: 7.1.2-
|
|
54
|
+
- { full: 7.1.2-22, major-minor: '7.1' }
|
|
55
55
|
name: Check RBS (Ruby ${{ matrix.ruby-version }}, ImageMagick ${{ matrix.imagemagick-version.major-minor }})
|
|
56
56
|
steps:
|
|
57
57
|
- uses: actions/checkout@v6
|
|
@@ -87,7 +87,7 @@ jobs:
|
|
|
87
87
|
matrix:
|
|
88
88
|
ruby-version: ['3.0', '3.1', '3.2', '3.3', '3.4', '4.0']
|
|
89
89
|
imagemagick-version:
|
|
90
|
-
- { full: 7.1.2-
|
|
90
|
+
- { full: 7.1.2-22, major-minor: '7.1' }
|
|
91
91
|
name: Ruby ${{ matrix.ruby-version }}
|
|
92
92
|
steps:
|
|
93
93
|
- uses: actions/checkout@v6
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
+
## 0.32.0
|
|
4
|
+
### Added
|
|
5
|
+
* Add floating legend support (#679)
|
|
6
|
+
* The legend is now rendered as a modern floating box over the graph area by default.
|
|
7
|
+
* `legend_position=`
|
|
8
|
+
* Allows setting the corner position of the floating legend. Accepts `:top_right` (default), `:top_left`, `:bottom_right`, or `:bottom_left`.
|
|
9
|
+
* `legend_spacing=`
|
|
10
|
+
* Sets the vertical spacing between individual legend items (default: `5.0`).
|
|
11
|
+
* `legend_padding=`
|
|
12
|
+
* Sets the inner padding between the legend frame and its contents (default: `7.0`).
|
|
13
|
+
* Tweaked default sizes for a cleaner look
|
|
14
|
+
* `legend_font` size reduced to `12.0`, `legend_box_size` to `10.0`, and `legend_margin` to `10.0`.
|
|
15
|
+
|
|
16
|
+
### Deprecated
|
|
17
|
+
* `legend_at_bottom=`
|
|
18
|
+
* This attribute is deprecated and no longer has any effect. Use `legend_position = :bottom_left` or `:bottom_right` instead.
|
|
19
|
+
|
|
3
20
|
## 0.31.0
|
|
4
21
|
|
|
5
22
|
- RBS: Add missing RBS signatures (#677)
|
data/lib/gruff/bar.rb
CHANGED
|
@@ -90,11 +90,6 @@ private
|
|
|
90
90
|
@hide_line_markers && @y_axis_label.nil?
|
|
91
91
|
end
|
|
92
92
|
|
|
93
|
-
# @rbs return: bool
|
|
94
|
-
def hide_bottom_label_area?
|
|
95
|
-
hide_labels? && @x_axis_label.nil? && @legend_at_bottom == false
|
|
96
|
-
end
|
|
97
|
-
|
|
98
93
|
# @rbs return: void
|
|
99
94
|
def setup_graph_measurements
|
|
100
95
|
super
|
data/lib/gruff/base.rb
CHANGED
|
@@ -23,7 +23,7 @@ module Gruff
|
|
|
23
23
|
# A common base class inherited from class of drawing a graph.
|
|
24
24
|
class Base
|
|
25
25
|
# Space around text elements. Mostly used for vertical spacing.
|
|
26
|
-
LEGEND_MARGIN =
|
|
26
|
+
LEGEND_MARGIN = 10.0
|
|
27
27
|
TITLE_MARGIN = 20.0
|
|
28
28
|
LABEL_MARGIN = 15.0
|
|
29
29
|
DEFAULT_MARGIN = 20.0
|
|
@@ -48,9 +48,6 @@ module Gruff
|
|
|
48
48
|
# Blank space below the title. Default is +20+.
|
|
49
49
|
attr_writer :title_margin #: Float | Integer
|
|
50
50
|
|
|
51
|
-
# Blank space below the legend. Default is +20+.
|
|
52
|
-
attr_writer :legend_margin #: Float | Integer
|
|
53
|
-
|
|
54
51
|
# Truncates labels if longer than max specified.
|
|
55
52
|
attr_writer :label_max_size #: Float | Integer
|
|
56
53
|
|
|
@@ -115,13 +112,16 @@ module Gruff
|
|
|
115
112
|
# first. This does not affect the legend. Default is +false+.
|
|
116
113
|
attr_writer :sorted_drawing #: bool
|
|
117
114
|
|
|
118
|
-
#
|
|
119
|
-
attr_writer :
|
|
115
|
+
# Blank space below the legend. Default is +20+.
|
|
116
|
+
attr_writer :legend_margin #: Float | Integer
|
|
120
117
|
|
|
121
|
-
#
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
#
|
|
118
|
+
# Set the vertical spacing between individual legend items. Default is +5.0+.
|
|
119
|
+
attr_writer :legend_spacing #: Float | Integer
|
|
120
|
+
|
|
121
|
+
# Set the inner padding between the legend frame and its contents. Default is +7.0+.
|
|
122
|
+
attr_writer :legend_padding #: Float | Integer
|
|
123
|
+
|
|
124
|
+
# Optionally set the size of the colored box by each item in the legend. Default is +20.0+.
|
|
125
125
|
attr_writer :legend_box_size #: Float | Integer
|
|
126
126
|
|
|
127
127
|
# If one numerical argument is given, the graph is drawn at 4/3 ratio
|
|
@@ -190,19 +190,22 @@ module Gruff
|
|
|
190
190
|
|
|
191
191
|
@title_font = Gruff::Font.new(size: 36.0, bold: true)
|
|
192
192
|
@marker_font = Gruff::Font.new(size: 21.0)
|
|
193
|
-
@legend_font = Gruff::Font.new(size:
|
|
193
|
+
@legend_font = Gruff::Font.new(size: 12.0)
|
|
194
194
|
@no_data_font = Gruff::Font.new(size: 80.0)
|
|
195
195
|
|
|
196
196
|
@label_margin = LABEL_MARGIN
|
|
197
197
|
@top_margin = @bottom_margin = @left_margin = @right_margin = DEFAULT_MARGIN
|
|
198
|
-
@legend_margin = LEGEND_MARGIN
|
|
199
198
|
@title_margin = TITLE_MARGIN
|
|
200
199
|
|
|
201
|
-
@
|
|
200
|
+
@legend_margin = LEGEND_MARGIN
|
|
201
|
+
@legend_spacing = 5.0
|
|
202
|
+
@legend_padding = 7.0
|
|
203
|
+
@legend_box_size = 10.0
|
|
204
|
+
@legend_position = :top_right
|
|
202
205
|
|
|
203
206
|
@no_data_message = 'No Data'
|
|
204
207
|
|
|
205
|
-
@hide_line_markers = @hide_legend = @hide_title = @hide_line_numbers =
|
|
208
|
+
@hide_line_markers = @hide_legend = @hide_title = @hide_line_numbers = false
|
|
206
209
|
@label_max_size = 0
|
|
207
210
|
@label_truncation_style = :absolute
|
|
208
211
|
@label_rotation = 0
|
|
@@ -255,6 +258,20 @@ module Gruff
|
|
|
255
258
|
@label_rotation = rotation.to_f
|
|
256
259
|
end
|
|
257
260
|
|
|
261
|
+
# Set the corner position of the floating legend. Accepts +:top_right+ (default),
|
|
262
|
+
# +:top_left+, +:bottom_right+, or +:bottom_left+.
|
|
263
|
+
#
|
|
264
|
+
# @param position [Symbol] the position.
|
|
265
|
+
# @rbs position: Symbol
|
|
266
|
+
# @rbs return: void
|
|
267
|
+
def legend_position=(position)
|
|
268
|
+
unless %i[top_right top_left bottom_right bottom_left].include?(position)
|
|
269
|
+
raise ArgumentError, 'Invalid legend position. Must be :top_right, :top_left, :bottom_right, or :bottom_left.'
|
|
270
|
+
end
|
|
271
|
+
|
|
272
|
+
@legend_position = position
|
|
273
|
+
end
|
|
274
|
+
|
|
258
275
|
# Height of staggering between labels.
|
|
259
276
|
# @deprecated
|
|
260
277
|
# @rbs return: void
|
|
@@ -262,6 +279,13 @@ module Gruff
|
|
|
262
279
|
warn '#label_stagger_height= is deprecated. It is no longer effective.'
|
|
263
280
|
end
|
|
264
281
|
|
|
282
|
+
# Set the legend position to the bottom of the graph.
|
|
283
|
+
# @deprecated
|
|
284
|
+
# @rbs return: void
|
|
285
|
+
def legend_at_bottom=(_value)
|
|
286
|
+
warn '#legend_at_bottom= is deprecated. It is no longer effective.'
|
|
287
|
+
end
|
|
288
|
+
|
|
265
289
|
# Set the large title of the graph displayed at the top.
|
|
266
290
|
# You can draw a multi-line title by putting a line break in the string
|
|
267
291
|
# or by setting an array as argument.
|
|
@@ -629,11 +653,11 @@ module Gruff
|
|
|
629
653
|
|
|
630
654
|
setup_drawing
|
|
631
655
|
|
|
632
|
-
draw_legend
|
|
633
656
|
draw_line_markers
|
|
634
657
|
draw_axis_labels
|
|
635
658
|
draw_title
|
|
636
659
|
draw_graph
|
|
660
|
+
draw_legend
|
|
637
661
|
end
|
|
638
662
|
|
|
639
663
|
protected
|
|
@@ -822,46 +846,57 @@ module Gruff
|
|
|
822
846
|
def draw_legend
|
|
823
847
|
return if @hide_legend
|
|
824
848
|
|
|
825
|
-
legend_labels = store.data.map(&:label)
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
line_height = [legend_caps_height,
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
849
|
+
legend_labels = store.data.map(&:label).reject(&:empty?)
|
|
850
|
+
return if legend_labels.empty?
|
|
851
|
+
|
|
852
|
+
line_height = [legend_caps_height, @legend_box_size].max + @legend_spacing
|
|
853
|
+
max_legend_label_width = legend_labels.map { |l| calculate_width(@legend_font, l) }.max || 0.0
|
|
854
|
+
|
|
855
|
+
legend_content_width = (@legend_box_size * 1.5) + max_legend_label_width
|
|
856
|
+
legend_content_height = (line_height * (legend_labels.size - 1)) + @legend_box_size
|
|
857
|
+
|
|
858
|
+
case @legend_position
|
|
859
|
+
when :top_left
|
|
860
|
+
current_x_offset = @graph_left + @legend_margin
|
|
861
|
+
current_y_offset = @graph_top + @legend_margin + @legend_spacing
|
|
862
|
+
when :bottom_right
|
|
863
|
+
current_x_offset = @graph_right - @legend_margin - legend_content_width
|
|
864
|
+
current_y_offset = @graph_bottom - @legend_margin - legend_content_height
|
|
865
|
+
when :bottom_left
|
|
866
|
+
current_x_offset = @graph_left + @legend_margin
|
|
867
|
+
current_y_offset = @graph_bottom - @legend_margin - legend_content_height
|
|
868
|
+
else # :top_right (default)
|
|
869
|
+
current_x_offset = @graph_right - @legend_margin - legend_content_width
|
|
870
|
+
current_y_offset = @graph_top + @legend_margin + @legend_spacing
|
|
836
871
|
end
|
|
837
872
|
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
873
|
+
legend_items_end_x = current_x_offset + legend_content_width
|
|
874
|
+
legend_items_end_y = current_y_offset + legend_content_height
|
|
875
|
+
|
|
876
|
+
frame_renderer = Gruff::Renderer::Rectangle.new(renderer, color: @marker_color, width: 1.1, opacity: 0.2, round: true)
|
|
877
|
+
frame_renderer.render(current_x_offset - @legend_padding,
|
|
878
|
+
current_y_offset - @legend_padding,
|
|
879
|
+
legend_items_end_x + @legend_padding,
|
|
880
|
+
legend_items_end_y + @legend_padding)
|
|
881
|
+
|
|
882
|
+
store.data.each do |data_row|
|
|
883
|
+
legend_label = data_row.label
|
|
884
|
+
next if legend_label.empty?
|
|
885
|
+
|
|
886
|
+
legend_label_width = calculate_width(@legend_font, legend_label)
|
|
887
|
+
|
|
888
|
+
text_renderer = Gruff::Renderer::Text.new(renderer, legend_label, font: @legend_font)
|
|
889
|
+
text_renderer.add_to_render_queue(legend_label_width,
|
|
890
|
+
@legend_box_size,
|
|
891
|
+
current_x_offset + (@legend_box_size * 1.5),
|
|
892
|
+
current_y_offset,
|
|
893
|
+
Magick::CenterGravity)
|
|
894
|
+
|
|
895
|
+
rect_renderer = Gruff::Renderer::Rectangle.new(renderer, color: data_row.color)
|
|
896
|
+
rect_renderer.render(current_x_offset,
|
|
897
|
+
current_y_offset,
|
|
898
|
+
current_x_offset + @legend_box_size,
|
|
899
|
+
current_y_offset + @legend_box_size)
|
|
865
900
|
|
|
866
901
|
current_y_offset += line_height
|
|
867
902
|
end
|
|
@@ -1123,14 +1158,12 @@ module Gruff
|
|
|
1123
1158
|
# When @hide title, leave a title_margin space for aesthetics.
|
|
1124
1159
|
# Same with @hide_legend
|
|
1125
1160
|
@top_margin +
|
|
1126
|
-
(hide_title? ? @title_margin : title_caps_height + @title_margin)
|
|
1127
|
-
(@hide_legend || @legend_at_bottom ? @legend_margin : calculate_legend_height + @legend_margin)
|
|
1161
|
+
(hide_title? ? @title_margin : title_caps_height + @title_margin)
|
|
1128
1162
|
end
|
|
1129
1163
|
|
|
1130
1164
|
# @rbs return: Float
|
|
1131
1165
|
def setup_bottom_margin
|
|
1132
1166
|
graph_bottom_margin = hide_bottom_label_area? ? @bottom_margin : @bottom_margin + labels_caps_height + @label_margin
|
|
1133
|
-
graph_bottom_margin += (calculate_legend_height + @legend_margin) if @legend_at_bottom
|
|
1134
1167
|
|
|
1135
1168
|
x_axis_label_height = @x_axis_label.nil? ? 0.0 : marker_caps_height + (@label_margin * 2)
|
|
1136
1169
|
@raw_rows - graph_bottom_margin - x_axis_label_height
|
|
@@ -1211,42 +1244,6 @@ module Gruff
|
|
|
1211
1244
|
end
|
|
1212
1245
|
end
|
|
1213
1246
|
|
|
1214
|
-
# @rbs legend_labels: Array[String]
|
|
1215
|
-
# @rbs legend_square_width: Float | Integer
|
|
1216
|
-
# @rbs return: Array[Array[Float | Integer]]
|
|
1217
|
-
def calculate_legend_label_widths_for_each_line(legend_labels, legend_square_width)
|
|
1218
|
-
label_widths = [[]]
|
|
1219
|
-
label_lines = [[]]
|
|
1220
|
-
legend_labels.each do |label|
|
|
1221
|
-
if label.empty?
|
|
1222
|
-
label_width = 0.0
|
|
1223
|
-
else
|
|
1224
|
-
width = calculate_width(@legend_font, label)
|
|
1225
|
-
label_width = width + (legend_square_width * 2.7)
|
|
1226
|
-
end
|
|
1227
|
-
label_widths.last.push label_width
|
|
1228
|
-
label_lines.last.push label
|
|
1229
|
-
|
|
1230
|
-
if label_widths.last.sum > (@raw_columns * 0.9)
|
|
1231
|
-
label_widths.push [label_widths.last.pop]
|
|
1232
|
-
label_lines.push [label_lines.last.pop]
|
|
1233
|
-
end
|
|
1234
|
-
end
|
|
1235
|
-
|
|
1236
|
-
label_widths.map(&:sum).zip(label_lines)
|
|
1237
|
-
end
|
|
1238
|
-
|
|
1239
|
-
# @rbs return: Float
|
|
1240
|
-
def calculate_legend_height
|
|
1241
|
-
return 0.0 if @hide_legend
|
|
1242
|
-
|
|
1243
|
-
legend_labels = store.data.map(&:label)
|
|
1244
|
-
legend_label_lines = calculate_legend_label_widths_for_each_line(legend_labels, @legend_box_size)
|
|
1245
|
-
line_height = [legend_caps_height, @legend_box_size].max
|
|
1246
|
-
|
|
1247
|
-
(line_height * legend_label_lines.count) + (@legend_margin * (legend_label_lines.count - 1))
|
|
1248
|
-
end
|
|
1249
|
-
|
|
1250
1247
|
# Returns the height of the capital letter 'X' for the current font and
|
|
1251
1248
|
# size.
|
|
1252
1249
|
#
|
data/lib/gruff/dot.rb
CHANGED
|
@@ -45,11 +45,6 @@ private
|
|
|
45
45
|
hide_labels? && @y_axis_label.nil?
|
|
46
46
|
end
|
|
47
47
|
|
|
48
|
-
# @rbs return: bool
|
|
49
|
-
def hide_bottom_label_area?
|
|
50
|
-
@hide_line_markers && @x_axis_label.nil? && @legend_at_bottom == false
|
|
51
|
-
end
|
|
52
|
-
|
|
53
48
|
# @rbs return: void
|
|
54
49
|
def draw_graph
|
|
55
50
|
# Setup spacing.
|
|
@@ -9,12 +9,14 @@ module Gruff
|
|
|
9
9
|
# @rbs color: String
|
|
10
10
|
# @rbs width: Float | Integer
|
|
11
11
|
# @rbs opacity: Float | Integer
|
|
12
|
+
# @rbs round: bool
|
|
12
13
|
# @rbs return: void
|
|
13
|
-
def initialize(renderer, color: nil, width: 1.0, opacity: 1.0)
|
|
14
|
+
def initialize(renderer, color: nil, width: 1.0, opacity: 1.0, round: false)
|
|
14
15
|
@renderer = renderer
|
|
15
16
|
@color = color
|
|
16
17
|
@width = width
|
|
17
18
|
@opacity = opacity
|
|
19
|
+
@round = round
|
|
18
20
|
end
|
|
19
21
|
|
|
20
22
|
# @rbs upper_left_x: Float | Integer
|
|
@@ -25,10 +27,17 @@ module Gruff
|
|
|
25
27
|
def render(upper_left_x, upper_left_y, lower_right_x, lower_right_y)
|
|
26
28
|
@renderer.draw.push
|
|
27
29
|
@renderer.draw.stroke_width(@width)
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
if @color
|
|
31
|
+
@renderer.draw.stroke(@color) if @width > 1.0
|
|
32
|
+
@renderer.draw.fill_opacity(@opacity)
|
|
33
|
+
@renderer.draw.fill(@color)
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
if @round
|
|
37
|
+
@renderer.draw.roundrectangle(upper_left_x, upper_left_y, lower_right_x, lower_right_y, 3, 3)
|
|
38
|
+
else
|
|
39
|
+
@renderer.draw.rectangle(upper_left_x, upper_left_y, lower_right_x, lower_right_y)
|
|
40
|
+
end
|
|
32
41
|
@renderer.draw.pop
|
|
33
42
|
end
|
|
34
43
|
end
|
data/lib/gruff/side_bar.rb
CHANGED
|
@@ -83,11 +83,6 @@ private
|
|
|
83
83
|
hide_labels? && @y_axis_label.nil?
|
|
84
84
|
end
|
|
85
85
|
|
|
86
|
-
# @rbs return: bool
|
|
87
|
-
def hide_bottom_label_area?
|
|
88
|
-
@hide_line_markers && @x_axis_label.nil? && @legend_at_bottom == false
|
|
89
|
-
end
|
|
90
|
-
|
|
91
86
|
# @rbs return: void
|
|
92
87
|
def setup_graph_measurements
|
|
93
88
|
super
|
data/lib/gruff/stacked_bar.rb
CHANGED
|
@@ -134,11 +134,6 @@ private
|
|
|
134
134
|
@hide_line_markers && @y_axis_label.nil?
|
|
135
135
|
end
|
|
136
136
|
|
|
137
|
-
# @rbs return: bool
|
|
138
|
-
def hide_bottom_label_area?
|
|
139
|
-
hide_labels? && @x_axis_label.nil? && @legend_at_bottom == false
|
|
140
|
-
end
|
|
141
|
-
|
|
142
137
|
# @rbs return: Proc
|
|
143
138
|
def proc_text_metrics
|
|
144
139
|
->(text) { text_metrics(@marker_font, text) }
|
data/lib/gruff/version.rb
CHANGED
data/sig/generated/gruff/bar.rbs
CHANGED
|
@@ -45,9 +45,6 @@ module Gruff
|
|
|
45
45
|
# Blank space below the title. Default is +20+.
|
|
46
46
|
attr_writer title_margin: Float | Integer
|
|
47
47
|
|
|
48
|
-
# Blank space below the legend. Default is +20+.
|
|
49
|
-
attr_writer legend_margin: Float | Integer
|
|
50
|
-
|
|
51
48
|
# Truncates labels if longer than max specified.
|
|
52
49
|
attr_writer label_max_size: Float | Integer
|
|
53
50
|
|
|
@@ -112,13 +109,16 @@ module Gruff
|
|
|
112
109
|
# first. This does not affect the legend. Default is +false+.
|
|
113
110
|
attr_writer sorted_drawing: bool
|
|
114
111
|
|
|
115
|
-
#
|
|
116
|
-
attr_writer
|
|
112
|
+
# Blank space below the legend. Default is +20+.
|
|
113
|
+
attr_writer legend_margin: Float | Integer
|
|
117
114
|
|
|
118
|
-
#
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
#
|
|
115
|
+
# Set the vertical spacing between individual legend items. Default is +5.0+.
|
|
116
|
+
attr_writer legend_spacing: Float | Integer
|
|
117
|
+
|
|
118
|
+
# Set the inner padding between the legend frame and its contents. Default is +7.0+.
|
|
119
|
+
attr_writer legend_padding: Float | Integer
|
|
120
|
+
|
|
121
|
+
# Optionally set the size of the colored box by each item in the legend. Default is +20.0+.
|
|
122
122
|
attr_writer legend_box_size: Float | Integer
|
|
123
123
|
|
|
124
124
|
# If one numerical argument is given, the graph is drawn at 4/3 ratio
|
|
@@ -176,11 +176,24 @@ module Gruff
|
|
|
176
176
|
# @rbs return: void
|
|
177
177
|
def label_rotation=: (Float | Integer rotation) -> void
|
|
178
178
|
|
|
179
|
+
# Set the corner position of the floating legend. Accepts +:top_right+ (default),
|
|
180
|
+
# +:top_left+, +:bottom_right+, or +:bottom_left+.
|
|
181
|
+
#
|
|
182
|
+
# @param position [Symbol] the position.
|
|
183
|
+
# @rbs position: Symbol
|
|
184
|
+
# @rbs return: void
|
|
185
|
+
def legend_position=: (Symbol position) -> void
|
|
186
|
+
|
|
179
187
|
# Height of staggering between labels.
|
|
180
188
|
# @deprecated
|
|
181
189
|
# @rbs return: void
|
|
182
190
|
def label_stagger_height=: (untyped _value) -> void
|
|
183
191
|
|
|
192
|
+
# Set the legend position to the bottom of the graph.
|
|
193
|
+
# @deprecated
|
|
194
|
+
# @rbs return: void
|
|
195
|
+
def legend_at_bottom=: (untyped _value) -> void
|
|
196
|
+
|
|
184
197
|
# Set the large title of the graph displayed at the top.
|
|
185
198
|
# You can draw a multi-line title by putting a line break in the string
|
|
186
199
|
# or by setting an array as argument.
|
|
@@ -657,14 +670,6 @@ module Gruff
|
|
|
657
670
|
# @rbs return: String
|
|
658
671
|
def y_axis_label: (Float | Integer | BigDecimal value, Float | Integer increment) -> String
|
|
659
672
|
|
|
660
|
-
# @rbs legend_labels: Array[String]
|
|
661
|
-
# @rbs legend_square_width: Float | Integer
|
|
662
|
-
# @rbs return: Array[Array[Float | Integer]]
|
|
663
|
-
def calculate_legend_label_widths_for_each_line: (Array[String] legend_labels, Float | Integer legend_square_width) -> Array[Array[Float | Integer]]
|
|
664
|
-
|
|
665
|
-
# @rbs return: Float
|
|
666
|
-
def calculate_legend_height: () -> Float
|
|
667
|
-
|
|
668
673
|
# Returns the height of the capital letter 'X' for the current font and
|
|
669
674
|
# size.
|
|
670
675
|
#
|
data/sig/generated/gruff/dot.rbs
CHANGED
|
@@ -7,8 +7,9 @@ module Gruff
|
|
|
7
7
|
# @rbs color: String
|
|
8
8
|
# @rbs width: Float | Integer
|
|
9
9
|
# @rbs opacity: Float | Integer
|
|
10
|
+
# @rbs round: bool
|
|
10
11
|
# @rbs return: void
|
|
11
|
-
def initialize: (Gruff::Renderer renderer, ?color: String, ?width: Float | Integer, ?opacity: Float | Integer) -> void
|
|
12
|
+
def initialize: (Gruff::Renderer renderer, ?color: String, ?width: Float | Integer, ?opacity: Float | Integer, ?round: bool) -> void
|
|
12
13
|
|
|
13
14
|
# @rbs upper_left_x: Float | Integer
|
|
14
15
|
# @rbs upper_left_y: Float | Integer
|
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.32.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Geoffrey Grosenbach
|
|
@@ -201,7 +201,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
201
201
|
- !ruby/object:Gem::Version
|
|
202
202
|
version: '0'
|
|
203
203
|
requirements: []
|
|
204
|
-
rubygems_version: 4.0.
|
|
204
|
+
rubygems_version: 4.0.10
|
|
205
205
|
specification_version: 4
|
|
206
206
|
summary: Beautiful graphs for one or multiple datasets.
|
|
207
207
|
test_files: []
|