Class: SVG::Graph::BarBase
Overview
This software is available under the Ruby license
Direct Known Subclasses
Instance Attribute Summary collapse
-
#bar_gap ⇒ Object
Whether to have a gap between the bars or not, default is true, set to false if you don’t want gaps.
-
#stack ⇒ Object
How to stack data sets.
Attributes inherited from Graph
#add_popups, #font_size, #graph_subtitle, #graph_title, #height, #key, #key_font_size, #key_position, #min_scale_value, #no_css, #rotate_x_labels, #rotate_y_labels, #scale_divisions, #scale_integers, #show_data_values, #show_graph_subtitle, #show_graph_title, #show_x_guidelines, #show_x_labels, #show_x_title, #show_y_guidelines, #show_y_labels, #show_y_title, #stagger_x_labels, #stagger_y_labels, #step_include_first_x_label, #step_x_labels, #style_sheet, #subtitle_font_size, #title_font_size, #width, #x_label_font_size, #x_title, #x_title_font_size, #y_label_font_size, #y_title, #y_title_font_size, #y_title_text_direction
Instance Method Summary collapse
-
#initialize(config) ⇒ BarBase
constructor
Ensures that :fields are provided in the configuration.
-
#set_defaults ⇒ Object
In addition to the defaults set in Graph::initialize, sets [bar_gap] true [stack] :overlap.
Methods inherited from Graph
Constructor Details
#initialize(config) ⇒ BarBase
Ensures that :fields are provided in the configuration.
20 21 22 23 24 25 |
# File 'lib/svg_graph/BarBase.rb', line 20 def initialize config raise "fields was not supplied or is empty" unless config[:fields] && config[:fields].kind_of?(Array) && config[:fields].length > 0 super end |
Instance Attribute Details
#bar_gap ⇒ Object
Whether to have a gap between the bars or not, default
is true, set to false if you don't want gaps.
36 37 38 |
# File 'lib/svg_graph/BarBase.rb', line 36 def @bar_gap end |
#stack ⇒ Object
How to stack data sets. :overlap overlaps bars with
transparent colors, :top stacks bars on top of one another,
:side stacks the bars side-by-side. Defaults to :overlap.
40 41 42 |
# File 'lib/svg_graph/BarBase.rb', line 40 def stack @stack end |
Instance Method Details
#set_defaults ⇒ Object
In addition to the defaults set in Graph::initialize, sets
- bar_gap
-
true
- stack
-
:overlap
30 31 32 |
# File 'lib/svg_graph/BarBase.rb', line 30 def set_defaults init_with( :bar_gap => true, :stack => :overlap ) end |