public
Description: The ruby on rails plugin for teethgrinder's Open Flash Chart (version 2)
Homepage: http://pullmonkey.com/projects/open_flash_chart2/
Clone URL: git://github.com/pullmonkey/open_flash_chart.git
refactor to proper plugin architecture and namespace; spiced up with magic pen 
and args={}/super down the chain
dfl (author)
Fri Oct 24 21:40:03 -0700 2008
commit  45082f78c7ef7e60136ce2866c1e54f4185efcf7
tree    64b851c3d8f3b14bfb59f9f636ff36ada620e757
parent  6757a86000a0e96a6ea3afdd55e0a90288fb8dac
  • README
  • README.rdoc
  • init.rb
  • lib/area_base.rb
  • lib/area_hollow.rb
  • lib/area_line.rb
  • lib/bar.rb
  • lib/bar_3d.rb
  • lib/bar_base.rb
  • lib/bar_filled.rb
  • lib/bar_glass.rb
  • lib/bar_sketch.rb
  • lib/bar_stack.rb
  • lib/h_bar.rb
  • lib/line.rb
  • lib/line_base.rb
  • lib/line_dot.rb
  • lib/line_hollow.rb
  • lib/ofc_ajax.rb
  • lib/open_flash_chart.rb
  • lib/open_flash_chart_object.rb
  • lib/pie.rb
  • lib/radar_axis.rb
  • lib/radar_axis_labels.rb
  • lib/radar_spoke_labels.rb
  • lib/scatter.rb
  • lib/scatter_line.rb
  • lib/shape.rb
  • lib/title.rb
  • lib/tooltip.rb
  • lib/upload_image.rb
  • lib/x_axis.rb
  • lib/x_axis_label.rb
  • lib/x_axis_labels.rb
  • lib/x_legend.rb
  • lib/y_axis.rb
  • lib/y_axis_base.rb
  • lib/y_axis_right.rb
  • lib/y_legend.rb
...
1
2
3
4
5
6
7
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
33
34
 
 
 
 
...
 
 
 
 
1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
3
4
5
0
@@ -1,34 +1,5 @@
0
-# Include hook code here
0
-require 'digest/sha1'
0
-require 'ofc_ajax'
0
-require 'open_flash_chart_object'
0
 require 'open_flash_chart'
0
-require 'bar_base'
0
-require 'bar'
0
-require 'bar_3d'
0
-require 'bar_glass'
0
-require 'bar_sketch'
0
-require 'bar_filled'
0
-require 'bar_stack'
0
-require 'h_bar'
0
-require 'line_base'
0
-require 'line'
0
-require 'line_dot'
0
-require 'line_hollow'
0
-require 'pie'
0
-require 'scatter'
0
-require 'title'
0
-require 'x_axis_label'
0
-require 'x_axis_labels'
0
-require 'x_axis'
0
-require 'x_legend'
0
-require 'y_axis_base'
0
-require 'y_axis'
0
-require 'y_axis_right'
0
-require 'y_legend'
0
-require 'tooltip'
0
-require 'area_base'
0
-require 'area_hollow'
0
-require 'area_line'
0
-require 'shape'
0
-require 'upload_image'
0
+
0
+ActionView::Base.send :include, OpenFlashChart::View
0
+ActionController::Base.send :include, OpenFlashChart::Controller
0
+
...
1
2
3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
5
6
7
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
 
 
...
 
 
 
1
2
3
4
5
6
7
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
33
0
@@ -1,90 +1,33 @@
0
-# OpenFlashChart
0
-class OpenFlashChart
0
-  include OFCAjax
0
+require 'open_flash_chart/base'
0
+require 'open_flash_chart/bar_base'
0
+require 'open_flash_chart/bar'
0
+require 'open_flash_chart/bar_3d'
0
+require 'open_flash_chart/bar_glass'
0
+require 'open_flash_chart/bar_sketch'
0
+require 'open_flash_chart/bar_filled'
0
+require 'open_flash_chart/bar_stack'
0
+require 'open_flash_chart/h_bar'
0
+require 'open_flash_chart/line_base'
0
+require 'open_flash_chart/line'
0
+require 'open_flash_chart/line_dot'
0
+require 'open_flash_chart/line_hollow'
0
+require 'open_flash_chart/pie'
0
+require 'open_flash_chart/scatter'
0
+require 'open_flash_chart/title'
0
+require 'open_flash_chart/x_axis_label'
0
+require 'open_flash_chart/x_axis_labels'
0
+require 'open_flash_chart/x_axis'
0
+require 'open_flash_chart/x_legend'
0
+require 'open_flash_chart/y_axis_base'
0
+require 'open_flash_chart/y_axis'
0
+require 'open_flash_chart/y_axis_right'
0
+require 'open_flash_chart/y_legend'
0
+require 'open_flash_chart/tooltip'
0
+require 'open_flash_chart/area_base'
0
+require 'open_flash_chart/area_hollow'
0
+require 'open_flash_chart/area_line'
0
+require 'open_flash_chart/shape'
0
+require 'open_flash_chart/upload_image'
0
 
0
-  def initialize(args={})
0
-    # set all the instance variables we want
0
-    # assuming something like this OpenFlashChart.new(:x_axis => 5, :y_axis => 10, :elements => ["one", "two"], ...)
0
-    args.each do |k,v|
0
-      self.instance_variable_set("@#{k}", v)
0
-    end
0
-  end
0
-
0
-  # same as to_s but won't stack overflow ... use this instead of to_s
0
-  def render
0
-    # need to return the following like this
0
-    # 1) font_size as font-size 
0
-    # 2) dot_size as dot-size
0
-    # 3) outline_colour as outline-colour
0
-    # 4) halo_size as halo-size
0
-    # 5) start_angle as start-angle
0
-    # 6) tick_height as tick-height
0
-    # 7) grid_colour as grid-colour
0
-    # 8) threed as 3d
0
-    # 9) tick_length as tick-length
0
-    to_return = self.to_json.gsub("threed","3d")
0
-    %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).each do |replace|
0
-      to_return = to_return.gsub(replace, replace.gsub("_", "-"))
0
-    end
0
-    return to_return
0
-  end
0
-  # for those still using to_s and that do not get a stack overflow
0
-  alias_method :to_s, :render
0
-
0
-  def add_element(element)
0
-    @elements ||= []
0
-    @elements << element
0
-  end
0
-
0
-  def set_key(text, size)
0
-    @text      = text
0
-    @font_size = size
0
-  end
0
-  
0
-  def append_value(v)
0
-    @values ||= []
0
-    @values << v
0
-  end
0
-
0
-  def set_range(min,max,steps=1)
0
-    @min = min
0
-    @max = max
0
-    @steps = steps
0
-  end
0
-  
0
-  def set_offset(v)
0
-    @offset = v ? true : false
0
-  end
0
-  
0
-  def set_colours(colour, grid_colour)
0
-    @colour = colour
0
-    @grid_colour = grid_colour
0
-  end
0
-
0
-  def set_tooltip(tip)
0
-    if tip.is_a?(Tooltip)
0
-      #we have a style for our chart's tooltips
0
-      @tooltip = tip
0
-    else
0
-      # the user could just use set_tip(tip) or tip=(tip) to just set the text of the tooltip
0
-      @tip = tip
0
-    end
0
-  end
0
-  alias_method "tooltip=", :set_tooltip
0
-  
0
-
0
-  def method_missing(method_name, *args)
0
-    method_name = method_name.to_s
0
-    if method_name =~ /(.*)=/   # i.e., if it is something x_legend=
0
-      # if the user wants to set an instance variable then let them
0
-      # the other args (args[0]) are ignored since it is a set method
0
-      return self.instance_variable_set("@#{$1}", args[0])
0
-    elsif method_name =~/^set_(.*)/
0
-      # backwards compatible ... the user can still use the same set_y_legend methods if they want
0
-      return self.instance_variable_set("@#{$1}", args[0])
0
-    else
0
-      # if the method/attribute is missing and it is not a set method then hmmmm better let the user know
0
-      super
0
-    end
0
-  end
0
-end
0
+require 'open_flash_chart/ofc_ajax'
0
+require 'open_flash_chart/open_flash_chart_object'

Comments