Class: OpenFlashChart::Base
- Inherits:
-
Object
- Object
- OpenFlashChart::Base
show all
- Defined in:
- lib/plugins/open_flash_chart/lib/open_flash_chart/base.rb
Direct Known Subclasses
AreaBase, Bar3dValue, BarBase, BarGlassValue, BarOnShow, BarStackKey, BarStackValue, BarValue, BasePieAnimation, Candle, CandleValue, Chart, DotBase, DotValue, HBar, HBarValue, Legend, LineBase, LineOnShow, Menu, MenuItem, MenuItemCamera, OFCTag, OFCTags, Pie, PieValue, RadarAxis, RadarAxisLabels, RadarSpokeLabels, Scatter, ScatterLine, ScatterValue, Shape, ShapePoint, Title, Tooltip, XAxis, XAxisLabel, XAxisLabels, XLegend, YAxisBase, YAxisLabel, YAxisLabels, YLegend
Instance Method Summary
(collapse)
Constructor Details
- (Base) initialize(args = {}) {|_self| ... }
Returns a new instance of Base
[View source]
4
5
6
7
8
9
10
11
|
# File 'lib/plugins/open_flash_chart/lib/open_flash_chart/base.rb', line 4
def initialize(args={})
args.each do |k,v|
self.instance_variable_set("@#{k}", v)
end
yield self if block_given? end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
- (Object) method_missing(method_name, *args, &blk)
[View source]
107
108
109
110
111
112
113
114
115
116
117
118
119
120
|
# File 'lib/plugins/open_flash_chart/lib/open_flash_chart/base.rb', line 107
def method_missing(method_name, *args, &blk)
case method_name.to_s
when /(.*)=/ self.instance_variable_set("@#{$1}", args[0])
when /^set_(.*)/
self.instance_variable_set("@#{$1}", args[0])
else
super
end
end
|
Instance Method Details
- (Object) <<(e)
[View source]
60
61
62
|
# File 'lib/plugins/open_flash_chart/lib/open_flash_chart/base.rb', line 60
def <<(e)
add_element e
end
|
- (Object) add_element(element)
[View source]
55
56
57
58
|
# File 'lib/plugins/open_flash_chart/lib/open_flash_chart/base.rb', line 55
def add_element(element)
@elements ||= []
@elements << element
end
|
- (Object) append_value(v)
[View source]
69
70
71
72
|
# File 'lib/plugins/open_flash_chart/lib/open_flash_chart/base.rb', line 69
def append_value(v)
@values ||= []
@values << v
end
|
- (Object) attach_to_right_y_axis
[View source]
100
101
102
|
# File 'lib/plugins/open_flash_chart/lib/open_flash_chart/base.rb', line 100
def attach_to_right_y_axis
@axis = 'right'
end
|
- (Object) render
Also known as:
to_s
same as to_s but won't stack overflow … use this instead of to_s
[View source]
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
# File 'lib/plugins/open_flash_chart/lib/open_flash_chart/base.rb', line 14
def render
self.to_json2.tap do |output|
output.gsub!("threed","3d")
output.gsub!("default_dot_style","dot-style")
%w(font_size dot_size outline_colour halo_size start_angle tick_height grid_colour tick_length no_labels label_colour gradient_fill fill_alpha on_click spoke_labels visible_steps key_on_click barb_length on_show negative_colour line_style javascript_function_name pad_x pad_y align_x align_y dot_style hollow_dot).each do |replace|
output.gsub!(replace, replace.gsub("_", "-"))
end
end
end
|
- (Object) set_colours(colours, grid_colour)
[View source]
84
85
86
87
|
# File 'lib/plugins/open_flash_chart/lib/open_flash_chart/base.rb', line 84
def set_colours(colours, grid_colour)
@colours = colours
@grid_colour = grid_colour
end
|
- (Object) set_key(text, size)
[View source]
64
65
66
67
|
# File 'lib/plugins/open_flash_chart/lib/open_flash_chart/base.rb', line 64
def set_key(text, size)
@text = text
@font_size = size
end
|
- (Object) set_offset(v)
[View source]
80
81
82
|
# File 'lib/plugins/open_flash_chart/lib/open_flash_chart/base.rb', line 80
def set_offset(v)
@offset = v ? true : false
end
|
- (Object) set_range(min, max, steps = 1)
[View source]
74
75
76
77
78
|
# File 'lib/plugins/open_flash_chart/lib/open_flash_chart/base.rb', line 74
def set_range(min,max,steps=1)
@min = min
@max = max
@steps = steps
end
|
[View source]
89
90
91
92
93
94
95
96
97
|
# File 'lib/plugins/open_flash_chart/lib/open_flash_chart/base.rb', line 89
def set_tooltip(tip)
if tip.is_a?(Tooltip)
@tooltip = tip
else
@tip = tip
end
end
|
- (Object) to_json2
[View source]
49
50
51
|
# File 'lib/plugins/open_flash_chart/lib/open_flash_chart/base.rb', line 49
def to_json2
self.instance_values.to_json
end
|