Class: Gruff::Pie
Overview
Here’s how to make a Gruff::Pie.
g = Gruff::Pie.new
g.title = "Visual Pie Graph Test"
g.data 'Fries', 20
g.data 'Hamburgers', 50
g.write("pie_keynote.png")
To control where the pie chart starts creating slices, use #start_degree=.
Direct Known Subclasses
Constant Summary collapse
- DEFAULT_TEXT_OFFSET_PERCENTAGE =
0.1
Constants inherited from Base
Base::DEFAULT_MARGIN, Base::DEFAULT_TARGET_WIDTH, Base::LABEL_MARGIN, Base::LEGEND_MARGIN
Instance Attribute Summary collapse
-
#hide_labels_less_than ⇒ Object
writeonly
Do not show labels for slices that are less than this percent.
-
#label_formatting ⇒ Object
writeonly
Set the number output format lambda.
-
#show_values_as_labels ⇒ Object
writeonly
Use values instead of percentages.
-
#sort ⇒ Object
writeonly
Set to
true
if you want the data sets sorted with largest avg values drawn first. -
#start_degree ⇒ Object
writeonly
Can be used to make the pie start cutting slices at the top (-90.0) or at another angle.
-
#text_offset_percentage ⇒ Object
writeonly
Affect the distance between the percentages and the pie chart.
Attributes inherited from Base
#bottom_margin, #colors, #hide_legend, #hide_line_markers, #hide_line_numbers, #hide_title, #label_margin, #label_max_size, #label_truncation_style, #left_margin, #legend_at_bottom, #legend_box_size, #legend_margin, #marker_color, #marker_shadow_color, #maximum_value, #minimum_value, #no_data_message, #right_margin, #sort, #sorted_drawing, #title_margin, #top_margin, #x_axis_increment, #x_axis_label_format, #y_axis_increment, #y_axis_label_format
Instance Method Summary collapse
-
#zero_degree=(value) ⇒ Object
deprecated
Deprecated.
Please use #start_degree= instead.
Methods inherited from Base
#add_color, #bold_title=, #data, #draw, #font=, #font_color=, #initialize, #label_rotation=, #label_stagger_height=, #labels=, #legend_font_size=, #margins=, #marker_font_size=, #replace_colors, #theme=, #theme_37signals, #theme_greyscale, #theme_keynote, #theme_odeo, #theme_pastel, #theme_rails_keynote, #title=, #title_font=, #title_font_size=, #to_blob, #to_image, #transparent_background=, #write
Constructor Details
This class inherits a constructor from Gruff::Base
Instance Attribute Details
#hide_labels_less_than=(value) ⇒ Object (writeonly)
Do not show labels for slices that are less than this percent. Use 0 to always show all labels. Defaults to 0
.
26 27 28 |
# File 'lib/gruff/pie.rb', line 26 def hide_labels_less_than=(value) @hide_labels_less_than = value end |
#label_formatting=(value) ⇒ Object (writeonly)
Set the number output format lambda.
22 23 24 |
# File 'lib/gruff/pie.rb', line 22 def label_formatting=(value) @label_formatting = value end |
#show_values_as_labels=(value) ⇒ Object (writeonly)
Use values instead of percentages.
33 34 35 |
# File 'lib/gruff/pie.rb', line 33 def show_values_as_labels=(value) @show_values_as_labels = value end |
#sort=(value) ⇒ Object (writeonly)
Set to true
if you want the data sets sorted with largest avg values drawn first. Default is true
.
37 38 39 |
# File 'lib/gruff/pie.rb', line 37 def sort=(value) @sort = value end |
#start_degree=(value) ⇒ Object (writeonly)
Can be used to make the pie start cutting slices at the top (-90.0) or at another angle. Default is -90.0
, which starts at 3 o’clock.
19 20 21 |
# File 'lib/gruff/pie.rb', line 19 def start_degree=(value) @start_degree = value end |
#text_offset_percentage=(value) ⇒ Object (writeonly)
Affect the distance between the percentages and the pie chart. Defaults to 0.1
.
30 31 32 |
# File 'lib/gruff/pie.rb', line 30 def text_offset_percentage=(value) @text_offset_percentage = value end |
Instance Method Details
#zero_degree=(value) ⇒ Object
Please use #start_degree= instead.
Can be used to make the pie start cutting slices at the top (-90.0) or at another angle. Default is -90.0
, which starts at 3 o’clock.
42 43 44 45 |
# File 'lib/gruff/pie.rb', line 42 def zero_degree=(value) warn '#zero_degree= is deprecated. Please use `start_degree` attribute instead' @start_degree = value end |