Sha256: 36aac47cf1f81097386db66020474b7a8bc854697b8aef9508eef0c61fd42129

Contents?: true

Size: 801 Bytes

Versions: 4

Compression:

Stored size: 801 Bytes

Contents

# frozen_string_literal: true

#
# Makes a small pie graph suitable for display at 200px or even smaller.
#
# Here's how to set up a Gruff::Mini::Pie.
#
#   g = Gruff::Mini::Pie.new
#   g.title = "Visual Pie Graph Test"
#   g.data 'Fries', 20
#   g.data 'Hamburgers', 50
#   g.write("mini_pie_keynote.png")
#
module Gruff
  module Mini
    class Pie < Gruff::Pie
      include Gruff::Mini::Legend

      def initialize_ivars
        super

        @hide_legend = true
        @hide_title = true
        @hide_line_numbers = true

        @marker_font_size = 60.0
        @legend_font_size = 60.0
      end
      private :initialize_ivars

      def draw
        expand_canvas_for_vertical_legend

        super

        draw_vertical_legend

        Gruff::Renderer.finish
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
gruff-0.11.0 lib/gruff/mini/pie.rb
gruff-0.11.0-java lib/gruff/mini/pie.rb
gruff-0.10.0 lib/gruff/mini/pie.rb
gruff-0.10.0-java lib/gruff/mini/pie.rb