Module: D3

Defined in:
lib/opal/d3/search.rb,
lib/opal/d3.rb,
lib/opal/d3/arc.rb,
lib/opal/d3/dsv.rb,
lib/opal/d3/map.rb,
lib/opal/d3/pie.rb,
lib/opal/d3/set.rb,
lib/opal/d3/area.rb,
lib/opal/d3/axis.rb,
lib/opal/d3/ease.rb,
lib/opal/d3/line.rb,
lib/opal/d3/misc.rb,
lib/opal/d3/nest.rb,
lib/opal/d3/path.rb,
lib/opal/d3/color.rb,
lib/opal/d3/curve.rb,
lib/opal/d3/stack.rb,
lib/opal/d3/format.rb,
lib/opal/d3/native.rb,
lib/opal/d3/random.rb,
lib/opal/d3/symbol.rb,
lib/opal/d3/creator.rb,
lib/opal/d3/polygon.rb,
lib/opal/d3/quadtree.rb,
lib/opal/d3/selection.rb,
lib/opal/d3/band_scale.rb,
lib/opal/d3/histograms.rb,
lib/opal/d3/statistics.rb,
lib/opal/d3/collections.rb,
lib/opal/d3/interpolate.rb,
lib/opal/d3/point_scale.rb,
lib/opal/d3/radial_area.rb,
lib/opal/d3/radial_line.rb,
lib/opal/d3/time_format.rb,
lib/opal/d3/ordinal_scale.rb,
lib/opal/d3/time_interval.rb,
lib/opal/d3/quantile_scale.rb,
lib/opal/d3/quantize_scale.rb,
lib/opal/d3/threshold_scale.rb,
lib/opal/d3/transformations.rb,
lib/opal/d3/continuous_scale.rb,
lib/opal/d3/sequential_scale.rb

Overview

all these methods return indexes not values

Defined Under Namespace

Modules: Native Classes: ArcGenerator, AreaGenerator, Axis, BandScale, Bisector, Color, ContinuousScale, Creator, Curve, CurveBundle, CurveCardinal, CurveCatmullRom, DsvFormat, EaseBack, EaseElastic, EasePoly, FormatLocale, FormatSpecifier, Histogram, LineGenerator, LogScale, Map, Nest, OrdinalScale, Path, PieGenerator, PointScale, PowScale, Quad, QuadTree, QuantileScale, QuantizeScale, RadialAreaGenerator, RadialLineGenerator, Selection, SequentialScale, Set, StackGenerator, SymbolGenerator, SymbolType, ThresholdScale, TimeFormatLocale, TimeInterval

Class Method Summary collapse

Class Method Details

.arcObject



17
18
19
# File 'lib/opal/d3/arc.rb', line 17

def arc
  D3::ArcGenerator.new @d3.JS.arc
end

.areaObject



45
46
47
# File 'lib/opal/d3/area.rb', line 45

def area
  D3::AreaGenerator.new @d3.JS.area
end

.axis_bottom(scale) ⇒ Object



65
66
67
# File 'lib/opal/d3/axis.rb', line 65

def axis_bottom(scale)
  D3::Axis.new(@d3.JS.axisBottom(scale.to_n), scale)
end

.axis_left(scale) ⇒ Object



73
74
75
# File 'lib/opal/d3/axis.rb', line 73

def axis_left(scale)
  D3::Axis.new(@d3.JS.axisLeft(scale.to_n), scale)
end

.axis_right(scale) ⇒ Object



69
70
71
# File 'lib/opal/d3/axis.rb', line 69

def axis_right(scale)
  D3::Axis.new(@d3.JS.axisRight(scale.to_n), scale)
end

.axis_top(scale) ⇒ Object



61
62
63
# File 'lib/opal/d3/axis.rb', line 61

def axis_top(scale)
  D3::Axis.new(@d3.JS.axisTop(scale.to_n), scale)
end

.bisector(&block) ⇒ Object



24
25
26
# File 'lib/opal/d3/search.rb', line 24

def bisector(&block)
  D3::Bisector.new @d3.JS.bisector(block)
end

.color(description) ⇒ Object



24
25
26
27
28
29
30
31
# File 'lib/opal/d3/color.rb', line 24

def color(description)
  color = @d3.JS.color(description)
  if color
    D3::Color.new(color)
  else
    raise ArgumentError, "Invalid color: #{description}"
  end
end

.creator(name) ⇒ Object



7
8
9
# File 'lib/opal/d3/creator.rb', line 7

def creator(name)
  D3::Creator.new @d3.JS.creator(name)
end

.csv_format(rows, columns = `undefined`) ⇒ Object



95
96
97
# File 'lib/opal/d3/dsv.rb', line 95

def csv_format(rows, columns=`undefined`)
  @d3.JS.csvFormat(rows.to_n, columns)
end

.csv_format_rows(rows) ⇒ Object



63
64
65
# File 'lib/opal/d3/dsv.rb', line 63

def csv_format_rows(rows)
  @d3.JS.csvFormatRows(rows)
end

.csv_parse(string, row = `undefined`, &block) ⇒ Object



71
72
73
74
75
76
77
78
79
80
81
# File 'lib/opal/d3/dsv.rb', line 71

def csv_parse(string, row=`undefined`, &block)
  row = block if block_given?
  if `row !== undefined`
    @d3.JS.csvParse(string, proc{|e|
      result = row.call(`Opal.hash(e)`)
      result == nil ? `null` : result
    })
  else
    @d3.JS.csvParse(string).map{|e| `Opal.hash(e)` }
  end
end

.csv_parse_rows(string, row = `undefined`, &block) ⇒ Object



39
40
41
42
43
44
45
46
47
48
49
# File 'lib/opal/d3/dsv.rb', line 39

def csv_parse_rows(string, row=`undefined`, &block)
  row = block if block_given?
  if `row !== undefined`
    @d3.JS.csvParseRows(string, proc{|d|
      result = row.call(d)
      result == nil ? `null` : result
    })
  else
    @d3.JS.csvParseRows(string)
  end
end

.cubehelix(*args) ⇒ Object



69
70
71
72
73
74
75
76
# File 'lib/opal/d3/color.rb', line 69

def cubehelix(*args)
  color = if args[0].is_a?(Color)
    @d3.JS.cubehelix(args[0].native)
  else
    @d3.JS.cubehelix(*args)
  end
  D3::Color.new(color)
end

.curve_basisObject



19
20
21
# File 'lib/opal/d3/curve.rb', line 19

def curve_basis
  D3::Curve.new `window.d3.curveBasis`
end

.curve_basis_closedObject



22
23
24
# File 'lib/opal/d3/curve.rb', line 22

def curve_basis_closed
  D3::Curve.new `window.d3.curveBasisClosed`
end

.curve_basis_openObject



25
26
27
# File 'lib/opal/d3/curve.rb', line 25

def curve_basis_open
  D3::Curve.new `window.d3.curveBasisOpen`
end

.curve_bundleObject



28
29
30
# File 'lib/opal/d3/curve.rb', line 28

def curve_bundle
  D3::CurveBundle.new `window.d3.curveBundle`
end

.curve_cardinalObject



31
32
33
# File 'lib/opal/d3/curve.rb', line 31

def curve_cardinal
  D3::CurveCardinal.new `window.d3.curveCardinal`
end

.curve_cardinal_closedObject



34
35
36
# File 'lib/opal/d3/curve.rb', line 34

def curve_cardinal_closed
  D3::CurveCardinal.new `window.d3.curveCardinalClosed`
end

.curve_cardinal_openObject



37
38
39
# File 'lib/opal/d3/curve.rb', line 37

def curve_cardinal_open
  D3::CurveCardinal.new `window.d3.curveCardinalOpen`
end

.curve_catmull_romObject



40
41
42
# File 'lib/opal/d3/curve.rb', line 40

def curve_catmull_rom
  D3::CurveCatmullRom.new `window.d3.curveCatmullRom`
end

.curve_catmull_rom_closedObject



43
44
45
# File 'lib/opal/d3/curve.rb', line 43

def curve_catmull_rom_closed
  D3::CurveCatmullRom.new `window.d3.curveCatmullRomClosed`
end

.curve_catmull_rom_openObject



46
47
48
# File 'lib/opal/d3/curve.rb', line 46

def curve_catmull_rom_open
  D3::CurveCatmullRom.new `window.d3.curveCatmullRomOpen`
end

.curve_linearObject



49
50
51
# File 'lib/opal/d3/curve.rb', line 49

def curve_linear
  D3::Curve.new `window.d3.curveLinear`
end

.curve_linear_closedObject



52
53
54
# File 'lib/opal/d3/curve.rb', line 52

def curve_linear_closed
  D3::Curve.new `window.d3.curveLinearClosed`
end

.curve_monotone_xObject



55
56
57
# File 'lib/opal/d3/curve.rb', line 55

def curve_monotone_x
  D3::Curve.new `window.d3.curveMonotoneX`
end

.curve_monotone_yObject



58
59
60
# File 'lib/opal/d3/curve.rb', line 58

def curve_monotone_y
  D3::Curve.new `window.d3.curveMonotoneY`
end

.curve_naturalObject



61
62
63
# File 'lib/opal/d3/curve.rb', line 61

def curve_natural
  D3::Curve.new `window.d3.curveNatural`
end

.curve_stepObject



64
65
66
# File 'lib/opal/d3/curve.rb', line 64

def curve_step
  D3::Curve.new `window.d3.curveStep`
end

.curve_step_afterObject



67
68
69
# File 'lib/opal/d3/curve.rb', line 67

def curve_step_after
  D3::Curve.new `window.d3.curveStepAfter`
end

.curve_step_beforeObject



70
71
72
# File 'lib/opal/d3/curve.rb', line 70

def curve_step_before
  D3::Curve.new `window.d3.curveStepBefore`
end

.deviation(data, &block) ⇒ Object



45
46
47
48
49
50
51
52
# File 'lib/opal/d3/statistics.rb', line 45

def deviation(data, &block)
  result = if block
    @d3.JS.deviation(data, proc{|x| y=yield(x); y.nil? ? `undefined` : y})
  else
    @d3.JS.deviation(data.compact)
  end
  `result === undefined ? nil : result`
end

.dsv_format(separator) ⇒ Object



35
36
37
# File 'lib/opal/d3/dsv.rb', line 35

def dsv_format(separator)
  D3::DsvFormat.new @d3.JS.dsvFormat(separator)
end

.ease_back(t = nil) ⇒ Object



255
256
257
258
259
260
261
# File 'lib/opal/d3/ease.rb', line 255

def ease_back(t=nil)
  if t
    @d3.JS.easeBack(t)
  else
    D3::EaseBack.new `#@d3.easeBack`
  end
end

.ease_back_in(t = nil) ⇒ Object



263
264
265
266
267
268
269
# File 'lib/opal/d3/ease.rb', line 263

def ease_back_in(t=nil)
  if t
    @d3.JS.easeBackIn(t)
  else
    D3::EaseBack.new `#@d3.easeBackIn`
  end
end

.ease_back_in_out(t = nil) ⇒ Object



279
280
281
282
283
284
285
# File 'lib/opal/d3/ease.rb', line 279

def ease_back_in_out(t=nil)
  if t
    @d3.JS.easeBackInOut(t)
  else
    D3::EaseBack.new `#@d3.easeBackInOut`
  end
end

.ease_back_out(t = nil) ⇒ Object



271
272
273
274
275
276
277
# File 'lib/opal/d3/ease.rb', line 271

def ease_back_out(t=nil)
  if t
    @d3.JS.easeBackOut(t)
  else
    D3::EaseBack.new `#@d3.easeBackOut`
  end
end

.ease_bounce(t = nil) ⇒ Object



199
200
201
202
203
204
205
# File 'lib/opal/d3/ease.rb', line 199

def ease_bounce(t=nil)
  if t
    @d3.JS.easeBounce(t)
  else
    `#@d3.easeBounce`
  end
end

.ease_bounce_in(t = nil) ⇒ Object



207
208
209
210
211
212
213
# File 'lib/opal/d3/ease.rb', line 207

def ease_bounce_in(t=nil)
  if t
    @d3.JS.easeBounceIn(t)
  else
    `#@d3.easeBounceIn`
  end
end

.ease_bounce_in_out(t = nil) ⇒ Object



223
224
225
226
227
228
229
# File 'lib/opal/d3/ease.rb', line 223

def ease_bounce_in_out(t=nil)
  if t
    @d3.JS.easeBounceInOut(t)
  else
    `#@d3.easeBounceInOut`
  end
end

.ease_bounce_out(t = nil) ⇒ Object



215
216
217
218
219
220
221
# File 'lib/opal/d3/ease.rb', line 215

def ease_bounce_out(t=nil)
  if t
    @d3.JS.easeBounceOut(t)
  else
    `#@d3.easeBounceOut`
  end
end

.ease_circle(t = nil) ⇒ Object



167
168
169
170
171
172
173
# File 'lib/opal/d3/ease.rb', line 167

def ease_circle(t=nil)
  if t
    @d3.JS.easeCircle(t)
  else
    `#@d3.easeCircle`
  end
end

.ease_circle_in(t = nil) ⇒ Object



175
176
177
178
179
180
181
# File 'lib/opal/d3/ease.rb', line 175

def ease_circle_in(t=nil)
  if t
    @d3.JS.easeCircleIn(t)
  else
    `#@d3.easeCircleIn`
  end
end

.ease_circle_in_out(t = nil) ⇒ Object



191
192
193
194
195
196
197
# File 'lib/opal/d3/ease.rb', line 191

def ease_circle_in_out(t=nil)
  if t
    @d3.JS.easeCircleInOut(t)
  else
    `#@d3.easeCircleInOut`
  end
end

.ease_circle_out(t = nil) ⇒ Object



183
184
185
186
187
188
189
# File 'lib/opal/d3/ease.rb', line 183

def ease_circle_out(t=nil)
  if t
    @d3.JS.easeCircleOut(t)
  else
    `#@d3.easeCircleOut`
  end
end

.ease_cubic(t = nil) ⇒ Object



71
72
73
74
75
76
77
# File 'lib/opal/d3/ease.rb', line 71

def ease_cubic(t=nil)
  if t
    @d3.JS.easeCubic(t)
  else
    `#@d3.easeCubic`
  end
end

.ease_cubic_in(t = nil) ⇒ Object



79
80
81
82
83
84
85
# File 'lib/opal/d3/ease.rb', line 79

def ease_cubic_in(t=nil)
  if t
    @d3.JS.easeCubicIn(t)
  else
    `#@d3.easeCubicIn`
  end
end

.ease_cubic_in_out(t = nil) ⇒ Object



95
96
97
98
99
100
101
# File 'lib/opal/d3/ease.rb', line 95

def ease_cubic_in_out(t=nil)
  if t
    @d3.JS.easeCubicInOut(t)
  else
    `#@d3.easeCubicInOut`
  end
end

.ease_cubic_out(t = nil) ⇒ Object



87
88
89
90
91
92
93
# File 'lib/opal/d3/ease.rb', line 87

def ease_cubic_out(t=nil)
  if t
    @d3.JS.easeCubicOut(t)
  else
    `#@d3.easeCubicOut`
  end
end

.ease_elastic(t = nil) ⇒ Object



287
288
289
290
291
292
293
# File 'lib/opal/d3/ease.rb', line 287

def ease_elastic(t=nil)
  if t
    @d3.JS.easeElastic(t)
  else
    D3::EaseElastic.new `#@d3.easeElastic`
  end
end

.ease_elastic_in(t = nil) ⇒ Object



295
296
297
298
299
300
301
# File 'lib/opal/d3/ease.rb', line 295

def ease_elastic_in(t=nil)
  if t
    @d3.JS.easeElasticIn(t)
  else
    D3::EaseElastic.new `#@d3.easeElasticIn`
  end
end

.ease_elastic_in_out(t = nil) ⇒ Object



311
312
313
314
315
316
317
# File 'lib/opal/d3/ease.rb', line 311

def ease_elastic_in_out(t=nil)
  if t
    @d3.JS.easeElasticInOut(t)
  else
    D3::EaseElastic.new `#@d3.easeElasticInOut`
  end
end

.ease_elastic_out(t = nil) ⇒ Object



303
304
305
306
307
308
309
# File 'lib/opal/d3/ease.rb', line 303

def ease_elastic_out(t=nil)
  if t
    @d3.JS.easeElasticOut(t)
  else
    D3::EaseElastic.new `#@d3.easeElasticOut`
  end
end

.ease_exp(t = nil) ⇒ Object



135
136
137
138
139
140
141
# File 'lib/opal/d3/ease.rb', line 135

def ease_exp(t=nil)
  if t
    @d3.JS.easeExp(t)
  else
    `#@d3.easeExp`
  end
end

.ease_exp_in(t = nil) ⇒ Object



143
144
145
146
147
148
149
# File 'lib/opal/d3/ease.rb', line 143

def ease_exp_in(t=nil)
  if t
    @d3.JS.easeExpIn(t)
  else
    `#@d3.easeExpIn`
  end
end

.ease_exp_in_out(t = nil) ⇒ Object



159
160
161
162
163
164
165
# File 'lib/opal/d3/ease.rb', line 159

def ease_exp_in_out(t=nil)
  if t
    @d3.JS.easeExpInOut(t)
  else
    `#@d3.easeExpInOut`
  end
end

.ease_exp_out(t = nil) ⇒ Object



151
152
153
154
155
156
157
# File 'lib/opal/d3/ease.rb', line 151

def ease_exp_out(t=nil)
  if t
    @d3.JS.easeExpOut(t)
  else
    `#@d3.easeExpOut`
  end
end

.ease_linear(t = nil) ⇒ Object



31
32
33
34
35
36
37
# File 'lib/opal/d3/ease.rb', line 31

def ease_linear(t=nil)
  if t
    @d3.JS.easeLinear(t)
  else
    `#@d3.easeLinear`
  end
end

.ease_poly_in(t = nil) ⇒ Object



231
232
233
234
235
236
237
# File 'lib/opal/d3/ease.rb', line 231

def ease_poly_in(t=nil)
  if t
    @d3.JS.easePolyIn(t)
  else
    D3::EasePoly.new `#@d3.easePolyIn`
  end
end

.ease_poly_in_out(t = nil) ⇒ Object



247
248
249
250
251
252
253
# File 'lib/opal/d3/ease.rb', line 247

def ease_poly_in_out(t=nil)
  if t
    @d3.JS.easePolyInOut(t)
  else
    D3::EasePoly.new `#@d3.easePolyInOut`
  end
end

.ease_poly_out(t = nil) ⇒ Object



239
240
241
242
243
244
245
# File 'lib/opal/d3/ease.rb', line 239

def ease_poly_out(t=nil)
  if t
    @d3.JS.easePolyOut(t)
  else
    D3::EasePoly.new `#@d3.easePolyOut`
  end
end

.ease_quad(t = nil) ⇒ Object



39
40
41
42
43
44
45
# File 'lib/opal/d3/ease.rb', line 39

def ease_quad(t=nil)
  if t
    @d3.JS.easeQuad(t)
  else
    `#@d3.easeQuad`
  end
end

.ease_quad_in(t = nil) ⇒ Object



47
48
49
50
51
52
53
# File 'lib/opal/d3/ease.rb', line 47

def ease_quad_in(t=nil)
  if t
    @d3.JS.easeQuadIn(t)
  else
    `#@d3.easeQuadIn`
  end
end

.ease_quad_in_out(t = nil) ⇒ Object



63
64
65
66
67
68
69
# File 'lib/opal/d3/ease.rb', line 63

def ease_quad_in_out(t=nil)
  if t
    @d3.JS.easeQuadInOut(t)
  else
    `#@d3.easeQuadInOut`
  end
end

.ease_quad_out(t = nil) ⇒ Object



55
56
57
58
59
60
61
# File 'lib/opal/d3/ease.rb', line 55

def ease_quad_out(t=nil)
  if t
    @d3.JS.easeQuadOut(t)
  else
    `#@d3.easeQuadOut`
  end
end

.ease_sin(t = nil) ⇒ Object



103
104
105
106
107
108
109
# File 'lib/opal/d3/ease.rb', line 103

def ease_sin(t=nil)
  if t
    @d3.JS.easeSin(t)
  else
    `#@d3.easeSin`
  end
end

.ease_sin_in(t = nil) ⇒ Object



111
112
113
114
115
116
117
# File 'lib/opal/d3/ease.rb', line 111

def ease_sin_in(t=nil)
  if t
    @d3.JS.easeSinIn(t)
  else
    `#@d3.easeSinIn`
  end
end

.ease_sin_in_out(t = nil) ⇒ Object



127
128
129
130
131
132
133
# File 'lib/opal/d3/ease.rb', line 127

def ease_sin_in_out(t=nil)
  if t
    @d3.JS.easeSinInOut(t)
  else
    `#@d3.easeSinInOut`
  end
end

.ease_sin_out(t = nil) ⇒ Object



119
120
121
122
123
124
125
# File 'lib/opal/d3/ease.rb', line 119

def ease_sin_out(t=nil)
  if t
    @d3.JS.easeSinOut(t)
  else
    `#@d3.easeSinOut`
  end
end

.entries(obj) ⇒ Object



6
7
8
# File 'lib/opal/d3/collections.rb', line 6

def entries(obj)
  @d3.JS.entries(obj).map{|o| [`o.key`, `o.value`]}
end

.extent(data, &block) ⇒ Object



72
73
74
75
76
77
78
79
# File 'lib/opal/d3/statistics.rb', line 72

def extent(data, &block)
  (a,b) = if block
    @d3.JS.extent(data, proc{|x| y=yield(x); y.nil? ? `undefined` : y})
  else
    @d3.JS.extent(data.compact)
  end
  [`a === undefined ? nil : a`, `b === undefined ? nil : b`]
end

.format(specifier) ⇒ Object



55
56
57
58
59
60
61
# File 'lib/opal/d3/format.rb', line 55

def format(specifier)
  if specifier.is_a?(FormatSpecifier)
    @d3.JS.format(specifier.to_n)
  else
    @d3.JS.format(specifier)
  end
end

.format_default_locale(spec = {}) ⇒ Object



86
87
88
89
90
91
92
93
94
95
# File 'lib/opal/d3/format.rb', line 86

def format_default_locale(spec={})
  D3::FormatLocale.new @d3.JS.formatDefaultLocale(
    {
      decimal: spec.fetch("decimal", "."),
      thousands: spec.fetch("thousands", ","),
      grouping: spec.fetch("grouping", [3]),
      currency: spec.fetch("currency", ["$", ""]),
    }.to_n
  )
end

.format_locale(spec = {}) ⇒ Object



75
76
77
78
79
80
81
82
83
84
# File 'lib/opal/d3/format.rb', line 75

def format_locale(spec={})
  D3::FormatLocale.new @d3.JS.formatLocale(
    {
      decimal: spec.fetch("decimal", "."),
      thousands: spec.fetch("thousands", ","),
      grouping: spec.fetch("grouping", [3]),
      currency: spec.fetch("currency", ["$", ""]),
    }.to_n
  )
end

.format_prefix(specifier, value) ⇒ Object



63
64
65
66
67
68
69
# File 'lib/opal/d3/format.rb', line 63

def format_prefix(specifier, value)
  if specifier.is_a?(FormatSpecifier)
    @d3.JS.formatPrefix(specifier.to_n, value)
  else
    @d3.JS.formatPrefix(specifier, value)
  end
end

.format_specifier(specifier) ⇒ Object



71
72
73
# File 'lib/opal/d3/format.rb', line 71

def format_specifier(specifier)
  D3::FormatSpecifier.new @d3.JS.formatSpecifier(specifier)
end

.hcl(*args) ⇒ Object



60
61
62
63
64
65
66
67
# File 'lib/opal/d3/color.rb', line 60

def hcl(*args)
  color = if args[0].is_a?(Color)
    @d3.JS.hcl(args[0].native)
  else
    @d3.JS.hcl(*args)
  end
  D3::Color.new(color)
end

.histogramObject



28
29
30
# File 'lib/opal/d3/histograms.rb', line 28

def histogram
  D3::Histogram.new @d3.JS.histogram
end

.hsl(*args) ⇒ Object



42
43
44
45
46
47
48
49
# File 'lib/opal/d3/color.rb', line 42

def hsl(*args)
  color = if args[0].is_a?(Color)
    @d3.JS.hsl(args[0].native)
  else
    @d3.JS.hsl(*args)
  end
  D3::Color.new(color)
end

.interpolate_array(a = nil, b = nil) ⇒ Object



27
28
29
30
31
32
33
# File 'lib/opal/d3/interpolate.rb', line 27

def interpolate_array(a=nil,b=nil)
  if a == nil and b == nil
    `#@d3.interpolateArray`
  else
    @d3.JS.interpolateArray(a,b)
  end
end

.interpolate_cool(t = nil) ⇒ Object



72
73
74
75
76
77
78
# File 'lib/opal/d3/sequential_scale.rb', line 72

def interpolate_cool(t=nil)
  if t
    @d3.JS.interpolateCool(t)
  else
    `#@d3.interpolateCool`
  end
end

.interpolate_cubehelix(a = nil, b = nil) ⇒ Object



108
109
110
111
112
113
114
# File 'lib/opal/d3/interpolate.rb', line 108

def interpolate_cubehelix(a=nil,b=nil)
  if a == nil and b == nil
    `#@d3.interpolateCubehelix`
  else
    @d3.JS.interpolateCubehelix(a,b)
  end
end

.interpolate_cubehelix_default(t = nil) ⇒ Object



88
89
90
91
92
93
94
# File 'lib/opal/d3/sequential_scale.rb', line 88

def interpolate_cubehelix_default(t=nil)
  if t
    @d3.JS.interpolateCubehelixDefault(t)
  else
    `#@d3.interpolateCubehelixDefault`
  end
end

.interpolate_cubehelix_long(a = nil, b = nil) ⇒ Object



116
117
118
119
120
121
122
# File 'lib/opal/d3/interpolate.rb', line 116

def interpolate_cubehelix_long(a=nil,b=nil)
  if a == nil and b == nil
    `#@d3.interpolateCubehelixLong`
  else
    @d3.JS.interpolateCubehelixLong(a,b)
  end
end

.interpolate_date(a = nil, b = nil) ⇒ Object



35
36
37
38
39
40
41
# File 'lib/opal/d3/interpolate.rb', line 35

def interpolate_date(a=nil,b=nil)
  if a == nil and b == nil
    `#@d3.interpolateDate`
  else
    @d3.JS.interpolateDate(a,b)
  end
end

.interpolate_hcl(a = nil, b = nil) ⇒ Object



92
93
94
95
96
97
98
# File 'lib/opal/d3/interpolate.rb', line 92

def interpolate_hcl(a=nil,b=nil)
  if a == nil and b == nil
    `#@d3.interpolateHcl`
  else
    @d3.JS.interpolateHcl(a,b)
  end
end

.interpolate_hcl_long(a = nil, b = nil) ⇒ Object



100
101
102
103
104
105
106
# File 'lib/opal/d3/interpolate.rb', line 100

def interpolate_hcl_long(a=nil,b=nil)
  if a == nil and b == nil
    `#@d3.interpolateHclLong`
  else
    @d3.JS.interpolateHclLong(a,b)
  end
end

.interpolate_hsl(a = nil, b = nil) ⇒ Object



68
69
70
71
72
73
74
# File 'lib/opal/d3/interpolate.rb', line 68

def interpolate_hsl(a=nil,b=nil)
  if a == nil and b == nil
    `#@d3.interpolateHsl`
  else
    @d3.JS.interpolateHsl(a,b)
  end
end

.interpolate_hsl_long(a = nil, b = nil) ⇒ Object



76
77
78
79
80
81
82
# File 'lib/opal/d3/interpolate.rb', line 76

def interpolate_hsl_long(a=nil,b=nil)
  if a == nil and b == nil
    `#@d3.interpolateHslLong`
  else
    @d3.JS.interpolateHslLong(a,b)
  end
end

.interpolate_inferno(t = nil) ⇒ Object



40
41
42
43
44
45
46
# File 'lib/opal/d3/sequential_scale.rb', line 40

def interpolate_inferno(t=nil)
  if t
    @d3.JS.interpolateInferno(t)
  else
    `#@d3.interpolateInferno`
  end
end

.interpolate_lab(a = nil, b = nil) ⇒ Object



84
85
86
87
88
89
90
# File 'lib/opal/d3/interpolate.rb', line 84

def interpolate_lab(a=nil,b=nil)
  if a == nil and b == nil
    `#@d3.interpolateLab`
  else
    @d3.JS.interpolateLab(a,b)
  end
end

.interpolate_magma(t = nil) ⇒ Object



48
49
50
51
52
53
54
# File 'lib/opal/d3/sequential_scale.rb', line 48

def interpolate_magma(t=nil)
  if t
    @d3.JS.interpolateMagma(t)
  else
    `#@d3.interpolateMagma`
  end
end

.interpolate_number(a = nil, b = nil) ⇒ Object



3
4
5
6
7
8
9
# File 'lib/opal/d3/interpolate.rb', line 3

def interpolate_number(a=nil,b=nil)
  if a == nil and b == nil
    `#@d3.interpolateNumber`
  else
    @d3.JS.interpolateNumber(a,b)
  end
end

.interpolate_plasma(t = nil) ⇒ Object



56
57
58
59
60
61
62
# File 'lib/opal/d3/sequential_scale.rb', line 56

def interpolate_plasma(t=nil)
  if t
    @d3.JS.interpolatePlasma(t)
  else
    `#@d3.interpolatePlasma`
  end
end

.interpolate_rainbow(t = nil) ⇒ Object



80
81
82
83
84
85
86
# File 'lib/opal/d3/sequential_scale.rb', line 80

def interpolate_rainbow(t=nil)
  if t
    @d3.JS.interpolateRainbow(t)
  else
    `#@d3.interpolateRainbow`
  end
end

.interpolate_rgb(a = nil, b = nil) ⇒ Object

These should support gamma



44
45
46
47
48
49
50
# File 'lib/opal/d3/interpolate.rb', line 44

def interpolate_rgb(a=nil,b=nil)
  if a == nil and b == nil
    `#@d3.interpolateRgb`
  else
    @d3.JS.interpolateRgb(a,b)
  end
end

.interpolate_rgb_basis(a = nil, b = nil) ⇒ Object



52
53
54
55
56
57
58
# File 'lib/opal/d3/interpolate.rb', line 52

def interpolate_rgb_basis(a=nil,b=nil)
  if a == nil and b == nil
    `#@d3.interpolateRgbBasis`
  else
    @d3.JS.interpolateRgbBasis(a,b)
  end
end

.interpolate_rgb_basis_closed(a = nil, b = nil) ⇒ Object



60
61
62
63
64
65
66
# File 'lib/opal/d3/interpolate.rb', line 60

def interpolate_rgb_basis_closed(a=nil,b=nil)
  if a == nil and b == nil
    `#@d3.interpolateRgbBasisClosed`
  else
    @d3.JS.interpolateRgbBasisClosed(a,b)
  end
end

.interpolate_round(a = nil, b = nil) ⇒ Object



11
12
13
14
15
16
17
# File 'lib/opal/d3/interpolate.rb', line 11

def interpolate_round(a=nil,b=nil)
  if a == nil and b == nil
    `#@d3.interpolateRound`
  else
    @d3.JS.interpolateRound(a,b)
  end
end

.interpolate_string(a = nil, b = nil) ⇒ Object



19
20
21
22
23
24
25
# File 'lib/opal/d3/interpolate.rb', line 19

def interpolate_string(a=nil,b=nil)
  if a == nil and b == nil
    `#@d3.interpolateString`
  else
    @d3.JS.interpolateString(a,b)
  end
end

.interpolate_viridis(t = nil) ⇒ Object



32
33
34
35
36
37
38
# File 'lib/opal/d3/sequential_scale.rb', line 32

def interpolate_viridis(t=nil)
  if t
    @d3.JS.interpolateViridis(t)
  else
    `#@d3.interpolateViridis`
  end
end

.interpolate_warm(t = nil) ⇒ Object



64
65
66
67
68
69
70
# File 'lib/opal/d3/sequential_scale.rb', line 64

def interpolate_warm(t=nil)
  if t
    @d3.JS.interpolateWarm(t)
  else
    `#@d3.interpolateWarm`
  end
end

.lab(*args) ⇒ Object



51
52
53
54
55
56
57
58
# File 'lib/opal/d3/color.rb', line 51

def lab(*args)
  color = if args[0].is_a?(Color)
    @d3.JS.lab(args[0].native)
  else
    @d3.JS.lab(*args)
  end
  D3::Color.new(color)
end

.lineObject



25
26
27
# File 'lib/opal/d3/line.rb', line 25

def line
  D3::LineGenerator.new @d3.JS.line
end

.map(object = nil, &block) ⇒ Object



42
43
44
45
46
47
48
49
50
# File 'lib/opal/d3/map.rb', line 42

def map(object=nil, &block)
  if block_given?
    D3::Map.new(@d3.JS.map(object, proc{|x| yield(x)}))
  elsif object
    D3::Map.new(@d3.JS.map(object))
  else
    D3::Map.new(@d3.JS.map())
  end
end

.max(data, &block) ⇒ Object



11
12
13
14
15
16
17
# File 'lib/opal/d3/statistics.rb', line 11

def max(data, &block)
  if block
    @d3.JS.max(data, proc{|x| y=yield(x); y.nil? ? `undefined` : y})
  else
    @d3.JS.max(data.compact)
  end
end

.mean(data, &block) ⇒ Object



27
28
29
30
31
32
33
34
# File 'lib/opal/d3/statistics.rb', line 27

def mean(data, &block)
  result = if block
    @d3.JS.mean(data, proc{|x| y=yield(x); y.nil? ? `undefined` : y})
  else
    @d3.JS.mean(data.compact)
  end
  `result === undefined ? nil : result`
end

.median(data, &block) ⇒ Object



36
37
38
39
40
41
42
43
# File 'lib/opal/d3/statistics.rb', line 36

def median(data, &block)
  result = if block
    @d3.JS.median(data, proc{|x| y=yield(x); y.nil? ? `undefined` : y})
  else
    @d3.JS.median(data.compact)
  end
  `result === undefined ? nil : result`
end

.min(data, &block) ⇒ Object



3
4
5
6
7
8
9
# File 'lib/opal/d3/statistics.rb', line 3

def min(data, &block)
  if block
    @d3.JS.min(data, proc{|x| y=yield(x); y.nil? ? `undefined` : y})
  else
    @d3.JS.min(data.compact)
  end
end

.namespace(name) ⇒ Object



11
12
13
# File 'lib/opal/d3/misc.rb', line 11

def namespace(name)
  `Opal.hash(window.d3.namespace(name))`
end

.namespacesObject



7
8
9
# File 'lib/opal/d3/misc.rb', line 7

def namespaces
  `Opal.hash(window.d3.namespaces)`
end

.nestObject



96
97
98
# File 'lib/opal/d3/nest.rb', line 96

def nest
  D3::Nest.new
end

.pathObject



18
19
20
# File 'lib/opal/d3/path.rb', line 18

def path
  D3::Path.new @d3.JS.path
end

.pieObject



19
20
21
# File 'lib/opal/d3/pie.rb', line 19

def pie
  D3::PieGenerator.new @d3.JS.pie
end

.polygon_hull(points) ⇒ Object



11
12
13
14
# File 'lib/opal/d3/polygon.rb', line 11

def polygon_hull(points)
  hull = @d3.JS.polygonHull(points)
  `hull === null ? nil : hull`
end

.quadtree(*args) ⇒ Object



91
92
93
# File 'lib/opal/d3/quadtree.rb', line 91

def quadtree(*args)
  D3::QuadTree.new @d3.JS.quadtree(*args)
end

.quantile(data, p, &block) ⇒ Object



63
64
65
66
67
68
69
70
# File 'lib/opal/d3/statistics.rb', line 63

def quantile(data, p, &block)
  result = if block
    @d3.JS.quantile(data, p, proc{|x| y=yield(x); y.nil? ? `undefined` : y})
  else
    @d3.JS.quantile(data.compact, p)
  end
  `result === undefined ? nil : result`
end

.radial_areaObject



45
46
47
# File 'lib/opal/d3/radial_area.rb', line 45

def radial_area
  D3::RadialAreaGenerator.new @d3.JS.radialArea
end

.radial_lineObject



25
26
27
# File 'lib/opal/d3/radial_line.rb', line 25

def radial_line
  D3::RadialLineGenerator.new @d3.JS.radialLine
end

.rgb(*args) ⇒ Object



33
34
35
36
37
38
39
40
# File 'lib/opal/d3/color.rb', line 33

def rgb(*args)
  color = if args[0].is_a?(Color)
    @d3.JS.rgb(args[0].native)
  else
    @d3.JS.rgb(*args)
  end
  D3::Color.new(color)
end

.scale_band(*args) ⇒ Object



25
26
27
# File 'lib/opal/d3/band_scale.rb', line 25

def scale_band(*args)
  D3::BandScale.new @d3.JS.scaleBand(*args)
end

.scale_identityObject



52
53
54
# File 'lib/opal/d3/continuous_scale.rb', line 52

def scale_identity
  D3::ContinuousScale.new @d3.JS.scaleIdentity
end

.scale_implicitObject



36
37
38
# File 'lib/opal/d3/ordinal_scale.rb', line 36

def scale_implicit
  :implicit
end

.scale_linearObject



44
45
46
# File 'lib/opal/d3/continuous_scale.rb', line 44

def scale_linear
  D3::ContinuousScale.new @d3.JS.scaleLinear
end

.scale_logObject



48
49
50
# File 'lib/opal/d3/continuous_scale.rb', line 48

def scale_log
  D3::LogScale.new @d3.JS.scaleLog
end

.scale_ordinal(*args) ⇒ Object



32
33
34
# File 'lib/opal/d3/ordinal_scale.rb', line 32

def scale_ordinal(*args)
  D3::OrdinalScale.new @d3.JS.scaleOrdinal(*args)
end

.scale_pointObject



22
23
24
# File 'lib/opal/d3/point_scale.rb', line 22

def scale_point
  D3::PointScale.new @d3.JS.scalePoint
end

.scale_powObject



36
37
38
# File 'lib/opal/d3/continuous_scale.rb', line 36

def scale_pow
  D3::PowScale.new @d3.JS.scalePow
end

.scale_quantileObject



17
18
19
# File 'lib/opal/d3/quantile_scale.rb', line 17

def scale_quantile
  D3::QuantileScale.new @d3.JS.scaleQuantile
end

.scale_quantizeObject



19
20
21
# File 'lib/opal/d3/quantize_scale.rb', line 19

def scale_quantize
  D3::QuantizeScale.new @d3.JS.scaleQuantize
end

.scale_sequential(&block) ⇒ Object



27
28
29
30
# File 'lib/opal/d3/sequential_scale.rb', line 27

def scale_sequential(&block)
  raise unless block_given?
  SequentialScale.new @d3.JS.scaleSequential(block)
end

.scale_sqrtObject



40
41
42
# File 'lib/opal/d3/continuous_scale.rb', line 40

def scale_sqrt
  D3::PowScale.new @d3.JS.scaleSqrt
end

.scale_thresholdObject



19
20
21
# File 'lib/opal/d3/threshold_scale.rb', line 19

def scale_threshold
  D3::ThresholdScale.new @d3.JS.scaleThreshold
end

.scale_timeObject



56
57
58
# File 'lib/opal/d3/continuous_scale.rb', line 56

def scale_time
  D3::ContinuousScale.new @d3.JS.scaleTime
end

.scale_utcObject



60
61
62
# File 'lib/opal/d3/continuous_scale.rb', line 60

def scale_utc
  D3::ContinuousScale.new @d3.JS.scaleUtc
end

.scan(array, &block) ⇒ Object



16
17
18
19
20
21
22
# File 'lib/opal/d3/search.rb', line 16

def scan(array, &block)
  if block_given?
    @d3.JS.scan(array, block)
  else
    @d3.JS.scan(array)
  end
end

.scheme_category_10Object



40
41
42
# File 'lib/opal/d3/ordinal_scale.rb', line 40

def scheme_category_10
  `window.d3.schemeCategory10`
end

.scheme_category_20Object



44
45
46
# File 'lib/opal/d3/ordinal_scale.rb', line 44

def scheme_category_20
  `window.d3.schemeCategory20`
end

.scheme_category_20bObject



48
49
50
# File 'lib/opal/d3/ordinal_scale.rb', line 48

def scheme_category_20b
  `window.d3.schemeCategory20b`
end

.scheme_category_20cObject



52
53
54
# File 'lib/opal/d3/ordinal_scale.rb', line 52

def scheme_category_20c
  `window.d3.schemeCategory20c`
end

.select(selector) ⇒ Object



141
142
143
# File 'lib/opal/d3/selection.rb', line 141

def select(selector)
  D3::Selection.new(@d3.JS.select(selector))
end

.select_all(selector) ⇒ Object



145
146
147
# File 'lib/opal/d3/selection.rb', line 145

def select_all(selector)
  D3::Selection.new(@d3.JS.selectAll(selector))
end

.selectionObject



137
138
139
# File 'lib/opal/d3/selection.rb', line 137

def selection
  D3::Selection.new(@d3.JS.selection)
end

.set(array = nil, &block) ⇒ Object



23
24
25
26
27
28
29
30
31
# File 'lib/opal/d3/set.rb', line 23

def set(array=nil, &block)
  if block_given?
    D3::Set.new @d3.JS.set(array, proc{|x| yield(x)})
  elsif array
    D3::Set.new @d3.JS.set(array)
  else
    D3::Set.new @d3.JS.set()
  end
end

.stackObject



7
8
9
# File 'lib/opal/d3/stack.rb', line 7

def stack
  D3::StackGenerator.new @d3.JS.stack
end

.sum(data, &block) ⇒ Object



19
20
21
22
23
24
25
# File 'lib/opal/d3/statistics.rb', line 19

def sum(data, &block)
  if block
    @d3.JS.sum(data, proc{|x| y=yield(x); y.nil? ? `undefined` : y})
  else
    @d3.JS.sum(data.compact)
  end
end

.symbolObject



34
35
36
# File 'lib/opal/d3/symbol.rb', line 34

def symbol
  D3::SymbolGenerator.new @d3.JS.symbol
end

.symbol_circleObject



42
43
44
# File 'lib/opal/d3/symbol.rb', line 42

def symbol_circle
  D3::SymbolType.new `window.d3.symbolCircle`
end

.symbol_crossObject



46
47
48
# File 'lib/opal/d3/symbol.rb', line 46

def symbol_cross
  D3::SymbolType.new `window.d3.symbolCross`
end

.symbol_diamondObject



50
51
52
# File 'lib/opal/d3/symbol.rb', line 50

def symbol_diamond
  D3::SymbolType.new `window.d3.symbolDiamond`
end

.symbol_squareObject



54
55
56
# File 'lib/opal/d3/symbol.rb', line 54

def symbol_square
  D3::SymbolType.new `window.d3.symbolSquare`
end

.symbol_starObject



58
59
60
# File 'lib/opal/d3/symbol.rb', line 58

def symbol_star
  D3::SymbolType.new `window.d3.symbolStar`
end

.symbol_triangleObject



62
63
64
# File 'lib/opal/d3/symbol.rb', line 62

def symbol_triangle
  D3::SymbolType.new `window.d3.symbolTriangle`
end

.symbol_wyeObject



66
67
68
# File 'lib/opal/d3/symbol.rb', line 66

def symbol_wye
  D3::SymbolType.new `window.d3.symbolWye`
end

.symbolsObject



38
39
40
# File 'lib/opal/d3/symbol.rb', line 38

def symbols
  `window.d3.symbols`.map{|st| D3::SymbolType.new(st)}
end

.threshold_freedman_diaconis(*args) ⇒ Object



32
33
34
# File 'lib/opal/d3/histograms.rb', line 32

def threshold_freedman_diaconis(*args)
  @d3.JS.thresholdFreedmanDiaconis(*args)
end

.threshold_scott(*args) ⇒ Object



36
37
38
# File 'lib/opal/d3/histograms.rb', line 36

def threshold_scott(*args)
  @d3.JS.thresholdScott(*args)
end

.threshold_sturges(*args) ⇒ Object



40
41
42
# File 'lib/opal/d3/histograms.rb', line 40

def threshold_sturges(*args)
  @d3.JS.thresholdSturges(*args)
end

.time_dayObject



39
# File 'lib/opal/d3/time_interval.rb', line 39

def time_day; D3::TimeInterval.new(`window.d3.timeDay`); end

.time_format_default_locale(spec = {}) ⇒ Object



33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/opal/d3/time_format.rb', line 33

def time_format_default_locale(spec={})
  D3::TimeFormatLocale.new @d3.JS.timeFormatDefaultLocale(
    {
      dateTime: spec.fetch(:date_time, "%x, %X"),
      date: spec.fetch(:date, "%-m/%-d/%Y"),
      time: spec.fetch(:time, "%-I:%M:%S %p"),
      periods: spec.fetch(:periods, ["AM", "PM"]),
      days: spec.fetch(:days, ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]),
      shortDays: spec.fetch(:short_days, ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"]),
      months: spec.fetch(:months, ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]),
      shortMonths: spec.fetch(:short_months, ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]),
    }.to_n
  )
end

.time_format_locale(spec = {}) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/opal/d3/time_format.rb', line 18

def time_format_locale(spec={})
  D3::TimeFormatLocale.new @d3.JS.timeFormatLocale(
    {
      dateTime: spec.fetch(:date_time, "%x, %X"),
      date: spec.fetch(:date, "%-m/%-d/%Y"),
      time: spec.fetch(:time, "%-I:%M:%S %p"),
      periods: spec.fetch(:periods, ["AM", "PM"]),
      days: spec.fetch(:days, ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]),
      shortDays: spec.fetch(:short_days, ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"]),
      months: spec.fetch(:months, ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]),
      shortMonths: spec.fetch(:short_months, ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]),
    }.to_n
  )
end

.time_fridayObject



33
# File 'lib/opal/d3/time_interval.rb', line 33

def time_friday; D3::TimeInterval.new(`window.d3.timeFriday`); end

.time_hourObject



41
# File 'lib/opal/d3/time_interval.rb', line 41

def time_hour; D3::TimeInterval.new(`window.d3.timeHour`); end

.time_millisecondObject



47
# File 'lib/opal/d3/time_interval.rb', line 47

def time_millisecond; D3::TimeInterval.new(`window.d3.timeMillisecond`); end

.time_minuteObject



43
# File 'lib/opal/d3/time_interval.rb', line 43

def time_minute; D3::TimeInterval.new(`window.d3.timeMinute`); end

.time_mondayObject



25
# File 'lib/opal/d3/time_interval.rb', line 25

def time_monday; D3::TimeInterval.new(`window.d3.timeMonday`); end

.time_monthObject



21
# File 'lib/opal/d3/time_interval.rb', line 21

def time_month; D3::TimeInterval.new(`window.d3.timeMonth`); end

.time_saturdayObject



35
# File 'lib/opal/d3/time_interval.rb', line 35

def time_saturday; D3::TimeInterval.new(`window.d3.timeSaturday`); end

.time_secondObject



45
# File 'lib/opal/d3/time_interval.rb', line 45

def time_second; D3::TimeInterval.new(`window.d3.timeSecond`); end

.time_sundayObject



37
# File 'lib/opal/d3/time_interval.rb', line 37

def time_sunday; D3::TimeInterval.new(`window.d3.timeSunday`); end

.time_thursdayObject



31
# File 'lib/opal/d3/time_interval.rb', line 31

def time_thursday; D3::TimeInterval.new(`window.d3.timeThursday`); end

.time_tuesdayObject



27
# File 'lib/opal/d3/time_interval.rb', line 27

def time_tuesday; D3::TimeInterval.new(`window.d3.timeTuesday`); end

.time_wednesdayObject



29
# File 'lib/opal/d3/time_interval.rb', line 29

def time_wednesday; D3::TimeInterval.new(`window.d3.timeWednesday`); end

.time_weekObject



23
# File 'lib/opal/d3/time_interval.rb', line 23

def time_week; D3::TimeInterval.new(`window.d3.timeWeek`); end

.time_yearObject



19
# File 'lib/opal/d3/time_interval.rb', line 19

def time_year; D3::TimeInterval.new(`window.d3.timeYear`); end

.tsv_format(rows, columns = `undefined`) ⇒ Object



99
100
101
# File 'lib/opal/d3/dsv.rb', line 99

def tsv_format(rows, columns=`undefined`)
  @d3.JS.tsvFormat(rows.to_n, columns)
end

.tsv_format_rows(rows) ⇒ Object



67
68
69
# File 'lib/opal/d3/dsv.rb', line 67

def tsv_format_rows(rows)
  @d3.JS.tsvFormatRows(rows)
end

.tsv_parse(string, row = `undefined`, &block) ⇒ Object



83
84
85
86
87
88
89
90
91
92
93
# File 'lib/opal/d3/dsv.rb', line 83

def tsv_parse(string, row=`undefined`, &block)
  row = block if block_given?
  if `row !== undefined`
    @d3.JS.tsvParse(string, proc{|e|
      result = row.call(`Opal.hash(e)`)
      result == nil ? `null` : result
    })
  else
    @d3.JS.tsvParse(string).map{|e| `Opal.hash(e)` }
  end
end

.tsv_parse_rows(string, row = `undefined`, &block) ⇒ Object



51
52
53
54
55
56
57
58
59
60
61
# File 'lib/opal/d3/dsv.rb', line 51

def tsv_parse_rows(string, row=`undefined`, &block)
  row = block if block_given?
  if `row !== undefined`
    @d3.JS.tsvParseRows(string, proc{|d|
      result = row.call(d)
      result == nil ? `null` : result
    })
  else
    @d3.JS.tsvParseRows(string)
  end
end

.utc_dayObject



40
# File 'lib/opal/d3/time_interval.rb', line 40

def utc_day; D3::TimeInterval.new(`window.d3.utcDay`); end

.utc_fridayObject



34
# File 'lib/opal/d3/time_interval.rb', line 34

def utc_friday; D3::TimeInterval.new(`window.d3.utcFriday`); end

.utc_hourObject



42
# File 'lib/opal/d3/time_interval.rb', line 42

def utc_hour; D3::TimeInterval.new(`window.d3.utcHour`); end

.utc_millisecondObject



48
# File 'lib/opal/d3/time_interval.rb', line 48

def utc_millisecond; D3::TimeInterval.new(`window.d3.utcMillisecond`); end

.utc_minuteObject



44
# File 'lib/opal/d3/time_interval.rb', line 44

def utc_minute; D3::TimeInterval.new(`window.d3.utcMinute`); end

.utc_mondayObject



26
# File 'lib/opal/d3/time_interval.rb', line 26

def utc_monday; D3::TimeInterval.new(`window.d3.utcMonday`); end

.utc_monthObject



22
# File 'lib/opal/d3/time_interval.rb', line 22

def utc_month; D3::TimeInterval.new(`window.d3.utcMonth`); end

.utc_saturdayObject



36
# File 'lib/opal/d3/time_interval.rb', line 36

def utc_saturday; D3::TimeInterval.new(`window.d3.utcSaturday`); end

.utc_secondObject



46
# File 'lib/opal/d3/time_interval.rb', line 46

def utc_second; D3::TimeInterval.new(`window.d3.utcSecond`); end

.utc_sundayObject



38
# File 'lib/opal/d3/time_interval.rb', line 38

def utc_sunday; D3::TimeInterval.new(`window.d3.utcSunday`); end

.utc_thursdayObject



32
# File 'lib/opal/d3/time_interval.rb', line 32

def utc_thursday; D3::TimeInterval.new(`window.d3.utcThursday`); end

.utc_tuesdayObject



28
# File 'lib/opal/d3/time_interval.rb', line 28

def utc_tuesday; D3::TimeInterval.new(`window.d3.utcTuesday`); end

.utc_wednesdayObject



30
# File 'lib/opal/d3/time_interval.rb', line 30

def utc_wednesday; D3::TimeInterval.new(`window.d3.utcWednesday`); end

.utc_weekObject



24
# File 'lib/opal/d3/time_interval.rb', line 24

def utc_week; D3::TimeInterval.new(`window.d3.utcWeek`); end

.utc_yearObject



20
# File 'lib/opal/d3/time_interval.rb', line 20

def utc_year; D3::TimeInterval.new(`window.d3.utcYear`); end

.variance(data, &block) ⇒ Object



54
55
56
57
58
59
60
61
# File 'lib/opal/d3/statistics.rb', line 54

def variance(data, &block)
  result = if block
    @d3.JS.variance(data, proc{|x| y=yield(x); y.nil? ? `undefined` : y})
  else
    @d3.JS.variance(data.compact)
  end
  `result === undefined ? nil : result`
end

.versionObject



3
4
5
# File 'lib/opal/d3/misc.rb', line 3

def version
  `window.d3.version`
end