Class: Gruff::Bubble
Overview
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 Scatter
#circle_radius, #maximum_x_value, #minimum_x_value, #show_vertical_markers, #stroke_width
Attributes inherited from Base
#bottom_margin, #colors, #hide_legend, #hide_line_markers, #hide_line_numbers, #hide_title, #label_margin, #label_max_size, #label_truncation_style, #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_margin, #top_margin, #x_axis_increment, #x_axis_label_format, #y_axis_increment, #y_axis_label_format
Instance Method Summary collapse
-
#data(name, x_data_points = [], y_data_points = [], point_sizes = [], color = nil) ⇒ Object
The first parameter is the name of the dataset.
Methods inherited from Scatter
#disable_significant_rounding_x_axis=, #enable_vertical_line_markers=, #use_vertical_x_labels=, #x_label_margin=
Methods inherited from Base
#add_color, #bold_title=, #draw, #font=, #font_color=, #initialize, #label_rotation=, #label_stagger_height=, #labels=, #legend_font_size=, #margins=, #marker_font_size=, #replace_colors, #theme=, #theme_37signals, #theme_greyscale, #theme_keynote, #theme_odeo, #theme_pastel, #theme_rails_keynote, #title=, #title_font=, #title_font_size=, #to_blob, #to_image, #transparent_background=, #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.6
.
12 13 14 |
# File 'lib/gruff/bubble.rb', line 12 def fill_opacity=(value) @fill_opacity = value end |
#stroke_width=(value) ⇒ Object (writeonly)
Specifies the stroke width in line. Default is 1.0
.
15 16 17 |
# File 'lib/gruff/bubble.rb', line 15 def stroke_width=(value) @stroke_width = value end |
Instance Method Details
#data(name, x_data_points = [], y_data_points = [], point_sizes = [], color = nil) ⇒ Object
If you want to use a preset theme, you must set it before calling #data.
The first parameter is the name of the dataset. The next two are the x and y axis data points contain in their own array in that respective order. The 4th argument represents sizes of points. The final parameter is the color.
Can be called multiple times with different datasets for a multi-valued graph.
If the color argument is nil, the next color from the default theme will be used.
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/gruff/bubble.rb', line 56 def data(name, x_data_points = [], y_data_points = [], point_sizes = [], color = nil) # make sure it's an array x_data_points = Array(x_data_points) y_data_points = Array(y_data_points) point_sizes = Array(point_sizes) raise ArgumentError, 'Data Points contain nil Value!' if x_data_points.include?(nil) || y_data_points.include?(nil) raise ArgumentError, 'x_data_points is empty!' if x_data_points.empty? raise ArgumentError, 'y_data_points is empty!' if y_data_points.empty? raise ArgumentError, 'point_sizes is empty!' if point_sizes.empty? raise ArgumentError, 'x_data_points.length != y_data_points.length!' if x_data_points.length != y_data_points.length raise ArgumentError, 'x_data_points.length != point_sizes.length!' if x_data_points.length != point_sizes.length store.add(name, x_data_points, y_data_points, point_sizes, color) end |