Class: Chart::Base
- Inherits:
-
Object
- Object
- Chart::Base
- Defined in:
- lib/chart/base.rb
Direct Known Subclasses
Bar, GroupedBar, Line, Pie
Instance Attribute Summary collapse
-
#angle ⇒ Object
Set the angle.
-
#colors ⇒ Object
Set bar colors.
-
#data ⇒ Object
Set the chart data.
-
#extra_fields ⇒ Object
Set extra fields for labels.
-
#height ⇒ Object
Set the chart height.
-
#inside ⇒ Object
Display label value inside bars (true|false).
-
#label_format ⇒ Object
Set label format.
-
#labels ⇒ Object
Labels attribute reader.
-
#legend ⇒ Object
Legend attribute reader.
-
#line_width ⇒ Object
Set line width.
-
#margins ⇒ Object
Set the chart left-top margins.
-
#multicolor ⇒ Object
Set if bar is multicolor.
-
#object ⇒ Object
The ChartDirector object.
-
#plot_area ⇒ Object
Set the plot area.
-
#plot_top_margin ⇒ Object
Set plot top margin.
-
#position ⇒ Object
Set position.
-
#radius ⇒ Object
Set radius.
-
#style ⇒ Object
Set style.
-
#symbols ⇒ Object
Set line symbols.
-
#width ⇒ Object
Set width.
Instance Method Summary collapse
-
#helper ⇒ Object
Wrapper to the ActionView helpers.
-
#initialize(options = {}) ⇒ Base
constructor
Initialize a new chart object.
-
#write(path) ⇒ Object
Save the chart image to the specified path.
Constructor Details
#initialize(options = {}) ⇒ Base
Initialize a new chart object. Specify the chart attributes by providing a hash.
90 91 92 93 94 |
# File 'lib/chart/base.rb', line 90 def initialize(={}) defaults! .each {|name, value| send("#{name}=", value)} instantiate end |
Instance Attribute Details
#angle ⇒ Object
Set the angle
77 78 79 |
# File 'lib/chart/base.rb', line 77 def angle @angle end |
#colors ⇒ Object
Set bar colors
47 48 49 |
# File 'lib/chart/base.rb', line 47 def colors @colors end |
#data ⇒ Object
Set the chart data
38 39 40 |
# File 'lib/chart/base.rb', line 38 def data @data end |
#extra_fields ⇒ Object
Set extra fields for labels
80 81 82 |
# File 'lib/chart/base.rb', line 80 def extra_fields @extra_fields end |
#height ⇒ Object
Set the chart height
29 30 31 |
# File 'lib/chart/base.rb', line 29 def height @height end |
#inside ⇒ Object
Display label value inside bars (true|false)
83 84 85 |
# File 'lib/chart/base.rb', line 83 def inside @inside end |
#label_format ⇒ Object
Set label format
62 63 64 |
# File 'lib/chart/base.rb', line 62 def label_format @label_format end |
#labels ⇒ Object
Labels attribute reader
108 109 110 |
# File 'lib/chart/base.rb', line 108 def labels @labels end |
#legend ⇒ Object
Legend attribute reader
113 114 115 |
# File 'lib/chart/base.rb', line 113 def legend @legend end |
#line_width ⇒ Object
Set line width
71 72 73 |
# File 'lib/chart/base.rb', line 71 def line_width @line_width end |
#margins ⇒ Object
Set the chart left-top margins
44 45 46 |
# File 'lib/chart/base.rb', line 44 def margins @margins end |
#multicolor ⇒ Object
Set if bar is multicolor
50 51 52 |
# File 'lib/chart/base.rb', line 50 def multicolor @multicolor end |
#object ⇒ Object
The ChartDirector object
86 87 88 |
# File 'lib/chart/base.rb', line 86 def object @object end |
#plot_area ⇒ Object
Set the plot area
41 42 43 |
# File 'lib/chart/base.rb', line 41 def plot_area @plot_area end |
#plot_top_margin ⇒ Object
Set plot top margin
53 54 55 |
# File 'lib/chart/base.rb', line 53 def plot_top_margin @plot_top_margin end |
#position ⇒ Object
Set position
56 57 58 |
# File 'lib/chart/base.rb', line 56 def position @position end |
#radius ⇒ Object
Set radius
59 60 61 |
# File 'lib/chart/base.rb', line 59 def radius @radius end |
#style ⇒ Object
Set style
65 66 67 |
# File 'lib/chart/base.rb', line 65 def style @style end |
#symbols ⇒ Object
Set line symbols
74 75 76 |
# File 'lib/chart/base.rb', line 74 def symbols @symbols end |
#width ⇒ Object
Set width
26 27 28 |
# File 'lib/chart/base.rb', line 26 def width @width end |
Instance Method Details
#helper ⇒ Object
Wrapper to the ActionView helpers
103 104 105 |
# File 'lib/chart/base.rb', line 103 def helper Helper.instance end |
#write(path) ⇒ Object
Save the chart image to the specified path
97 98 99 100 |
# File 'lib/chart/base.rb', line 97 def write(path) generate @object.makeChart(path) end |