class GerbilCharts::Models::GraphModel

GraphModel - Basic interface to a model in GerbilCharts

You can create your own model as long as all the methods here are implemented or you can use one of the predefined graph models.

Attributes

altname[RW]
href[R]
href_pivot[RW]
name[RW]
transformer[R]
userdata[R]
userlabel1[R]
userlabel2[R]

Public Class Methods

new(n="Untitled") click to toggle source
# File lib/gerbilcharts/models/graph_model.rb, line 20
def initialize(n="Untitled")
  @name=n
  @transformer = nil
end

Public Instance Methods

count() click to toggle source
# File lib/gerbilcharts/models/graph_model.rb, line 37
def count
  0
end
each_value_pair() { |0,0| ... } click to toggle source
# File lib/gerbilcharts/models/graph_model.rb, line 33
def each_value_pair
  yield 0,0
end
hasHref?() click to toggle source
# File lib/gerbilcharts/models/graph_model.rb, line 54
def hasHref?
  return @href != nil
end
hasHrefPivot?() click to toggle source
# File lib/gerbilcharts/models/graph_model.rb, line 58
def hasHrefPivot?
  return @href_pivot != nil
end
hasUserData?() click to toggle source
# File lib/gerbilcharts/models/graph_model.rb, line 66
def hasUserData?
  return @userdata != nil
end
hasUserTips?() click to toggle source
# File lib/gerbilcharts/models/graph_model.rb, line 70
def hasUserTips?
  return @userlabel1 != nil
end
is_timeseries?() click to toggle source
# File lib/gerbilcharts/models/graph_model.rb, line 96
def is_timeseries?
      return false
end
min_max_x() { |0,0| ... } click to toggle source
# File lib/gerbilcharts/models/graph_model.rb, line 25
def min_max_x
  yield 0,0    
end
min_max_y() { |0,0| ... } click to toggle source
# File lib/gerbilcharts/models/graph_model.rb, line 29
def min_max_y
  yield 0,0
end
recreate() click to toggle source
# File lib/gerbilcharts/models/graph_model.rb, line 88
def recreate
  # no op (override this)
end
setHref(h) click to toggle source

clean up the href (todo: improve this)

# File lib/gerbilcharts/models/graph_model.rb, line 42
def setHref(h)
  h1=h.gsub("{","%7B")
  @href=h1.gsub("}","%7D")
end
setHrefPivot(h) click to toggle source

clean up the href (todo: improve this)

# File lib/gerbilcharts/models/graph_model.rb, line 48
def setHrefPivot(h)
  h1=h.gsub("{","%7B")
  @href_pivot=h1.gsub("}","%7D")
end
setUserData(d) click to toggle source
# File lib/gerbilcharts/models/graph_model.rb, line 62
def setUserData(d)
  @userdata=d
end
setUserTip1(t) click to toggle source
# File lib/gerbilcharts/models/graph_model.rb, line 74
def setUserTip1(t)
  @userlabel1=t
  @userlabel2="" if @userlabel2.nil?
end
setUserTip2(t) click to toggle source
# File lib/gerbilcharts/models/graph_model.rb, line 79
def setUserTip2(t)
  @userlabel2=t
  @userlabel1="" if @userlabel1.nil?
end
transformer=(trlambda) click to toggle source
# File lib/gerbilcharts/models/graph_model.rb, line 92
def transformer=(trlambda)
  @transformer = trlambda
end
updateOptions(opts) click to toggle source
# File lib/gerbilcharts/models/graph_model.rb, line 84
def updateOptions(opts)
  @name = opts[:name] if opts[:name]
end