Class: Chart::Bar
Instance Attribute Summary
Attributes inherited from Base
#colors, #data, #height, #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 |
# File 'lib/chart/bar.rb', line 8 def generate # set the plot area @object.setPlotArea(@margins[0], @margins[1], @plot_area[0], @plot_area[1], 0xe9e9e9, 0xf5f5f5) # set the legend position @object.addLegend(@margins[0], 0, false, "normal", 8).setBackground(ChartDirector::Transparent) # set the top margin @object.yAxis.setTopMargin(@plot_top_margin) # set the labels @object.xAxis.setLabels(@labels) # add data to layer if @multicolor @object.addBarLayer3(@data, @colors, @legend, 0) else @object.addBarLayer(@data, @colors.first) end end |
#instantiate ⇒ Object
3 4 5 6 |
# File 'lib/chart/bar.rb', line 3 def instantiate # instantiate a new chart @object = ChartDirector::XYChart.new(@width, @height) if @width && @height end |