Skip to content

Commit

Permalink
Updated to Lug Wyrm Charmer version of Ruby
Browse files Browse the repository at this point in the history
  • Loading branch information
Pullmonkey committed Jan 4, 2010
1 parent e19e239 commit 2c6bfa3
Show file tree
Hide file tree
Showing 15 changed files with 172 additions and 28 deletions.
Binary file modified assets/open-flash-chart.swf
Binary file not shown.
6 changes: 5 additions & 1 deletion lib/open_flash_chart/bar_base.rb
@@ -1,3 +1,7 @@
module OpenFlashChart
class BarBase < Base; end
class BarBase < Base
def attach_to_right_y_axis
@axis = 'right'
end
end
end
52 changes: 51 additions & 1 deletion lib/open_flash_chart/bar_glass.rb
@@ -1,17 +1,67 @@
module OpenFlashChart

class BarOnShow < Base
def initialize(type, cascade, delay)
@type = type
@cascade = cascade.to_f
@delay = delay.to_f
end
end

class BarGlass < BarBase
def initialize args={}
super
@type = "bar_glass"
end
end

class BarCylinder < BarBase
def initialize args={}
super
@type = "bar_cylinder"
end
end

class BarCylinderOutline < BarBase
def initialize args={}
super
@type = "bar_cylinder_outline"
end
end

class BarRoundedGlass < BarBase
def initialize args={}
super
@type = "bar_rounded_glass"
end
end

class BarRound < BarBase
def initialize args={}
super
@type = "bar_round"
end
end

class BarDome < BarBase
def initialize args={}
super
@type = "bar_dome"
end
end

class BarRound3d < BarBase
def initialize args={}
super
@type = "bar_round3d"
end
end

class BarGlassValue < Base
def initialize(top, args={})
@top = top
super args
end
end

end
end
11 changes: 10 additions & 1 deletion lib/open_flash_chart/bar_stack.rb
Expand Up @@ -17,4 +17,13 @@ def initialize(val,colour, args={})
end
end

end
class BarStackKey < Base
def initialize(colour, text, font_size, args={})
@colour = colour
@text = text
@font_size = font_size
super
end
end

end
17 changes: 16 additions & 1 deletion lib/open_flash_chart/base.rb
Expand Up @@ -24,9 +24,19 @@ def render
# 9) tick_length as tick-length
# 10) visible_steps as visible-steps
# 11) key_on_click as key-on-click
# 12) barb_length as barb-length
# 13) on_show as on-show
# 14) negative_colour as negative-colour
# 15) line_style as line-style
# 16) on_click as on-click
# 17) javascript_function_name as javascript-function-name
# 18) pad_x to pad-x
# 19) pad_y to pad-y
# 20) align_x to align-x
# 21) align_y to align-y
returning self.to_json2 do |output|
output.gsub!("threed","3d")
%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).each do |replace|
%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).each do |replace|
output.gsub!(replace, replace.gsub("_", "-"))
end
end
Expand Down Expand Up @@ -83,6 +93,11 @@ def set_tooltip(tip)
end
alias_method "tooltip=", :set_tooltip

def attach_to_right_y_axis
@axis = 'right'
end




def method_missing(method_name, *args, &blk)
Expand Down
12 changes: 7 additions & 5 deletions lib/open_flash_chart/candle.rb
@@ -1,20 +1,22 @@
module OpenFlashChart

class Candle < Base
def initialize(args={})
def initialize(colour, negative_colour, args={})
@colour = colour
@negative_colour = negative_colour
super args
@type = "candle"
end
end

class CandleValue < Base
def initialize( top, bottom, low, high, args={} )
@top = top
@bottom = bottom
def initialize( high, open, close low, args={} )
@top = open
@bottom = close
@low = low
@high = high
super args
end
end

end
end
4 changes: 2 additions & 2 deletions lib/open_flash_chart/h_bar.rb
Expand Up @@ -3,7 +3,7 @@ module OpenFlashChart
class HBarValue < Base
def initialize(left,right=nil, args={})
super args
@left = left
@left = left if right
@right = right || left
end
end
Expand All @@ -23,4 +23,4 @@ def set_values(v)
end
end

end
end
15 changes: 14 additions & 1 deletion lib/open_flash_chart/line.rb
@@ -1,10 +1,23 @@
module OpenFlashChart

class LineOnShow < Base
def initialize(type, cascade, delay)
@type = type
@cascade = cascade.to_F
@delay = delay.to_f
end
end

class Line < LineBase
def initialize args={}
super
@type = "line"
@values = []
end

def set_default_dot_style(style)
@dot_style = style
end
end

end
end
6 changes: 3 additions & 3 deletions lib/open_flash_chart/line_base.rb
Expand Up @@ -3,15 +3,15 @@ module OpenFlashChart
class LineBase < Base
def initialize args={}
super
@type = "line_dot"
@type = "line"
@text = "Page Views"
@font_size = 10
@values = [9,6,7,9,5,7,6,9,7]
@values = []
end

def loop
@loop = true
end
end

end
end
45 changes: 41 additions & 4 deletions lib/open_flash_chart/pie.rb
Expand Up @@ -5,6 +5,7 @@ def initialize(value, label, args={})
super args
@value = value
@label = label
@animate = []
end

def set_label(label, label_color, font_size)
Expand All @@ -16,23 +17,59 @@ def set_label(label, label_color, font_size)
def on_click(event)
@on_click = event
end

def add_animation animation
@animate ||= []
@animate << animation
return self
end
end

class BasePieAnimation < Base; end

class PieFade < BasePieAnimation
def initialize args={}
@type = "fade"
super
end
end

class PieBounce < BasePieAnimation
def initialize distance, args={}
@type = "bounce"
@distance = distance
super
end
end

class Pie < Base
def initialize args={}
@type = "pie"
@colours = ["#d01f3c","#356aa0","#C79810"]
@border = 2
@colours = []
super
end

def set_animate bool
self.add_animation PieFade.new if bool
end

def add_animation animation
@animate ||= []
@animate << animation
return self
end

def set_gradient_fill
@gradient_fill = true
end

def set_no_labels
self.no_labels = true
@no_labels = true
end

def on_click(event)
@on_click = event
end
end

end
end
5 changes: 3 additions & 2 deletions lib/open_flash_chart/scatter.rb
Expand Up @@ -13,9 +13,10 @@ class Scatter < Base
def initialize(colour, dot_size, args={})
@type = "scatter"
@colour = colour
@dot_size = dot_size
@dot_style = dot_style
@values = []
super args
end
end

end
end
14 changes: 11 additions & 3 deletions lib/open_flash_chart/scatter_line.rb
@@ -1,12 +1,20 @@
module OpenFlashChart

class ScatterLine < Base
def initialize(colour, dot_size, args={})
def initialize(colour, width, args={})
super args
@type = 'scatter_line'
@colour = colour
@dot_size = dot_size
@width = width
end

def set_step_horizonal
@stepgraph = 'horizontal'
end

def set_step_vertical
@stepgraph = 'vertical'
end
end

end
end
4 changes: 2 additions & 2 deletions lib/open_flash_chart/x_axis_labels.rb
Expand Up @@ -2,8 +2,8 @@ module OpenFlashChart

class XAxisLabels < Base
def set_vertical
@rotate = "vertical"
@rotate = 270
end
end

end
end
6 changes: 5 additions & 1 deletion lib/open_flash_chart/y_axis_base.rb
@@ -1,3 +1,7 @@
module OpenFlashChart
class YAxisBase < Base; end
class YAxisBase < Base
def set_vertical
@rotate = "vertical"
end
end
end
3 changes: 2 additions & 1 deletion lib/open_flash_chart/y_axis_right.rb
@@ -1,3 +1,4 @@
module OpenFlashChart
class YAxisRight < YAxisBase; end
class YAxisRight < YAxisBase
end
end

0 comments on commit 2c6bfa3

Please sign in to comment.