gruff 0.26.0 → 0.27.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.
Files changed (100) hide show
  1. checksums.yaml +4 -4
  2. data/.github/ISSUE_TEMPLATE/report.yml +1 -1
  3. data/.github/workflows/ci.yml +37 -0
  4. data/.rubocop.yml +3 -0
  5. data/CHANGELOG.md +18 -1
  6. data/Gemfile +5 -0
  7. data/README.md +7 -1
  8. data/gruff.gemspec +1 -1
  9. data/lib/gruff/accumulator_bar.rb +3 -1
  10. data/lib/gruff/area.rb +5 -2
  11. data/lib/gruff/bar.rb +18 -9
  12. data/lib/gruff/base.rb +193 -68
  13. data/lib/gruff/bezier.rb +6 -3
  14. data/lib/gruff/box.rb +40 -16
  15. data/lib/gruff/bubble.rb +9 -2
  16. data/lib/gruff/bullet.rb +8 -1
  17. data/lib/gruff/candlestick.rb +30 -8
  18. data/lib/gruff/dot.rb +13 -3
  19. data/lib/gruff/font.rb +12 -4
  20. data/lib/gruff/helper/bar_conversion.rb +12 -1
  21. data/lib/gruff/helper/bar_mixin.rb +19 -1
  22. data/lib/gruff/helper/bar_value_label.rb +22 -4
  23. data/lib/gruff/helper/stacked_mixin.rb +21 -1
  24. data/lib/gruff/histogram.rb +14 -5
  25. data/lib/gruff/line.rb +31 -12
  26. data/lib/gruff/mini/bar.rb +2 -2
  27. data/lib/gruff/mini/legend.rb +10 -1
  28. data/lib/gruff/mini/pie.rb +2 -2
  29. data/lib/gruff/mini/side_bar.rb +2 -2
  30. data/lib/gruff/net.rb +12 -7
  31. data/lib/gruff/patch/rmagick.rb +2 -0
  32. data/lib/gruff/patch/string.rb +1 -1
  33. data/lib/gruff/pie.rb +46 -11
  34. data/lib/gruff/renderer/bezier.rb +7 -0
  35. data/lib/gruff/renderer/circle.rb +11 -0
  36. data/lib/gruff/renderer/dash_line.rb +11 -0
  37. data/lib/gruff/renderer/dot.rb +11 -0
  38. data/lib/gruff/renderer/ellipse.rb +12 -0
  39. data/lib/gruff/renderer/line.rb +10 -0
  40. data/lib/gruff/renderer/polygon.rb +6 -0
  41. data/lib/gruff/renderer/polyline.rb +8 -0
  42. data/lib/gruff/renderer/rectangle.rb +11 -0
  43. data/lib/gruff/renderer/renderer.rb +16 -5
  44. data/lib/gruff/renderer/text.rb +19 -2
  45. data/lib/gruff/scatter.rb +16 -8
  46. data/lib/gruff/side_bar.rb +19 -10
  47. data/lib/gruff/side_stacked_bar.rb +15 -11
  48. data/lib/gruff/spider.rb +9 -2
  49. data/lib/gruff/stacked_area.rb +6 -1
  50. data/lib/gruff/stacked_bar.rb +16 -10
  51. data/lib/gruff/store/basic_data.rb +36 -2
  52. data/lib/gruff/store/store.rb +16 -3
  53. data/lib/gruff/store/xy_data.rb +32 -2
  54. data/lib/gruff/store/xy_pointsizes_data.rb +36 -3
  55. data/lib/gruff/themes.rb +2 -0
  56. data/lib/gruff/version.rb +3 -1
  57. data/lib/gruff.rb +3 -1
  58. data/sig/generated/gruff/accumulator_bar.rbs +19 -0
  59. data/sig/generated/gruff/area.rbs +27 -0
  60. data/sig/generated/gruff/bar.rbs +74 -0
  61. data/sig/generated/gruff/base.rbs +672 -0
  62. data/sig/generated/gruff/bezier.rbs +24 -0
  63. data/sig/generated/gruff/box.rbs +88 -0
  64. data/sig/generated/gruff/bubble.rbs +69 -0
  65. data/sig/generated/gruff/bullet.rbs +30 -0
  66. data/sig/generated/gruff/candlestick.rbs +79 -0
  67. data/sig/generated/gruff/dot.rbs +44 -0
  68. data/sig/generated/gruff/font.rbs +35 -0
  69. data/sig/generated/gruff/helper/bar_conversion.rbs +27 -0
  70. data/sig/generated/gruff/helper/bar_mixin.rbs +22 -0
  71. data/sig/generated/gruff/helper/bar_value_label.rbs +41 -0
  72. data/sig/generated/gruff/helper/stacked_mixin.rbs +27 -0
  73. data/sig/generated/gruff/histogram.rbs +42 -0
  74. data/sig/generated/gruff/line.rbs +165 -0
  75. data/sig/generated/gruff/net.rbs +52 -0
  76. data/sig/generated/gruff/pie.rbs +131 -0
  77. data/sig/generated/gruff/renderer/bezier.rbs +15 -0
  78. data/sig/generated/gruff/renderer/circle.rbs +19 -0
  79. data/sig/generated/gruff/renderer/dash_line.rbs +19 -0
  80. data/sig/generated/gruff/renderer/dot.rbs +27 -0
  81. data/sig/generated/gruff/renderer/ellipse.rbs +20 -0
  82. data/sig/generated/gruff/renderer/line.rbs +24 -0
  83. data/sig/generated/gruff/renderer/polyline.rbs +16 -0
  84. data/sig/generated/gruff/renderer/rectangle.rbs +19 -0
  85. data/sig/generated/gruff/renderer/renderer.rbs +43 -0
  86. data/sig/generated/gruff/renderer/text.rbs +38 -0
  87. data/sig/generated/gruff/scatter.rbs +112 -0
  88. data/sig/generated/gruff/side_bar.rbs +78 -0
  89. data/sig/generated/gruff/side_stacked_bar.rbs +52 -0
  90. data/sig/generated/gruff/spider.rbs +50 -0
  91. data/sig/generated/gruff/stacked_area.rbs +25 -0
  92. data/sig/generated/gruff/stacked_bar.rbs +56 -0
  93. data/sig/generated/gruff/store/basic_data.rbs +48 -0
  94. data/sig/generated/gruff/store/store.rbs +53 -0
  95. data/sig/generated/gruff/store/xy_data.rbs +58 -0
  96. data/sig/generated/gruff/store/xy_pointsizes_data.rbs +61 -0
  97. data/sig/generated/gruff/themes.rbs +24 -0
  98. data/sig/generated/gruff/version.rbs +5 -0
  99. data/sig/generated/gruff.rbs +20 -0
  100. metadata +43 -1
@@ -0,0 +1,672 @@
1
+ # Generated from lib/gruff/base.rb with RBS::Inline
2
+
3
+ # #
4
+ # = Gruff. Graphs.
5
+ #
6
+ # Author:: Geoffrey Grosenbach boss@topfunky.com
7
+ #
8
+ # Originally Created:: October 23, 2005
9
+ #
10
+ # Extra thanks to Tim Hunter for writing RMagick, and also contributions by
11
+ # Jarkko Laine, Mike Perham, Andreas Schwarz, Alun Eyre, Guillaume Theoret,
12
+ # David Stokar, Paul Rogers, Dave Woodward, Frank Oxener, Kevin Clark, Cies
13
+ # Breijs, Richard Cowin, and a cast of thousands.
14
+ #
15
+ # See {Gruff::Base#theme=} for setting themes.
16
+ module Gruff
17
+ # A common base class inherited from class of drawing a graph.
18
+ class Base
19
+ # Space around text elements. Mostly used for vertical spacing.
20
+ LEGEND_MARGIN: ::Float
21
+
22
+ TITLE_MARGIN: ::Float
23
+
24
+ LABEL_MARGIN: ::Float
25
+
26
+ DEFAULT_MARGIN: ::Float
27
+
28
+ DEFAULT_TARGET_WIDTH: ::Float
29
+
30
+ # Blank space between graph and labels. Default is +15+.
31
+ attr_writer label_margin: Float | Integer
32
+
33
+ # Blank space above the graph. Default is +20+.
34
+ attr_writer top_margin: Float | Integer
35
+
36
+ # Blank space below the graph. Default is +20+.
37
+ attr_writer bottom_margin: Float | Integer
38
+
39
+ # Blank space to the right of the graph. Default is +20+.
40
+ attr_writer right_margin: Float | Integer
41
+
42
+ # Blank space to the left of the graph. Default is +20+.
43
+ attr_writer left_margin: Float | Integer
44
+
45
+ # Blank space below the title. Default is +20+.
46
+ attr_writer title_margin: Float | Integer
47
+
48
+ # Blank space below the legend. Default is +20+.
49
+ attr_writer legend_margin: Float | Integer
50
+
51
+ # Truncates labels if longer than max specified.
52
+ attr_writer label_max_size: Float | Integer
53
+
54
+ # How truncated labels visually appear if they exceed {#label_max_size=}.
55
+ #
56
+ # - +:absolute+ - does not show trailing dots to indicate truncation. This is the default.
57
+ # - +:trailing_dots+ - shows trailing dots to indicate truncation (note that {#label_max_size=}
58
+ # must be greater than 3).
59
+ attr_writer label_truncation_style: :absolute | :trailing_dots
60
+
61
+ # Set a label for the bottom of the graph.
62
+ attr_writer x_axis_label: String
63
+
64
+ # Set a label for the left side of the graph.
65
+ attr_writer y_axis_label: String
66
+
67
+ # Allow passing lambda to format labels for x axis.
68
+ attr_writer x_axis_label_format: Proc
69
+
70
+ # Allow passing lambda to format labels for y axis.
71
+ attr_writer y_axis_label_format: Proc
72
+
73
+ # Set increment of the vertical marking lines.
74
+ attr_writer x_axis_increment: Float | Integer
75
+
76
+ # Set increment of the horizontal marking lines.
77
+ attr_writer y_axis_increment: Float | Integer
78
+
79
+ # Get or set the list of colors that will be used to draw the bars or lines.
80
+ attr_accessor colors: [ String ]
81
+
82
+ # Prevent drawing of line markers. Default is +false+.
83
+ attr_writer hide_line_markers: bool
84
+
85
+ # Prevent drawing of the legend. Default is +false+.
86
+ attr_writer hide_legend: bool
87
+
88
+ # Prevent drawing of the title. Default is +false+.
89
+ attr_writer hide_title: bool
90
+
91
+ # Prevent drawing of line numbers. Default is +false+.
92
+ attr_writer hide_line_numbers: bool
93
+
94
+ # Set a message shown when there is no data. Fits up to 20 characters. Defaults
95
+ # to +"No Data."+.
96
+ attr_writer no_data_message: String
97
+
98
+ # Set the color of the auxiliary lines.
99
+ attr_writer marker_color: String
100
+
101
+ # Set the shadow color of the auxiliary lines.
102
+ attr_writer marker_shadow_color: String
103
+
104
+ # Set the number of horizontal lines shown for reference.
105
+ attr_writer marker_count: Float | Integer
106
+
107
+ # Set to +true+ if you want the data sets sorted with largest avg values drawn
108
+ # first. Default is +false+.
109
+ attr_writer sort: bool
110
+
111
+ # Set to +true+ if you want the data sets drawn with largest avg values drawn
112
+ # first. This does not affect the legend. Default is +false+.
113
+ attr_writer sorted_drawing: bool
114
+
115
+ # Display the legend under the graph. Default is +false+.
116
+ attr_writer legend_at_bottom: bool
117
+
118
+ # Optionally set the size of the colored box by each item in the legend.
119
+ # Default is +20.0+.
120
+ #
121
+ # Will be scaled down if graph is smaller than 800px wide.
122
+ attr_writer legend_box_size: Float | Integer
123
+
124
+ # If one numerical argument is given, the graph is drawn at 4/3 ratio
125
+ # according to the given width (+800+ results in 800x600, +400+ gives 400x300,
126
+ # etc.).
127
+ #
128
+ # Or, send a geometry string for other ratios ( +'800x400'+, +'400x225'+).
129
+ #
130
+ # @param target_width [Numeric, String] The graph image width.
131
+ #
132
+ # @rbs target_width: (String | Float | Integer)
133
+ # @rbs return: void
134
+ def initialize: (?String | Float | Integer target_width) -> void
135
+
136
+ def initialize_graph_scale: () -> untyped
137
+
138
+ def initialize_store: () -> untyped
139
+
140
+ # Initialize instance variable of attributes
141
+ #
142
+ # Subclasses can override this, call super, then set values separately.
143
+ #
144
+ # This makes it possible to set defaults in a subclass but still allow
145
+ # developers to change this values in their program.
146
+ def initialize_attributes: () -> untyped
147
+
148
+ # A hash of names for the individual columns, where the key is the array
149
+ # index for the column this label represents.
150
+ # Not all columns need to be named with hash.
151
+ #
152
+ # Or, an array corresponding to the data values.
153
+ #
154
+ # @param labels [Hash, Array] the labels.
155
+ # @rbs labels: (Hash[Integer, String] | [String | nil])
156
+ #
157
+ # @example
158
+ # g = Gruff::Bar.new
159
+ # g.labels = { 0 => '2005', 3 => '2006', 5 => '2007', 7 => '2008' }
160
+ #
161
+ # g = Gruff::Bar.new
162
+ # g.labels = ['2005', nil, nil, '2006', nil, nil, '2007', nil, nil, '2008'] # same labels for columns
163
+ def labels=: (Hash[Integer, String] | [ String | nil ] labels) -> untyped
164
+
165
+ # Set a rotation for labels. You can use Default is +0+.
166
+ # You can use a rotation between +0.0+ and +45.0+, or between +0.0+ and +-45.0+.
167
+ #
168
+ # @param rotation [Numeric] the rotation.
169
+ # @rbs rotation: Float | Integer
170
+ def label_rotation=: (Float | Integer rotation) -> untyped
171
+
172
+ # Height of staggering between labels.
173
+ # @deprecated
174
+ def label_stagger_height=: (untyped _value) -> untyped
175
+
176
+ # Set the large title of the graph displayed at the top.
177
+ # You can draw a multi-line title by putting a line break in the string
178
+ # or by setting an array as argument.
179
+ #
180
+ # @param title [String, Array] the title.
181
+ # @rbs title: (String | Array[String])
182
+ #
183
+ # @example
184
+ # g = Gruff::Bar.new
185
+ # g.title = "The graph title"
186
+ #
187
+ # g = Gruff::Bar.new
188
+ # g.title = ['The first line of title', 'The second line of title']
189
+ def title=: (String | Array[String] title) -> untyped
190
+
191
+ # Sets the top, bottom, left and right margins to +margin+.
192
+ #
193
+ # @param margin [Numeric] The margin size.
194
+ # @rbs margin: Float | Integer
195
+ def margins=: (Float | Integer margin) -> untyped
196
+
197
+ # Sets the font for graph text to the font at +font_path+.
198
+ #
199
+ # @param font_path [String] The path to font.
200
+ # @rbs font_path: String
201
+ def font=: (String font_path) -> untyped
202
+
203
+ # Same as {#font=} but for the title.
204
+ #
205
+ # @param font_path [String] The path to font.
206
+ # @rbs font_path: String
207
+ def title_font=: (String font_path) -> untyped
208
+
209
+ # Set the font size of the large title at the top of the graph. Default is +36+.
210
+ #
211
+ # @param value [Numeric] title font size
212
+ # @rbs value: Float | Integer
213
+ def title_font_size=: (Float | Integer value) -> untyped
214
+
215
+ # The font size of the labels around the graph. Default is +21+.
216
+ #
217
+ # @param value [Numeric] marker font size
218
+ # @rbs value: Float | Integer
219
+ def marker_font_size=: (Float | Integer value) -> untyped
220
+
221
+ # Optionally set the size of the font. Based on an 800x600px graph.
222
+ # Default is +20+.
223
+ #
224
+ # Will be scaled down if the graph is smaller than 800px wide.
225
+ #
226
+ # @param value [Numeric] legend font size
227
+ # @rbs value: Float | Integer
228
+ def legend_font_size=: (Float | Integer value) -> untyped
229
+
230
+ # Set the font size of the no data message. Default is +80+.
231
+ #
232
+ # @param value [Numeric] no data font size
233
+ # @rbs value: Float | Integer
234
+ def no_data_font_size=: (Float | Integer value) -> untyped
235
+
236
+ # Specifies whether to draw the title bolded or not. Default is +true+.
237
+ #
238
+ # @param value [Boolean] specifies whether to draw the title bolded or not.
239
+ # @rbs value: bool
240
+ def bold_title=: (bool value) -> untyped
241
+
242
+ # Specifies the text color.
243
+ #
244
+ # @param value [String] color
245
+ # @rbs value: String
246
+ def font_color=: (String value) -> untyped
247
+
248
+ # Add a color to the list of available colors for lines.
249
+ #
250
+ # @param colorname [String] The color.
251
+ # @rbs colorname: String
252
+ #
253
+ # @example
254
+ # add_color('#c0e9d3')
255
+ def add_color: (String colorname) -> untyped
256
+
257
+ # Replace the entire color list with a new array of colors. Also
258
+ # aliased as the {#colors=} setter method.
259
+ #
260
+ # If you specify fewer colors than the number of datasets you intend
261
+ # to draw, it will cycle through the array, reusing colors as needed.
262
+ #
263
+ # Note that (as with the {#theme=} method), you should set up your color
264
+ # list before you send your data (via the {#data} method). Calls to the
265
+ # {#data} method made prior to this call will use whatever color scheme
266
+ # was in place at the time data was called.
267
+ #
268
+ # @param color_list [Array] The array of colors.
269
+ # @rbs color_list: Array[String]
270
+ #
271
+ # @example
272
+ # replace_colors ['#cc99cc', '#d9e043', '#34d8a2']
273
+ def replace_colors: (?Array[String] color_list) -> untyped
274
+
275
+ # Set whether to make background transparent.
276
+ #
277
+ # @param value [Boolean] Specify whether to make background transparent.
278
+ # @rbs value: bool
279
+ def transparent_background=: (bool value) -> untyped
280
+
281
+ # You can set a theme manually. Assign a hash to this method before you
282
+ # send your data.
283
+ #
284
+ # g = Gruff::Bar.new
285
+ # g.theme = {
286
+ # colors: %w(orange purple green white red),
287
+ # marker_color: 'blue',
288
+ # background_colors: ['black', 'grey'],
289
+ # background_direction: :top_bottom
290
+ # }
291
+ #
292
+ # +background_colors+
293
+ # - Array<String> format value - background has gradation. (ex. +background_colors: ['black', 'grey']+)
294
+ # - String value - background has solid color. (ex. +background_colors: 'orange'+)
295
+ # - nil - background has transparent. (ex. +background_colors: nil+)
296
+ #
297
+ # +background_image+:
298
+ # - Specify the path to image file when it draw the image as background.
299
+ #
300
+ # +background_direction+ accepts one of following parameters.
301
+ # - +:top_bottom+
302
+ # - +:bottom_top+
303
+ # - +:left_right+
304
+ # - +:right_left+
305
+ # - +:topleft_bottomright+
306
+ # - +:topright_bottomleft+
307
+ #
308
+ # (Or hopefully something better looking than that.)
309
+ #
310
+ # @param options [Hash] The optional setting for theme
311
+ # @rbs options: Hash[Symbol, untyped]
312
+ def theme=: (Hash[Symbol, untyped] options) -> untyped
313
+
314
+ # Apply Apple's keynote theme.
315
+ def theme_keynote: () -> untyped
316
+
317
+ # Apply 37signals theme.
318
+ def theme_37signals: () -> untyped
319
+
320
+ # Apply Rails theme.
321
+ def theme_rails_keynote: () -> untyped
322
+
323
+ # Apply Odeo theme.
324
+ def theme_odeo: () -> untyped
325
+
326
+ # Apply pastel theme.
327
+ def theme_pastel: () -> untyped
328
+
329
+ # Apply greyscale theme.
330
+ def theme_greyscale: () -> untyped
331
+
332
+ # Input the data in the graph.
333
+ #
334
+ # Parameters are an array where the first element is the name of the dataset
335
+ # and the value is an array of values to plot.
336
+ #
337
+ # Can be called multiple times with different datasets for a multi-valued
338
+ # graph.
339
+ #
340
+ # If the color argument is nil, the next color from the default theme will
341
+ # be used.
342
+ #
343
+ # @param name [String, Symbol] The name of the dataset.
344
+ # @rbs name: (String | Symbol)
345
+ # @param data_points [Array] The array of dataset.
346
+ # @rbs data_points: Array[Float | Integer] | nil
347
+ # @param color [String] The color for drawing graph of dataset.
348
+ # @rbs color: String
349
+ #
350
+ # @note
351
+ # If you want to use a preset theme, you must set it before calling {#data}.
352
+ #
353
+ # @example
354
+ # data("Bart S.", [95, 45, 78, 89, 88, 76], '#ffcc00')
355
+ def data: (String | Symbol name, ?Array[Float | Integer] | nil data_points, ?String color) -> untyped
356
+
357
+ # You can manually set a minimum value instead of having the values
358
+ # guessed for you.
359
+ #
360
+ # Set it after you have given all your data to the graph object.
361
+ #
362
+ # @return [Float] The minimum value.
363
+ # @rbs return: Float
364
+ def minimum_value: () -> Float
365
+
366
+ attr_writer minimum_value: Float | Integer
367
+
368
+ # You can manually set a maximum value, such as a percentage-based graph
369
+ # that always goes to 100.
370
+ #
371
+ # If you use this, you must set it after you have given all your data to
372
+ # the graph object.
373
+ #
374
+ # @return [Float] The maximum value.
375
+ # @rbs return: Float
376
+ def maximum_value: () -> Float
377
+
378
+ attr_writer maximum_value: Float | Integer
379
+
380
+ # Writes the graph to a file. Defaults to +'graph.png'+
381
+ #
382
+ # @param file_name [String] The file name of output image.
383
+ # @rbs file_name: String
384
+ #
385
+ # @example
386
+ # write('graphs/my_pretty_graph.png')
387
+ def write: (?String file_name) -> untyped
388
+
389
+ # Return a rendered graph image.
390
+ # This can use RMagick's methods to adjust the image before saving.
391
+ #
392
+ # @param format [String] The output image format.
393
+ # @rbs format: String
394
+ #
395
+ # @return [Magick::Image] The rendered image.
396
+ # TODO: RBS signature
397
+ #
398
+ # @example
399
+ # g = Gruff::Line.new
400
+ # g.data :Jimmy, [25, 36, 86, 39, 25, 31, 79, 88]
401
+ # g.data :Charles, [80, 54, 67, 54, 68, 70, 90, 95]
402
+ # image = g.to_image
403
+ # image = image.resize(400, 300).quantize(128, Magick::RGBColorspace)
404
+ # image.write('test.png')
405
+ def to_image: (?String format) -> untyped
406
+
407
+ # Return the graph as a rendered binary blob.
408
+ #
409
+ # @param format [String] The image format of binary blob.
410
+ # @rbs format: String
411
+ #
412
+ # @return [String] The binary string.
413
+ # @rbs return: String
414
+ #
415
+ # @deprecated Please use +to_image.to_blob+ instead.
416
+ def to_blob: (?String format) -> String
417
+
418
+ # Draw a graph.
419
+ def draw: () -> untyped
420
+
421
+ attr_reader renderer: Gruff::Renderer
422
+
423
+ # Perform data manipulation before calculating chart measurements
424
+ def setup_data: () -> untyped
425
+
426
+ # Calculates size of drawable area and generates normalized data.
427
+ #
428
+ # * line markers
429
+ # * legend
430
+ # * title
431
+ def setup_drawing: () -> untyped
432
+
433
+ attr_reader store: Gruff::Store
434
+
435
+ # @rbs return: bool
436
+ def data_given?: () -> bool
437
+
438
+ # @rbs return: Integer
439
+ def column_count: () -> Integer
440
+
441
+ # @rbs return: Integer
442
+ def marker_count: () -> Integer
443
+
444
+ # Make copy of data with values scaled between 0-100
445
+ # @rbs return: Array[Gruff::Store::BasicData | Gruff::Store::XYData | Gruff::Store::XYPointsizeData]
446
+ def normalize: () -> Array[Gruff::Store::BasicData | Gruff::Store::XYData | Gruff::Store::XYPointsizeData]
447
+
448
+ def calculate_spread: () -> untyped
449
+
450
+ # @rbs return: bool
451
+ def hide_title?: () -> bool
452
+
453
+ # @rbs return: bool
454
+ def hide_labels?: () -> bool
455
+
456
+ # @rbs return: bool
457
+ def hide_left_label_area?: () -> bool
458
+
459
+ # @rbs return: bool
460
+ def hide_bottom_label_area?: () -> bool
461
+
462
+ def setup_graph_measurements: () -> untyped
463
+
464
+ # Draw the optional labels for the x axis and y axis.
465
+ def draw_axis_labels: () -> untyped
466
+
467
+ # Draws horizontal background lines and labels
468
+ def draw_line_markers: () -> untyped
469
+
470
+ def draw_marker_horizontal_line: (untyped y) -> untyped
471
+
472
+ def draw_marker_vertical_line: (untyped x, ?tick_mark_mode: untyped) -> untyped
473
+
474
+ # Return a calculation of center
475
+ # @rbs size: Float | Integer
476
+ # @rbs return: Float
477
+ def center: (Float | Integer size) -> Float
478
+
479
+ # Draws a legend with the names of the datasets matched
480
+ # to the colors used to draw them.
481
+ def draw_legend: () -> untyped
482
+
483
+ # Draws a title on the graph.
484
+ def draw_title: () -> untyped
485
+
486
+ # Draws column labels below graph, centered over x
487
+ #
488
+ # @rbs x: Float | Integer
489
+ # @rbs index: Integer
490
+ # @rbs gravity: untyped
491
+ # @rbs &: () -> void
492
+ def draw_label: (Float | Integer x, Integer index, ?untyped gravity) { () -> void } -> untyped
493
+
494
+ # @rbs index: Integer
495
+ # @rbs &: () -> void
496
+ def draw_unique_label: (Integer index) { () -> void } -> untyped
497
+
498
+ # @rbs width: Float | Integer
499
+ # @rbs height: Float | Integer
500
+ # @rbs x: Float | Integer
501
+ # @rbs y: Float | Integer
502
+ # @rbs text: String | _ToS
503
+ # @rbs gravity: untyped
504
+ # @rbs rotation: Float | Integer
505
+ def draw_label_at: (Float | Integer width, Float | Integer height, Float | Integer x, Float | Integer y, String | _ToS text, ?gravity: untyped, ?rotation: Float | Integer) -> untyped
506
+
507
+ # Draws the data value over the data point in bar graphs
508
+ #
509
+ # @rbs width: Float | Integer
510
+ # @rbs height: Float | Integer
511
+ # @rbs x_offset: Float | Integer
512
+ # @rbs y_offset: Float | Integer
513
+ # @rbs data_point: String | _ToS
514
+ # @rbs gravity: untyped
515
+ def draw_value_label: (Float | Integer width, Float | Integer height, Float | Integer x_offset, Float | Integer y_offset, String | _ToS data_point, ?gravity: untyped) -> untyped
516
+
517
+ # Shows an error message because you have no data.
518
+ def draw_no_data: () -> untyped
519
+
520
+ def draw_graph: () -> untyped
521
+
522
+ # Resets everything to defaults (except data).
523
+ def reset_themes: () -> untyped
524
+
525
+ # @rbs value: Float | Integer
526
+ # @rbs max_value: Float | Integer
527
+ # @rbs return: Float | Integer
528
+ def clip_value_if_greater_than: (Float | Integer value, Float | Integer max_value) -> (Float | Integer)
529
+
530
+ # @rbs i: Integer
531
+ # @rbs return: Integer | Float | BigDecimal
532
+ # TODO: Fix return RBS signature
533
+ def significant: (Integer i) -> (Integer | Float | BigDecimal)
534
+
535
+ # Sort with largest overall summed value at front of array.
536
+ def sort_data: () -> untyped
537
+
538
+ # Set the color for each data set unless it was given in the data(...) call.
539
+ def set_colors: () -> untyped
540
+
541
+ # Sort with largest overall summed value at front of array so it shows up
542
+ # correctly in the drawn graph.
543
+ def sort_norm_data: () -> untyped
544
+
545
+ private
546
+
547
+ # @rbs return: Float
548
+ def marker_caps_height: () -> Float
549
+
550
+ # @rbs return: Float
551
+ def labels_caps_height: () -> Float
552
+
553
+ # @rbs return: Float
554
+ def title_caps_height: () -> Float
555
+
556
+ # @rbs return: Float
557
+ def legend_caps_height: () -> Float
558
+
559
+ # @rbs return: Float | Integer
560
+ def setup_left_margin: () -> (Float | Integer)
561
+
562
+ # @rbs return: Float
563
+ def setup_right_margin: () -> Float
564
+
565
+ # @rbs return: Float | Integer
566
+ def extra_left_room_for_long_label: () -> (Float | Integer)
567
+
568
+ # @rbs return: Float | Integer
569
+ def extra_right_room_for_long_label: () -> (Float | Integer)
570
+
571
+ # @rbs return: bool
572
+ def require_extra_side_margin?: () -> bool
573
+
574
+ # @rbs return: Float
575
+ def setup_top_margin: () -> Float
576
+
577
+ # @rbs return: Float
578
+ def setup_bottom_margin: () -> Float
579
+
580
+ # @rbs text: String | _ToS
581
+ # @rbs return: String
582
+ def truncate_label_text: (String | _ToS text) -> String
583
+
584
+ # Return a formatted string representing a number value that should be
585
+ # printed as a label.
586
+ #
587
+ # @rbs value: Float | Integer | BigDecimal
588
+ # @rbs increment: Float | Integer | BigDecimal
589
+ # @rbs return: String
590
+ def label: (Float | Integer | BigDecimal value, Float | Integer | BigDecimal increment) -> String
591
+
592
+ # @rbs value: Float | Integer | BigDecimal
593
+ # @rbs increment: Float | Integer | BigDecimal
594
+ # @rbs return: String
595
+ def x_axis_label: (Float | Integer | BigDecimal value, Float | Integer | BigDecimal increment) -> String
596
+
597
+ # @rbs value: Float | Integer | BigDecimal
598
+ # @rbs increment: Float | Integer
599
+ # @rbs return: String
600
+ def y_axis_label: (Float | Integer | BigDecimal value, Float | Integer increment) -> String
601
+
602
+ # TODO: RBS signature
603
+ def calculate_legend_label_widths_for_each_line: (untyped legend_labels, untyped legend_square_width) -> untyped
604
+
605
+ # TODO: RBS signature
606
+ def calculate_legend_height: () -> untyped
607
+
608
+ # Returns the height of the capital letter 'X' for the current font and
609
+ # size.
610
+ #
611
+ # Not scaled since it deals with dimensions that the regular scaling will
612
+ # handle.
613
+ #
614
+ # @rbs font: Gruff::Font
615
+ # @rbs return: Float
616
+ def calculate_caps_height: (Gruff::Font font) -> Float
617
+
618
+ # @rbs font: Gruff::Font
619
+ # @rbs return: Float
620
+ def calculate_labels_height: (Gruff::Font font) -> Float
621
+
622
+ # Returns the height of a string at this point size.
623
+ #
624
+ # Not scaled since it deals with dimensions that the regular scaling will
625
+ # handle.
626
+ #
627
+ # @rbs font: Gruff::Font
628
+ # @rbs text: String
629
+ # @rbs rotation: Float | Integer
630
+ # @rbs return: Float
631
+ def calculate_height: (Gruff::Font font, String text, ?rotation: Float | Integer) -> Float
632
+
633
+ # Returns the width of a string at this point size.
634
+ #
635
+ # Not scaled since it deals with dimensions that the regular
636
+ # scaling will handle.
637
+ #
638
+ # @rbs font: Gruff::Font
639
+ # @rbs text: String
640
+ # @rbs rotation: Float | Integer
641
+ # @rbs return: Float | Integer
642
+ def calculate_width: (Gruff::Font font, String text, ?rotation: Float | Integer) -> (Float | Integer)
643
+
644
+ # @rbs font: Gruff::Font
645
+ # @rbs text: String
646
+ # @rbs rotation: Float | Integer
647
+ # @rbs return: untyped
648
+ def text_metrics: (Gruff::Font font, String text, ?rotation: Float | Integer) -> untyped
649
+
650
+ # @rbs return: Float | Integer | BigDecimal
651
+ def calculate_increment: () -> (Float | Integer | BigDecimal)
652
+
653
+ # @rbs font: Gruff::Font
654
+ # @rbs label: String
655
+ # @rbs margin: Float | Integer
656
+ # @rbs rotation: Float | Integer
657
+ # @rbs return: [Float | Integer, Float | Integer]
658
+ def calculate_label_offset: (Gruff::Font font, String label, Float | Integer margin, Float | Integer rotation) -> [ Float | Integer, Float | Integer ]
659
+
660
+ # Used for degree <=> radian conversions
661
+ # @rbs angle: Float | Integer
662
+ # @rbs return: Float
663
+ def deg2rad: (Float | Integer angle) -> Float
664
+
665
+ # @rbs angle: Float | Integer
666
+ # @rbs return: Float
667
+ def rad2deg: (Float | Integer angle) -> Float
668
+ end
669
+
670
+ class IncorrectNumberOfDatasetsException < StandardError
671
+ end
672
+ end
@@ -0,0 +1,24 @@
1
+ # Generated from lib/gruff/bezier.rb with RBS::Inline
2
+
3
+ #
4
+ # Gruff::Bezier is a special line graph that have
5
+ # the bezier curve.
6
+ #
7
+ # Here's how to set up a Gruff::Bezier.
8
+ #
9
+ # dataset = [
10
+ # +0.00, +0.09, +0.19, +0.29, +0.38, +0.47, +0.56, +0.64, +0.71, +0.78,
11
+ # +0.84, +0.89, +0.93, +0.96, +0.98, +0.99, +0.99, +0.99, +0.97, +0.94,
12
+ # +0.90, +0.86, +0.80, +0.74, +0.67, +0.59, +0.51, +0.42, +0.33, +0.23,
13
+ # +0.14, +0.04, -0.06, -0.16, -0.26, -0.36, -0.45, -0.53, -0.62, -0.69,
14
+ # -0.76, -0.82, -0.88, -0.92, -0.96, -0.98, -1.00, -1.00, -1.00, -0.99,
15
+ # -0.96, -0.93, -0.89, -0.84, -0.78, -0.71, -0.64, -0.56, -0.47, -0.38,
16
+ # ]
17
+ # g = Gruff::Bezier.new
18
+ # g.data 'sin', dataset
19
+ # g.write('bezier.png')
20
+ class Gruff::Bezier < Gruff::Base
21
+ private
22
+
23
+ def draw_graph: () -> untyped
24
+ end