Class Gruff::Pie
In: lib/gruff/pie.rb
Parent: Gruff::Base

Here‘s how to make a Pie graph:

  g = Gruff::Pie.new
  g.title = "Visual Pie Graph Test"
  g.data 'Fries', 20
  g.data 'Hamburgers', 50
  g.write("test/output/pie_keynote.png")

To control where the pie chart starts creating slices, use zero_degree.

Methods

Constants

DEFAULT_TEXT_OFFSET_PERCENTAGE = 0.15

Attributes

hide_labels_less_than  [RW]  Do not show labels for slices that are less than this percent. Use 0 to always show all labels. Defaults to 0
show_values_as_labels  [RW]  Use values instead of percentages
text_offset_percentage  [RW]  Affect the distance between the percentages and the pie chart Defaults to 0.15
zero_degree  [RW]  Can be used to make the pie start cutting slices at the top (-90.0) or at another angle. Default is 0.0, which starts at 3 o‘clock.

Public Instance methods

[Validate]