Sha256: 30840ea16b2f4d8fe08d65ada0378a6874e79f575dba890a60c7996f1025575c

Contents?: true

Size: 850 Bytes

Versions: 10

Compression:

Stored size: 850 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
    # A class for drawing a small pie graph.
    class Pie < Gruff::Pie
    private

      include Gruff::Mini::Legend

      def initialize_attributes
        super

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

        @marker_font.size = 60.0
        @legend_font.size = 60.0
      end

      def setup_data
        expand_canvas_for_vertical_legend
        super
      end

      def draw_graph
        super
        draw_vertical_legend
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
gruff-0.18.0-java lib/gruff/mini/pie.rb
gruff-0.18.0 lib/gruff/mini/pie.rb
gruff-0.17.0-java lib/gruff/mini/pie.rb
gruff-0.17.0 lib/gruff/mini/pie.rb
gruff-0.16.0 lib/gruff/mini/pie.rb
gruff-0.16.0-java lib/gruff/mini/pie.rb
gruff-0.15.0-java lib/gruff/mini/pie.rb
gruff-0.15.0 lib/gruff/mini/pie.rb
gruff-0.14.0 lib/gruff/mini/pie.rb
gruff-0.14.0-java lib/gruff/mini/pie.rb