Class: Chart::Pie
Instance Attribute Summary
Attributes inherited from Base
#angle, #colors, #data, #extra_fields, #height, #inside, #label_format, #labels, #legend, #line_width, #margins, #multicolor, #object, #plot_area, #plot_top_margin, #position, #radius, #style, #symbols, #width
Instance Method Summary collapse
Methods inherited from Base
Constructor Details
This class inherits a constructor from Chart::Base
Instance Method Details
#generate ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/chart/pie.rb', line 8 def generate # set the pie size and position @object.setPieSize(@margins[0], @margins[1], @radius) # set data and labels @object.setData(@data, @legend) # set label format @object.setLabelFormat(@label_format) # hide label format if is nil @object.setLabelStyle("normal", 8, ChartDirector::Transparent) if @label_format.nil? # add legend box @object.addLegend(@position[0], @position[1]) # set colors @object.setColors2(ChartDirector::DataColor, @colors) # set label position @object.setLabelPos(15, ChartDirector::LineColor) # set label line color @object.setJoinLine(0x666666) end |
#instantiate ⇒ Object
3 4 5 6 |
# File 'lib/chart/pie.rb', line 3 def instantiate # instantiate a new chart @object = ChartDirector::PieChart.new(@width, @height) if @width && @height end |