gruff 0.26.0-java → 0.27.0-java
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/ISSUE_TEMPLATE/report.yml +1 -1
- data/.github/workflows/ci.yml +37 -0
- data/.rubocop.yml +3 -0
- data/CHANGELOG.md +18 -1
- data/Gemfile +5 -0
- data/README.md +7 -1
- data/gruff.gemspec +1 -1
- data/lib/gruff/accumulator_bar.rb +3 -1
- data/lib/gruff/area.rb +5 -2
- data/lib/gruff/bar.rb +18 -9
- data/lib/gruff/base.rb +193 -68
- data/lib/gruff/bezier.rb +6 -3
- data/lib/gruff/box.rb +40 -16
- data/lib/gruff/bubble.rb +9 -2
- data/lib/gruff/bullet.rb +8 -1
- data/lib/gruff/candlestick.rb +30 -8
- data/lib/gruff/dot.rb +13 -3
- data/lib/gruff/font.rb +12 -4
- data/lib/gruff/helper/bar_conversion.rb +12 -1
- data/lib/gruff/helper/bar_mixin.rb +19 -1
- data/lib/gruff/helper/bar_value_label.rb +22 -4
- data/lib/gruff/helper/stacked_mixin.rb +21 -1
- data/lib/gruff/histogram.rb +14 -5
- data/lib/gruff/line.rb +31 -12
- data/lib/gruff/mini/bar.rb +2 -2
- data/lib/gruff/mini/legend.rb +10 -1
- data/lib/gruff/mini/pie.rb +2 -2
- data/lib/gruff/mini/side_bar.rb +2 -2
- data/lib/gruff/net.rb +12 -7
- data/lib/gruff/patch/rmagick.rb +2 -0
- data/lib/gruff/patch/string.rb +1 -1
- data/lib/gruff/pie.rb +46 -11
- data/lib/gruff/renderer/bezier.rb +7 -0
- data/lib/gruff/renderer/circle.rb +11 -0
- data/lib/gruff/renderer/dash_line.rb +11 -0
- data/lib/gruff/renderer/dot.rb +11 -0
- data/lib/gruff/renderer/ellipse.rb +12 -0
- data/lib/gruff/renderer/line.rb +10 -0
- data/lib/gruff/renderer/polygon.rb +6 -0
- data/lib/gruff/renderer/polyline.rb +8 -0
- data/lib/gruff/renderer/rectangle.rb +11 -0
- data/lib/gruff/renderer/renderer.rb +16 -5
- data/lib/gruff/renderer/text.rb +19 -2
- data/lib/gruff/scatter.rb +16 -8
- data/lib/gruff/side_bar.rb +19 -10
- data/lib/gruff/side_stacked_bar.rb +15 -11
- data/lib/gruff/spider.rb +9 -2
- data/lib/gruff/stacked_area.rb +6 -1
- data/lib/gruff/stacked_bar.rb +16 -10
- data/lib/gruff/store/basic_data.rb +36 -2
- data/lib/gruff/store/store.rb +16 -3
- data/lib/gruff/store/xy_data.rb +32 -2
- data/lib/gruff/store/xy_pointsizes_data.rb +36 -3
- data/lib/gruff/themes.rb +2 -0
- data/lib/gruff/version.rb +3 -1
- data/lib/gruff.rb +3 -1
- data/sig/generated/gruff/accumulator_bar.rbs +19 -0
- data/sig/generated/gruff/area.rbs +27 -0
- data/sig/generated/gruff/bar.rbs +74 -0
- data/sig/generated/gruff/base.rbs +672 -0
- data/sig/generated/gruff/bezier.rbs +24 -0
- data/sig/generated/gruff/box.rbs +88 -0
- data/sig/generated/gruff/bubble.rbs +69 -0
- data/sig/generated/gruff/bullet.rbs +30 -0
- data/sig/generated/gruff/candlestick.rbs +79 -0
- data/sig/generated/gruff/dot.rbs +44 -0
- data/sig/generated/gruff/font.rbs +35 -0
- data/sig/generated/gruff/helper/bar_conversion.rbs +27 -0
- data/sig/generated/gruff/helper/bar_mixin.rbs +22 -0
- data/sig/generated/gruff/helper/bar_value_label.rbs +41 -0
- data/sig/generated/gruff/helper/stacked_mixin.rbs +27 -0
- data/sig/generated/gruff/histogram.rbs +42 -0
- data/sig/generated/gruff/line.rbs +165 -0
- data/sig/generated/gruff/net.rbs +52 -0
- data/sig/generated/gruff/pie.rbs +131 -0
- data/sig/generated/gruff/renderer/bezier.rbs +15 -0
- data/sig/generated/gruff/renderer/circle.rbs +19 -0
- data/sig/generated/gruff/renderer/dash_line.rbs +19 -0
- data/sig/generated/gruff/renderer/dot.rbs +27 -0
- data/sig/generated/gruff/renderer/ellipse.rbs +20 -0
- data/sig/generated/gruff/renderer/line.rbs +24 -0
- data/sig/generated/gruff/renderer/polyline.rbs +16 -0
- data/sig/generated/gruff/renderer/rectangle.rbs +19 -0
- data/sig/generated/gruff/renderer/renderer.rbs +43 -0
- data/sig/generated/gruff/renderer/text.rbs +38 -0
- data/sig/generated/gruff/scatter.rbs +112 -0
- data/sig/generated/gruff/side_bar.rbs +78 -0
- data/sig/generated/gruff/side_stacked_bar.rbs +52 -0
- data/sig/generated/gruff/spider.rbs +50 -0
- data/sig/generated/gruff/stacked_area.rbs +25 -0
- data/sig/generated/gruff/stacked_bar.rbs +56 -0
- data/sig/generated/gruff/store/basic_data.rbs +48 -0
- data/sig/generated/gruff/store/store.rbs +53 -0
- data/sig/generated/gruff/store/xy_data.rbs +58 -0
- data/sig/generated/gruff/store/xy_pointsizes_data.rbs +61 -0
- data/sig/generated/gruff/themes.rbs +24 -0
- data/sig/generated/gruff/version.rbs +5 -0
- data/sig/generated/gruff.rbs +20 -0
- metadata +51 -6
@@ -0,0 +1,88 @@
|
|
1
|
+
# Generated from lib/gruff/box.rb with RBS::Inline
|
2
|
+
|
3
|
+
#
|
4
|
+
# Here's how to set up a Gruff::Box.
|
5
|
+
#
|
6
|
+
# g = Gruff::Box.new
|
7
|
+
# g.data "A", [2, 3, 5, 6, 8, 10, 11, 15, 17, 20, 28, 29, 33, 34, 45, 46, 49, 61]
|
8
|
+
# g.data "B", [3, 4, 34, 35, 38, 39, 45, 60, 61, 69, 80, 130]
|
9
|
+
# g.data "C", [4, 40, 41, 46, 57, 64, 77, 76, 79, 78, 99, 153]
|
10
|
+
# g.write("box_plot.png")
|
11
|
+
class Gruff::Box < Gruff::Base
|
12
|
+
# Specifies the filling opacity in area graph. Default is +0.2+.
|
13
|
+
attr_writer fill_opacity: Float | Integer
|
14
|
+
|
15
|
+
# Specifies the stroke width in line. Default is +3.0+.
|
16
|
+
attr_writer stroke_width: Float | Integer
|
17
|
+
|
18
|
+
# Can be used to adjust the spaces between the bars.
|
19
|
+
# Accepts values between 0.00 and 1.00 where 0.00 means no spacing at all
|
20
|
+
# and 1 means that each bars' width is nearly 0 (so each bar is a simple
|
21
|
+
# line with no x dimension).
|
22
|
+
#
|
23
|
+
# Default value is +0.8+.
|
24
|
+
#
|
25
|
+
# @rbs space_percent: Float | Integer
|
26
|
+
def spacing_factor=: (Float | Integer space_percent) -> untyped
|
27
|
+
|
28
|
+
private
|
29
|
+
|
30
|
+
def initialize_attributes: () -> untyped
|
31
|
+
|
32
|
+
def draw_graph: () -> untyped
|
33
|
+
|
34
|
+
def normalized_boxes: () -> untyped
|
35
|
+
|
36
|
+
# @rbs return: Integer
|
37
|
+
def column_count: () -> Integer
|
38
|
+
|
39
|
+
# @rbs return: Integer
|
40
|
+
def calculate_spacing: () -> Integer
|
41
|
+
|
42
|
+
# @private
|
43
|
+
class BoxData
|
44
|
+
attr_accessor label: String
|
45
|
+
|
46
|
+
attr_accessor points: Array[Float | Integer]
|
47
|
+
|
48
|
+
attr_accessor color: String
|
49
|
+
|
50
|
+
def initialize: (untyped label, untyped points, untyped color) -> untyped
|
51
|
+
|
52
|
+
# @rbs return: Float | Integer
|
53
|
+
def min: () -> (Float | Integer)
|
54
|
+
|
55
|
+
# @rbs return: Float | Integer
|
56
|
+
def max: () -> (Float | Integer)
|
57
|
+
|
58
|
+
# @rbs return: Float | Integer
|
59
|
+
def min_whisker: () -> (Float | Integer)
|
60
|
+
|
61
|
+
# @rbs return: Float | Integer
|
62
|
+
def max_whisker: () -> (Float | Integer)
|
63
|
+
|
64
|
+
# @rbs return: Float | Integer
|
65
|
+
def upper_whisker: () -> (Float | Integer)
|
66
|
+
|
67
|
+
# @rbs return: Float | Integer
|
68
|
+
def lower_whisker: () -> (Float | Integer)
|
69
|
+
|
70
|
+
# @rbs return: Float
|
71
|
+
def median: () -> Float
|
72
|
+
|
73
|
+
# @rbs return: Float
|
74
|
+
def first_quartile: () -> Float
|
75
|
+
|
76
|
+
# @rbs return: Float
|
77
|
+
def third_quartile: () -> Float
|
78
|
+
|
79
|
+
# @rbs return: Array[Float | Integer]
|
80
|
+
def lower_outliers: () -> Array[Float | Integer]
|
81
|
+
|
82
|
+
# @rbs return: Array[Float | Integer]
|
83
|
+
def upper_outliers: () -> Array[Float | Integer]
|
84
|
+
|
85
|
+
# @rbs return: Float | Integer
|
86
|
+
def interquartile_range: () -> (Float | Integer)
|
87
|
+
end
|
88
|
+
end
|
@@ -0,0 +1,69 @@
|
|
1
|
+
# Generated from lib/gruff/bubble.rb with RBS::Inline
|
2
|
+
|
3
|
+
#
|
4
|
+
# Here's how to set up a Gruff::Bubble.
|
5
|
+
#
|
6
|
+
# g = Gruff::Bubble.new
|
7
|
+
# g.title = 'Bubble plot'
|
8
|
+
# g.write('bubble.png')
|
9
|
+
class Gruff::Bubble < Gruff::Scatter
|
10
|
+
# Specifies the filling opacity in area graph. Default is +0.6+.
|
11
|
+
attr_writer fill_opacity: Float | Integer
|
12
|
+
|
13
|
+
# Specifies the stroke width in line. Default is +1.0+.
|
14
|
+
attr_writer stroke_width: Float | Integer
|
15
|
+
|
16
|
+
# The first parameter is the name of the dataset. The next two are the
|
17
|
+
# x and y axis data points contain in their own array in that respective
|
18
|
+
# order. The 4th argument represents sizes of points.
|
19
|
+
# The final parameter is the color.
|
20
|
+
#
|
21
|
+
# Can be called multiple times with different datasets for a multi-valued
|
22
|
+
# graph.
|
23
|
+
#
|
24
|
+
# If the color argument is nil, the next color from the default theme will
|
25
|
+
# be used.
|
26
|
+
#
|
27
|
+
# @note If you want to use a preset theme, you must set it before calling {#data}.
|
28
|
+
#
|
29
|
+
# @param name [String, Symbol] containing the name of the dataset.
|
30
|
+
# @param x_data_points [Array] An Array of x-axis data points.
|
31
|
+
# @param y_data_points [Array] An Array of y-axis data points.
|
32
|
+
# @param point_sizes [Array] An Array of sizes for points.
|
33
|
+
# @param color [String] The hex string for the color of the dataset. Defaults to nil.
|
34
|
+
#
|
35
|
+
# @raise [ArgumentError] Data points contain nil values.
|
36
|
+
# This error will get raised if either the x or y axis data points array
|
37
|
+
# contains a +nil+ value. The graph will not make an assumption
|
38
|
+
# as how to graph +nil+.
|
39
|
+
# @raise [ArgumentError] +x_data_points+ is empty.
|
40
|
+
# This error is raised when the array for the x-axis points are empty
|
41
|
+
# @raise [ArgumentError] +y_data_points+ is empty.
|
42
|
+
# This error is raised when the array for the y-axis points are empty.
|
43
|
+
# @raise [ArgumentError] +point_sizes+ is empty.
|
44
|
+
# This error is raised when the array for the point_sizes are empty
|
45
|
+
# @raise [ArgumentError] +x_data_points.length != y_data_points.length+.
|
46
|
+
# Error means that the x and y axis point arrays do not match in length.
|
47
|
+
# @raise [ArgumentError] +x_data_points.length != point_sizes.length+.
|
48
|
+
# Error means that the x and point_sizes arrays do not match in length.
|
49
|
+
#
|
50
|
+
# @example
|
51
|
+
# g = Gruff::Bubble.new
|
52
|
+
# g.title = "Bubble Graph"
|
53
|
+
# g.data :A, [-1, 19, -4, -23], [-35, 21, 23, -4], [4.5, 1.0, 2.1, 0.9]
|
54
|
+
#
|
55
|
+
# @rbs name: String | Symbol
|
56
|
+
# @rbs x_data_points: Array[nil | Float | Integer] | nil
|
57
|
+
# @rbs y_data_points: Array[nil | Float | Integer] | nil
|
58
|
+
# @rbs point_sizes: Array[nil | Float | Integer] | nil
|
59
|
+
# @rbs color: String
|
60
|
+
def data: (String | Symbol name, ?Array[nil | Float | Integer] | nil x_data_points, ?Array[nil | Float | Integer] | nil y_data_points, ?Array[nil | Float | Integer] | nil point_sizes, ?String color) -> untyped
|
61
|
+
|
62
|
+
private
|
63
|
+
|
64
|
+
def initialize_store: () -> untyped
|
65
|
+
|
66
|
+
def initialize_attributes: () -> untyped
|
67
|
+
|
68
|
+
def draw_graph: () -> untyped
|
69
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# Generated from lib/gruff/bullet.rb with RBS::Inline
|
2
|
+
|
3
|
+
#
|
4
|
+
# A bullet graph is a variation of a bar graph.
|
5
|
+
# http://en.wikipedia.org/wiki/Bullet_graph
|
6
|
+
#
|
7
|
+
# Here's how to set up a Gruff::Bullet.
|
8
|
+
#
|
9
|
+
# g = Gruff::Bullet.new
|
10
|
+
# g.title = 'Monthly Revenue'
|
11
|
+
# g.data 75, 100, { target: 80, low: 50, high: 90 }
|
12
|
+
# g.write('bullet.png')
|
13
|
+
class Gruff::Bullet < Gruff::Base
|
14
|
+
# @rbs target_width: String | Float | Integer
|
15
|
+
# @rbs return: void
|
16
|
+
def initialize: (?String | Float | Integer target_width) -> void
|
17
|
+
|
18
|
+
def initialize_attributes: () -> untyped
|
19
|
+
|
20
|
+
# @rbs value: Float | Integer
|
21
|
+
# @rbs maximum_value: Float | Integer
|
22
|
+
# @rbs options: Hash[Symbol, Float | Integer]
|
23
|
+
def data: (Float | Integer value, Float | Integer maximum_value, ?Hash[Symbol, Float | Integer] options) -> untyped
|
24
|
+
|
25
|
+
def draw: () -> untyped
|
26
|
+
|
27
|
+
private
|
28
|
+
|
29
|
+
def draw_title: () -> untyped
|
30
|
+
end
|
@@ -0,0 +1,79 @@
|
|
1
|
+
# Generated from lib/gruff/candlestick.rb with RBS::Inline
|
2
|
+
|
3
|
+
#
|
4
|
+
# Here's how to set up a Gruff::Candlestick.
|
5
|
+
#
|
6
|
+
# g = Gruff::Candlestick.new
|
7
|
+
# g.data low: 79.30, high: 93.10, open: 79.44, close: 91.20
|
8
|
+
# g.data low: 89.14, high: 106.42, open: 91.28, close: 106.26
|
9
|
+
# g.data low: 107.89, high: 131.00, open: 108.20, close: 129.04
|
10
|
+
# g.data low: 103.10, high: 137.98, open: 132.76, close: 115.81
|
11
|
+
# g.write("candlestick.png")
|
12
|
+
class Gruff::Candlestick < Gruff::Base
|
13
|
+
# Allow for vertical marker lines.
|
14
|
+
attr_writer show_vertical_markers: bool
|
15
|
+
|
16
|
+
# Specifies the filling opacity in area graph. Default is +0.4+.
|
17
|
+
attr_writer fill_opacity: Float | Integer
|
18
|
+
|
19
|
+
# Specifies the stroke width in line. Default is +2.0+.
|
20
|
+
attr_writer stroke_width: Float | Integer
|
21
|
+
|
22
|
+
# Specifies the color with up bar. Default is +'#579773'+.
|
23
|
+
attr_writer up_color: String
|
24
|
+
|
25
|
+
# Specifies the color with down bar. Default is +'#eb5242'+.
|
26
|
+
attr_writer down_color: String
|
27
|
+
|
28
|
+
# Can be used to adjust the spaces between the bars.
|
29
|
+
# Accepts values between 0.00 and 1.00 where 0.00 means no spacing at all
|
30
|
+
# and 1 means that each bars' width is nearly 0 (so each bar is a simple
|
31
|
+
# line with no x dimension).
|
32
|
+
#
|
33
|
+
# Default value is +0.9+.
|
34
|
+
#
|
35
|
+
# @rbs space_percent: Float | Integer
|
36
|
+
def spacing_factor=: (Float | Integer space_percent) -> untyped
|
37
|
+
|
38
|
+
# The sort feature is not supported in this graph.
|
39
|
+
def sort=: (untyped _value) -> untyped
|
40
|
+
|
41
|
+
# The sort feature is not supported in this graph.
|
42
|
+
def sorted_drawing=: (untyped _value) -> untyped
|
43
|
+
|
44
|
+
# @rbs low: Float | Integer
|
45
|
+
# @rbs high: Float | Integer
|
46
|
+
# @rbs open: Float | Integer
|
47
|
+
# @rbs close: Float | Integer
|
48
|
+
def data: (low: Float | Integer, high: Float | Integer, open: Float | Integer, close: Float | Integer) -> untyped
|
49
|
+
|
50
|
+
private
|
51
|
+
|
52
|
+
def initialize_attributes: () -> untyped
|
53
|
+
|
54
|
+
def draw_graph: () -> untyped
|
55
|
+
|
56
|
+
def normalized_candlesticks: () -> untyped
|
57
|
+
|
58
|
+
# @rbs return: Integer
|
59
|
+
def column_count: () -> Integer
|
60
|
+
|
61
|
+
# @rbs return: Integer
|
62
|
+
def calculate_spacing: () -> Integer
|
63
|
+
|
64
|
+
# @rbs return: bool
|
65
|
+
def show_marker_vertical_line?: () -> bool
|
66
|
+
|
67
|
+
# @private
|
68
|
+
class CandlestickData
|
69
|
+
attr_accessor low: untyped
|
70
|
+
|
71
|
+
attr_accessor high: untyped
|
72
|
+
|
73
|
+
attr_accessor open: untyped
|
74
|
+
|
75
|
+
attr_accessor close: untyped
|
76
|
+
|
77
|
+
def initialize: (untyped low, untyped high, untyped open, untyped close) -> untyped
|
78
|
+
end
|
79
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
# Generated from lib/gruff/dot.rb with RBS::Inline
|
2
|
+
|
3
|
+
#
|
4
|
+
# Graph with dots and labels along a vertical access.
|
5
|
+
# see: 'Creating More Effective Graphs' by Robbins
|
6
|
+
#
|
7
|
+
# Here's how to set up a Gruff::Dot.
|
8
|
+
#
|
9
|
+
# g = Gruff::Dot.new
|
10
|
+
# g.title = 'Dot Graph'
|
11
|
+
# g.data :Art, [0, 5, 8, 15]
|
12
|
+
# g.data :Philosophy, [10, 3, 2, 8]
|
13
|
+
# g.data :Science, [2, 15, 8, 11]
|
14
|
+
# g.write('dot.png')
|
15
|
+
class Gruff::Dot < Gruff::Base
|
16
|
+
# Prevent drawing of column labels below a stacked bar graph. Default is +false+.
|
17
|
+
attr_writer hide_labels: bool
|
18
|
+
|
19
|
+
# @rbs target_width: (String | Float | Integer)
|
20
|
+
# @rbs return: void
|
21
|
+
def initialize: (?String | Float | Integer target_width) -> void
|
22
|
+
|
23
|
+
private
|
24
|
+
|
25
|
+
def initialize_attributes: () -> untyped
|
26
|
+
|
27
|
+
# @rbs return: bool
|
28
|
+
def hide_labels?: () -> bool
|
29
|
+
|
30
|
+
# @rbs return: bool
|
31
|
+
def hide_left_label_area?: () -> bool
|
32
|
+
|
33
|
+
# @rbs return: bool
|
34
|
+
def hide_bottom_label_area?: () -> bool
|
35
|
+
|
36
|
+
def draw_graph: () -> untyped
|
37
|
+
|
38
|
+
# Instead of base class version, draws vertical background lines and label
|
39
|
+
def draw_line_markers: () -> untyped
|
40
|
+
|
41
|
+
# @rbs y_offset: Float | Integer
|
42
|
+
# @rbs index: Integer
|
43
|
+
def draw_label: (Float | Integer y_offset, Integer index) -> untyped
|
44
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# Generated from lib/gruff/font.rb with RBS::Inline
|
2
|
+
|
3
|
+
# Handle font setting to draw texts
|
4
|
+
class Gruff::Font
|
5
|
+
BOLD_PATH: untyped
|
6
|
+
|
7
|
+
REGULAR_PATH: untyped
|
8
|
+
|
9
|
+
# Get/set font path.
|
10
|
+
attr_accessor path: String
|
11
|
+
|
12
|
+
# Get/set font size.
|
13
|
+
attr_accessor size: Float | Integer
|
14
|
+
|
15
|
+
# Get/set font setting whether render bold text.
|
16
|
+
attr_accessor bold: bool
|
17
|
+
|
18
|
+
# Get/set font color.
|
19
|
+
attr_accessor color: String
|
20
|
+
|
21
|
+
# @rbs path: String | nil
|
22
|
+
# @rbs size: Float | Integer
|
23
|
+
# @rbs bold: bool
|
24
|
+
# @rbs color: String
|
25
|
+
def initialize: (?path: String | nil, ?size: Float | Integer, ?bold: bool, ?color: String) -> untyped
|
26
|
+
|
27
|
+
# Get font weight.
|
28
|
+
# @return [Magick::WeightType] font weight
|
29
|
+
# TODO: type annotation of return value
|
30
|
+
def weight: () -> untyped
|
31
|
+
|
32
|
+
# @private
|
33
|
+
# @rbs return: String
|
34
|
+
def file_path: () -> String
|
35
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# Generated from lib/gruff/helper/bar_conversion.rb with RBS::Inline
|
2
|
+
|
3
|
+
# #
|
4
|
+
# Original Author: David Stokar
|
5
|
+
#
|
6
|
+
# This class performs the y coordinates conversion for the bar class.
|
7
|
+
#
|
8
|
+
# There are three cases:
|
9
|
+
#
|
10
|
+
# 1. Bars all go from zero in positive direction
|
11
|
+
# 2. Bars all go from zero to negative direction
|
12
|
+
# 3. Bars either go from zero to positive or from zero to negative
|
13
|
+
#
|
14
|
+
# @private
|
15
|
+
class Gruff::BarConversion
|
16
|
+
# @rbs top: Float | Integer
|
17
|
+
# @rbs bottom: Float | Integer
|
18
|
+
# @rbs minimum_value: Float | Integer
|
19
|
+
# @rbs maximum_value: Float | Integer
|
20
|
+
# @rbs spread: Float | Integer
|
21
|
+
# @rbs return: void
|
22
|
+
def initialize: (top: Float | Integer, bottom: Float | Integer, minimum_value: Float | Integer, maximum_value: Float | Integer, spread: Float | Integer) -> void
|
23
|
+
|
24
|
+
# @rbs data_point: Float | Integer
|
25
|
+
# @rbs return: [Float, Float]
|
26
|
+
def get_top_bottom_scaled: (Float | Integer data_point) -> [ Float, Float ]
|
27
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# Generated from lib/gruff/helper/bar_mixin.rb with RBS::Inline
|
2
|
+
|
3
|
+
# @private
|
4
|
+
module Gruff::Base::BarMixin
|
5
|
+
# @rbs return: Array[Array[Gruff::Base::BarMixin::BarData]]
|
6
|
+
def normalized_group_bars: () -> Array[Array[Gruff::Base::BarMixin::BarData]]
|
7
|
+
|
8
|
+
# @private
|
9
|
+
class BarData
|
10
|
+
attr_accessor point: Float | Integer
|
11
|
+
|
12
|
+
attr_accessor value: nil | Float | Integer
|
13
|
+
|
14
|
+
attr_accessor color: String
|
15
|
+
|
16
|
+
# @rbs point: Float | Integer
|
17
|
+
# @rbs value: nil | Float | Integer
|
18
|
+
# @rbs color: String
|
19
|
+
# @rbs return: void
|
20
|
+
def initialize: (Float | Integer point, nil | Float | Integer value, String color) -> void
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
# Generated from lib/gruff/helper/bar_value_label.rb with RBS::Inline
|
2
|
+
|
3
|
+
# @private
|
4
|
+
module Gruff::BarValueLabel
|
5
|
+
# @private
|
6
|
+
#
|
7
|
+
# @rbs value: Float | Integer
|
8
|
+
# @rbs format: nil | String | Proc
|
9
|
+
# @rbs proc_text_metrics: Proc
|
10
|
+
# @rbs return: [String, untyped]
|
11
|
+
# TODO: Fix the return type
|
12
|
+
def self.metrics: (Float | Integer value, nil | String | Proc format, Proc proc_text_metrics) -> [ String, untyped ]
|
13
|
+
|
14
|
+
# @private
|
15
|
+
class Base
|
16
|
+
attr_reader coordinate: [ Float | Integer, Float | Integer, Float | Integer, Float | Integer ]
|
17
|
+
|
18
|
+
attr_reader value: Float | Integer
|
19
|
+
|
20
|
+
# @rbs coordinate: [nil | Float | Integer, nil | Float | Integer, nil | Float | Integer, nil | Float | Integer]
|
21
|
+
# @rbs value: Float | Integer
|
22
|
+
# @rbs return: void
|
23
|
+
def initialize: ([ nil | Float | Integer, nil | Float | Integer, nil | Float | Integer, nil | Float | Integer ] coordinate, Float | Integer value) -> void
|
24
|
+
end
|
25
|
+
|
26
|
+
# @private
|
27
|
+
class Bar < Base
|
28
|
+
# @rbs format: nil | String | Proc
|
29
|
+
# @rbs proc_text_metrics: Proc
|
30
|
+
# @rbs &: (Float | Integer, Float | Integer, String, Float, Float) -> void
|
31
|
+
def prepare_rendering: (nil | String | Proc format, Proc proc_text_metrics) { (Float | Integer, Float | Integer, String, Float, Float) -> void } -> untyped
|
32
|
+
end
|
33
|
+
|
34
|
+
# @private
|
35
|
+
class SideBar < Base
|
36
|
+
# @rbs format: nil | String | Proc
|
37
|
+
# @rbs proc_text_metrics: Proc
|
38
|
+
# @rbs &: (Float | Integer, Float | Integer, String, Float, Float) -> void
|
39
|
+
def prepare_rendering: (nil | String | Proc format, Proc proc_text_metrics) { (Float | Integer, Float | Integer, String, Float, Float) -> void } -> untyped
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# Generated from lib/gruff/helper/stacked_mixin.rb with RBS::Inline
|
2
|
+
|
3
|
+
# @private
|
4
|
+
module Gruff::Base::StackedMixin
|
5
|
+
# Used by StackedBar and child classes.
|
6
|
+
#
|
7
|
+
# tsal: moved from Base 03 FEB 2007
|
8
|
+
def calculate_maximum_by_stack: () -> untyped
|
9
|
+
|
10
|
+
# @rbs return: Array[Array[Gruff::Base::StackedMixin::BarData]]
|
11
|
+
def normalized_stacked_bars: () -> Array[Array[Gruff::Base::StackedMixin::BarData]]
|
12
|
+
|
13
|
+
# @private
|
14
|
+
class BarData
|
15
|
+
attr_accessor point: Float | Integer
|
16
|
+
|
17
|
+
attr_accessor value: Float | Integer
|
18
|
+
|
19
|
+
attr_accessor color: String
|
20
|
+
|
21
|
+
# @rbs point: Float | Integer
|
22
|
+
# @rbs value: Float | Integer
|
23
|
+
# @rbs color: String
|
24
|
+
# @rbs return: void
|
25
|
+
def initialize: (Float | Integer point, Float | Integer value, String color) -> void
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# Generated from lib/gruff/histogram.rb with RBS::Inline
|
2
|
+
|
3
|
+
#
|
4
|
+
# Here's how to set up a Gruff::Histogram.
|
5
|
+
#
|
6
|
+
# g = Gruff::Histogram.new
|
7
|
+
# g.title = 'Histogram Graph'
|
8
|
+
# g.minimum_bin = 10
|
9
|
+
# g.bin_width = 20
|
10
|
+
# g.data :A, [10, 10, 20, 30, 40, 40, 40, 40, 40, 40, 50, 10, 10, 10]
|
11
|
+
# g.data :B, [100, 100, 100, 100, 90, 90, 80, 30, 30, 30, 30, 30]
|
12
|
+
# g.write('histogram.png')
|
13
|
+
class Gruff::Histogram < Gruff::Bar
|
14
|
+
# Specifies interpolation between the min and max of the set. Default is +10+.
|
15
|
+
attr_writer bin_width: Float | Integer
|
16
|
+
|
17
|
+
# Specifies minimum value for bin.
|
18
|
+
attr_writer minimum_bin: Float | Integer
|
19
|
+
|
20
|
+
# Specifies maximum value for bin.
|
21
|
+
attr_writer maximum_bin: Float | Integer
|
22
|
+
|
23
|
+
# @rbs target_width: (String | Float | Integer)
|
24
|
+
# @rbs return: void
|
25
|
+
def initialize: (?String | Float | Integer target_width) -> void
|
26
|
+
|
27
|
+
# @rbs name: String | Symbol
|
28
|
+
# @rbs data_points: Array[Float | Integer] | nil
|
29
|
+
# @rbs color: String
|
30
|
+
def data: (String | Symbol name, ?Array[Float | Integer] | nil data_points, ?String color) -> untyped
|
31
|
+
|
32
|
+
private
|
33
|
+
|
34
|
+
def initialize_attributes: () -> untyped
|
35
|
+
|
36
|
+
def setup_data: () -> untyped
|
37
|
+
|
38
|
+
# @private
|
39
|
+
# @rbs inherits Array[Float | Integer | nil]
|
40
|
+
class HistogramArray < Array[Float | Integer | nil]
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,165 @@
|
|
1
|
+
# Generated from lib/gruff/line.rb with RBS::Inline
|
2
|
+
|
3
|
+
#
|
4
|
+
# Here's how to make a Gruff::Line.
|
5
|
+
#
|
6
|
+
# g = Gruff::Line.new
|
7
|
+
# g.title = "A Line Graph"
|
8
|
+
# g.data 'Fries', [20, 23, 19, 8]
|
9
|
+
# g.data 'Hamburgers', [50, 19, 99, 29]
|
10
|
+
# g.write("line.png")
|
11
|
+
#
|
12
|
+
# There are also other options described below, such as {#baseline_value}, {#baseline_color},
|
13
|
+
# {#hide_dots=}, and {#hide_lines=}.
|
14
|
+
class Gruff::Line < Gruff::Base
|
15
|
+
# Allow for reference lines ( which are like baseline ... just allowing for more & on both axes ).
|
16
|
+
attr_accessor reference_lines: Hash[Symbol, untyped]
|
17
|
+
|
18
|
+
attr_writer reference_line_default_color: String
|
19
|
+
|
20
|
+
attr_writer reference_line_default_width: Float | Integer
|
21
|
+
|
22
|
+
# Allow for vertical marker lines.
|
23
|
+
attr_writer show_vertical_markers: bool
|
24
|
+
|
25
|
+
# Dimensions of lines and dots; calculated based on dataset size if left unspecified.
|
26
|
+
attr_writer line_width: Float | Integer
|
27
|
+
|
28
|
+
attr_writer dot_radius: Float | Integer
|
29
|
+
|
30
|
+
# default is +'circle'+, other options include +square+ and +diamond+.
|
31
|
+
attr_writer dot_style: :square | :circle | :diamond | "square" | "circle" | "diamond"
|
32
|
+
|
33
|
+
# Hide parts of the graph to fit more data points, or for a different appearance.
|
34
|
+
attr_writer hide_dots: bool
|
35
|
+
|
36
|
+
attr_writer hide_lines: bool
|
37
|
+
|
38
|
+
# accessors for support of xy data.
|
39
|
+
attr_writer minimum_x_value: Float
|
40
|
+
|
41
|
+
# accessors for support of xy data.
|
42
|
+
attr_writer maximum_x_value: Float
|
43
|
+
|
44
|
+
# The number of vertical lines shown.
|
45
|
+
attr_writer marker_x_count: Integer
|
46
|
+
|
47
|
+
# Call with target pixel width of graph (+800+, +400+, +300+), and/or +false+ to omit lines (points only).
|
48
|
+
#
|
49
|
+
# g = Gruff::Line.new(400) # 400px wide with lines
|
50
|
+
# g = Gruff::Line.new(400, false) # 400px wide, no lines (for backwards compatibility)
|
51
|
+
# g = Gruff::Line.new(false) # Defaults to 800px wide, no lines (for backwards compatibility)
|
52
|
+
#
|
53
|
+
# The preferred way is to call {#hide_dots=} or {#hide_lines=} instead.
|
54
|
+
#
|
55
|
+
# @rbs return: void
|
56
|
+
def initialize: (*untyped args) -> void
|
57
|
+
|
58
|
+
# Get the value if somebody has defined it.
|
59
|
+
#
|
60
|
+
# @rbs return: Float | Integer | nil
|
61
|
+
def baseline_value: () -> (Float | Integer | nil)
|
62
|
+
|
63
|
+
# Set a value for a baseline reference line..
|
64
|
+
#
|
65
|
+
# @rbs new_value: Float | Integer
|
66
|
+
def baseline_value=: (Float | Integer new_value) -> untyped
|
67
|
+
|
68
|
+
# @rbs return: Float | Integer | nil
|
69
|
+
def baseline_color: () -> (Float | Integer | nil)
|
70
|
+
|
71
|
+
# @rbs new_value: Float | Integer
|
72
|
+
def baseline_color=: (Float | Integer new_value) -> untyped
|
73
|
+
|
74
|
+
# Input the data in the graph.
|
75
|
+
#
|
76
|
+
# Parameters are an array where the first element is the name of the dataset
|
77
|
+
# and the value is an array of values to plot.
|
78
|
+
#
|
79
|
+
# Can be called multiple times with different datasets for a multi-valued
|
80
|
+
# graph.
|
81
|
+
#
|
82
|
+
# If the color argument is nil, the next color from the default theme will
|
83
|
+
# be used.
|
84
|
+
#
|
85
|
+
# @param name [String, Symbol] The name of the dataset.
|
86
|
+
# @rbs name: String | Symbol
|
87
|
+
# @param data_points [Array] The array of dataset.
|
88
|
+
# @rbs data_points: Array[nil | Float | Integer] | nil
|
89
|
+
# @param color [String] The color for drawing graph of dataset.
|
90
|
+
# @rbs color: String
|
91
|
+
#
|
92
|
+
# @note
|
93
|
+
# If you want to use a preset theme, you must set it before calling {#data}.
|
94
|
+
#
|
95
|
+
# @example
|
96
|
+
# data("Bart S.", [95, 45, 78, 89, 88, 76], '#ffcc00')
|
97
|
+
def data: (String | Symbol name, ?Array[nil | Float | Integer] | nil data_points, ?String color) -> untyped
|
98
|
+
|
99
|
+
# This method allows one to plot a dataset with both X and Y data.
|
100
|
+
#
|
101
|
+
# @overload dataxy(name, x_data_points = [], y_data_points = [], color = nil)
|
102
|
+
# @param name [String] the title of the dataset.
|
103
|
+
# @param x_data_points [Array] an array containing the x data points for the graph.
|
104
|
+
# @param y_data_points [Array] an array containing the y data points for the graph.
|
105
|
+
# @param color [String] hex number indicating the line color as an RGB triplet.
|
106
|
+
#
|
107
|
+
# @overload dataxy(name, xy_data_points = [], color = nil)
|
108
|
+
# @param name [String] the title of the dataset.
|
109
|
+
# @param xy_data_points [Array] an array containing both x and y data points for the graph.
|
110
|
+
# @param color [String] hex number indicating the line color as an RGB triplet.
|
111
|
+
#
|
112
|
+
# @note
|
113
|
+
# - if (x_data_points.length != y_data_points.length) an error is
|
114
|
+
# returned.
|
115
|
+
# - if the color argument is nil, the next color from the default theme will
|
116
|
+
# be used.
|
117
|
+
# - if you want to use a preset theme, you must set it before calling {#dataxy}.
|
118
|
+
#
|
119
|
+
# @example
|
120
|
+
# g = Gruff::Line.new
|
121
|
+
# g.title = "X/Y Dataset"
|
122
|
+
# g.dataxy("Apples", [1,3,4,5,6,10], [1, 2, 3, 4, 4, 3])
|
123
|
+
# g.dataxy("Bapples", [1,3,4,5,7,9], [1, 1, 2, 2, 3, 3])
|
124
|
+
# g.dataxy("Capples", [[1,1],[2,3],[3,4],[4,5],[5,7],[6,9]])
|
125
|
+
#
|
126
|
+
# # you can still use the old data method too if you want:
|
127
|
+
# g.data("Capples", [1, 1, 2, 2, 3, 3])
|
128
|
+
#
|
129
|
+
# # labels will be drawn at the x locations of the keys passed in.
|
130
|
+
# In this example the labels are drawn at x positions 2, 4, and 6:
|
131
|
+
# g.labels = {0 => '2003', 2 => '2004', 4 => '2005', 6 => '2006'}
|
132
|
+
# # The 0 => '2003' label will be ignored since it is outside the chart range.
|
133
|
+
#
|
134
|
+
# @rbs name: String | Symbol
|
135
|
+
# @rbs x_data_points: Array[nil | Float | Integer] | Array[[nil | Float | Integer, nil | Float | Integer]] | nil
|
136
|
+
# @rbs y_data_points: Array[nil | Float | Integer] | nil | String
|
137
|
+
# @rbs color: String
|
138
|
+
def dataxy: (String | Symbol name, ?Array[nil | Float | Integer] | Array[[ nil | Float | Integer, nil | Float | Integer ]] | nil x_data_points, ?Array[nil | Float | Integer] | nil | String y_data_points, ?String color) -> untyped
|
139
|
+
|
140
|
+
private
|
141
|
+
|
142
|
+
def initialize_store: () -> untyped
|
143
|
+
|
144
|
+
def initialize_attributes: () -> untyped
|
145
|
+
|
146
|
+
def draw_reference_line: (untyped reference_line, untyped left, untyped right, untyped top, untyped bottom) -> untyped
|
147
|
+
|
148
|
+
def draw_horizontal_reference_line: (untyped reference_line) -> untyped
|
149
|
+
|
150
|
+
def draw_vertical_reference_line: (untyped reference_line) -> untyped
|
151
|
+
|
152
|
+
def draw_graph: () -> untyped
|
153
|
+
|
154
|
+
def setup_data: () -> untyped
|
155
|
+
|
156
|
+
def setup_drawing: () -> untyped
|
157
|
+
|
158
|
+
def normalize: () -> untyped
|
159
|
+
|
160
|
+
def draw_line_markers: () -> untyped
|
161
|
+
|
162
|
+
def draw_label_for_x_data: (untyped x_data, untyped new_x, untyped index) -> untyped
|
163
|
+
|
164
|
+
def contains_one_point_only?: (untyped data_row) -> untyped
|
165
|
+
end
|