Class: Sol::TimeScale
Overview
Instance Attribute Summary
Attributes inherited from Scale
Instance Method Summary collapse
-
#domain(dates) ⇒ Object
————————————————————————————.
-
#initialize(utc = nil) ⇒ TimeScale
constructor
————————————————————————————.
-
#nice(val, step = nil) ⇒ Object
———————————————————————————— val is either an interval or an integer.
Methods inherited from Scale
Constructor Details
#initialize(utc = nil) ⇒ TimeScale
110 111 112 113 |
# File 'lib/sol/scale.rb', line 110 def initialize(utc = nil) @type = "time" @spec = "d3.time.scale()" end |
Instance Method Details
#domain(dates) ⇒ Object
119 120 121 122 123 124 125 126 127 128 129 130 131 132 |
# File 'lib/sol/scale.rb', line 119 def domain(dates) # check to verify that dates is an array of dates. # If the array has more than two elements then 'range' needs to have the same number # of elements @elements = dates.size scale = "[" dates.each_with_index do |date, i| scale << ", " if i > 0 scale << "new Date(#{date*1000})" end scale << "]" @spec << ".domain(#{scale})" end |
#nice(val, step = nil) ⇒ Object
val is either an interval or an integer. If it is an integer then step is ignored if given.
139 140 141 |
# File 'lib/sol/scale.rb', line 139 def nice(val, step = nil) end |