Sha256: 2c3a11e8a34511638d60ace60525de1c61ea04141722cfdbb3b3203e78fbc5cd

Contents?: true

Size: 886 Bytes

Versions: 10

Compression:

Stored size: 886 Bytes

Contents

# frozen_string_literal: true

#
# Makes a small side bar graph suitable for display at 200px or even smaller.
#
# Here's how to set up a Gruff::Mini::SideBar.
#
#   g = Gruff::Mini::SideBar.new
#   g.title = 'SideBar Graph'
#   g.labels = {
#     0 => '5/6',
#     1 => '5/15',
#     2 => '5/24',
#     3 => '5/30',
#   }
#   g.group_spacing = 20
#   g.data :Art, [0, 5, 8, 15]
#   g.data :Philosophy, [10, 3, 2, 8]
#   g.data :Science, [2, 15, 8, 11]
#   g.write('mini_sidebar.png')
#
class Gruff::Mini::SideBar < Gruff::SideBar
private

  include Gruff::Mini::Legend

  def initialize_attributes
    super
    @hide_legend = true
    @hide_title = true
    @hide_line_numbers = true

    @marker_font.size = 50.0
    @legend_font.size = 50.0
  end

  def setup_data
    expand_canvas_for_vertical_legend
    super
  end

  def draw_graph
    super
    draw_vertical_legend
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
gruff-0.24.0-java lib/gruff/mini/side_bar.rb
gruff-0.24.0 lib/gruff/mini/side_bar.rb
gruff-0.23.0 lib/gruff/mini/side_bar.rb
gruff-0.23.0-java lib/gruff/mini/side_bar.rb
gruff-0.22.0 lib/gruff/mini/side_bar.rb
gruff-0.22.0-java lib/gruff/mini/side_bar.rb
gruff-0.21.0-java lib/gruff/mini/side_bar.rb
gruff-0.21.0 lib/gruff/mini/side_bar.rb
gruff-0.20.0-java lib/gruff/mini/side_bar.rb
gruff-0.20.0 lib/gruff/mini/side_bar.rb