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 #zero_degree=.
Direct Known Subclasses
Constant Summary collapse
- DEFAULT_TEXT_OFFSET_PERCENTAGE =
0.15
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.
-
#text_offset_percentage ⇒ Object
writeonly
Affect the distance between the percentages and the pie chart.
-
#zero_degree ⇒ Object
writeonly
Can be used to make the pie start cutting slices at the top (-90.0) or at another angle.
Attributes inherited from Base
#bottom_margin, #center_labels_over_point, #colors, #has_left_labels, #hide_legend, #hide_line_markers, #hide_line_numbers, #hide_title, #label_max_size, #label_stagger_height, #label_truncation_style, #labels, #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, #title_margin, #top_margin, #x_axis_increment, #x_axis_label_format, #y_axis_increment, #y_axis_label_format
Method Summary
Methods inherited from Base
#add_color, #bold_title=, #data, #draw, #font=, #font_color=, #initialize, #legend_font_size=, #margins=, #marker_font_size=, #replace_colors, #theme=, #theme_37signals, #theme_greyscale, #theme_keynote, #theme_odeo, #theme_pastel, #theme_rails_keynote, #title_font=, #title_font_size=, #to_blob, #to_image, #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 |
#text_offset_percentage=(value) ⇒ Object (writeonly)
Affect the distance between the percentages and the pie chart. Defaults to 0.15
.
30 31 32 |
# File 'lib/gruff/pie.rb', line 30 def text_offset_percentage=(value) @text_offset_percentage = value end |
#zero_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 0.0
, which starts at 3 o’clock.
19 20 21 |
# File 'lib/gruff/pie.rb', line 19 def zero_degree=(value) @zero_degree = value end |