Class: Gruff::BoxPlot
Overview
Here’s how to set up a Gruff::BoxPlot.
g = Gruff::BoxPlot.new
g.data "A", [2, 3, 5, 6, 8, 10, 11, 15, 17, 20, 28, 29, 33, 34, 45, 46, 49, 61]
g.data "B", [3, 4, 34, 35, 38, 39, 45, 60, 61, 69, 80, 130]
g.data "C", [4, 40, 41, 46, 57, 64, 77, 76, 79, 78, 99, 153]
g.write("box_plot.png")
Constant Summary
Constants inherited from Base
Gruff::Base::DEFAULT_MARGIN, Gruff::Base::DEFAULT_TARGET_WIDTH, Gruff::Base::LABEL_MARGIN, Gruff::Base::LEGEND_MARGIN
Instance Attribute Summary collapse
-
#fill_opacity ⇒ Object
writeonly
Specifies the filling opacity in area graph.
-
#stroke_width ⇒ Object
writeonly
Specifies the stroke width in line.
Attributes inherited from Base
#bottom_margin, #colors, #hide_legend, #hide_line_markers, #hide_line_numbers, #hide_title, #label_max_size, #label_stagger_height, #label_truncation_style, #labels, #left_margin, #legend_at_bottom, #legend_box_size, #legend_margin, #marker_color, #marker_shadow_color, #maximum_value, #minimum_value, #no_data_message, #right_margin, #sort, #sorted_drawing, #title, #title_margin, #top_margin, #x_axis_increment, #x_axis_label_format, #y_axis_increment, #y_axis_label_format
Instance Method Summary collapse
-
#spacing_factor=(space_percent) ⇒ Object
Can be used to adjust the spaces between the bars.
Methods inherited from Base
#add_color, #bold_title=, #data, #draw, #font=, #font_color=, #initialize, #legend_font_size=, #margins=, #marker_font_size=, #replace_colors, #theme=, #theme_37signals, #theme_greyscale, #theme_keynote, #theme_odeo, #theme_pastel, #theme_rails_keynote, #title_font=, #title_font_size=, #to_blob, #to_image, #write
Constructor Details
This class inherits a constructor from Gruff::Base
Instance Attribute Details
#fill_opacity=(value) ⇒ Object (writeonly)
Specifies the filling opacity in area graph. Default is 0.2
.
14 15 16 |
# File 'lib/gruff/box_plot.rb', line 14 def fill_opacity=(value) @fill_opacity = value end |
#stroke_width=(value) ⇒ Object (writeonly)
Specifies the stroke width in line. Default is 3.0
.
17 18 19 |
# File 'lib/gruff/box_plot.rb', line 17 def stroke_width=(value) @stroke_width = value end |
Instance Method Details
#spacing_factor=(space_percent) ⇒ Object
Can be used to adjust the spaces between the bars. Accepts values between 0.00 and 1.00 where 0.00 means no spacing at all and 1 means that each bars’ width is nearly 0 (so each bar is a simple line with no x dimension).
Default value is 0.8
.
25 26 27 28 29 |
# File 'lib/gruff/box_plot.rb', line 25 def spacing_factor=(space_percent) raise ArgumentError, 'spacing_factor must be between 0.00 and 1.00' unless (space_percent >= 0) && (space_percent <= 1) @spacing_factor = (1 - space_percent) end |