Class: Gruff::Bar

Inherits:
Base
  • Object
show all
Defined in:
lib/gruff/bar.rb

Direct Known Subclasses

Mini::Bar

Constant Summary

Constants inherited from Base

Gruff::Base::DATA_COLOR_INDEX, Gruff::Base::DATA_LABEL_INDEX, Gruff::Base::DATA_VALUES_INDEX, Gruff::Base::DEBUG, Gruff::Base::DEFAULT_TARGET_WIDTH, Gruff::Base::LEGEND_MARGIN

Instance Attribute Summary

Attributes inherited from Base

#additional_line_values, #bottom_margin, #center_labels_over_point, #colors, #font, #font_color, #has_left_labels, #hide_legend, #hide_line_markers, #hide_line_numbers, #hide_title, #labels, #left_margin, #legend_box_size, #legend_font_size, #marker_color, #marker_count, #marker_font_size, #maximum_value, #minimum_value, #no_data_message, #right_margin, #sort, #stacked, #title, #title_font_size, #top_margin, #x_axis_label, #y_axis_increment, #y_axis_label

Instance Method Summary collapse

Methods inherited from Base

#add_color, #data, #initialize, #initialize_ivars, #margins=, #replace_colors, #theme=, #theme_37signals, #theme_greyscale, #theme_keynote, #theme_odeo, #theme_pastel, #theme_rails_keynote, #to_blob, #write

Methods included from Deprecated

#graph_height, #graph_left, #graph_top, #graph_width, #scale_measurements, #total_height

Constructor Details

This class inherits a constructor from Gruff::Base

Instance Method Details

#drawObject



6
7
8
9
10
11
12
13
14
15
16
# File 'lib/gruff/bar.rb', line 6

def draw
  # Labels will be centered over the left of the bar if
  # there are more labels than columns. This is basically the same 
  # as where it would be for a line graph.
  @center_labels_over_point = (@labels.keys.length > @column_count ? true : false)
  
  super
  return unless @has_data

  draw_bars
end