Class: SVG::Graph::BarBase

Inherits:
Graph
  • Object
show all
Defined in:
lib/svg_graph/BarBase.rb

Overview

This software is available under the Ruby license

Direct Known Subclasses

Bar, BarHorizontal

Instance Attribute Summary collapse

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

Methods inherited from Graph

#add_data, #burn, #clear_data

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_gapObject

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
  @bar_gap
end

#stackObject

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_defaultsObject

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