d3_rails 3.3.7 → 3.3.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2b0540892ac2d7ea0c74ae84ecca47c934814df3
4
- data.tar.gz: 99dc329cb1bfa9979192624a09877ce2e06ab6f5
3
+ metadata.gz: d8f5d4e2b841111249b38cef68907ef4f1e7b31d
4
+ data.tar.gz: 895bdb19b44512d5258d370322bb59c2fad1c1b6
5
5
  SHA512:
6
- metadata.gz: fc4c810ee9502ac6794573b81608dfddf7a3163ad8ce7082f755d9670e4217325edf3ee365a8d0e0dec10cdb6ba6ee209322273a7e0879c6f7fe44bbb1e95f04
7
- data.tar.gz: fcd92511147ec1c0ef577a857961286fcc4d38318e776ed52ff1dfbcf21a77b679d5e85256974073ed576d43b79c3bbf2215fddc14262b107501a2dd09bdc034
6
+ metadata.gz: cee79d38c2dad3722bd2b2b3f26fec5131b70d0f30ff844be7fd78ae9f2c85a882d26fd7c2bc1f23b3e530e866326577ac0a578a7a20ba8dd5a83a1fefcb6c37
7
+ data.tar.gz: 87fe4909648c9931e416a2cf733400ca160dd27c3b158cb1749cb60e1d5144aab11e323b30978ee0dbb02af0113ba5f7237be2658d10d557841f044743f8c894
data/README.md CHANGED
@@ -1,5 +1,5 @@
1
1
  # D3_Rails
2
- ## Version 3.3.6 (of d3 in most current gem)
2
+ ## Version 3.3.7 (of d3 in most current gem)
3
3
 
4
4
  **D3_Rails** is a small, lightweight gem which allows you to include any
5
5
  and all of D3 Javascripts into your 3.1 Rails application, merely by
@@ -1,6 +1,6 @@
1
1
  d3 = function() {
2
2
  var d3 = {
3
- version: "3.3.7"
3
+ version: "3.3.8"
4
4
  };
5
5
  if (!Date.now) Date.now = function() {
6
6
  return +new Date();
@@ -4150,269 +4150,19 @@ d3 = function() {
4150
4150
  return d3_geo_mercatorProjection(d3_geo_transverseMercator);
4151
4151
  }).raw = d3_geo_transverseMercator;
4152
4152
  d3.geom = {};
4153
- d3.svg = {};
4154
- function d3_svg_line(projection) {
4155
- var x = d3_svg_lineX, y = d3_svg_lineY, defined = d3_true, interpolate = d3_svg_lineLinear, interpolateKey = interpolate.key, tension = .7;
4156
- function line(data) {
4157
- var segments = [], points = [], i = -1, n = data.length, d, fx = d3_functor(x), fy = d3_functor(y);
4158
- function segment() {
4159
- segments.push("M", interpolate(projection(points), tension));
4160
- }
4161
- while (++i < n) {
4162
- if (defined.call(this, d = data[i], i)) {
4163
- points.push([ +fx.call(this, d, i), +fy.call(this, d, i) ]);
4164
- } else if (points.length) {
4165
- segment();
4166
- points = [];
4167
- }
4168
- }
4169
- if (points.length) segment();
4170
- return segments.length ? segments.join("") : null;
4171
- }
4172
- line.x = function(_) {
4173
- if (!arguments.length) return x;
4174
- x = _;
4175
- return line;
4176
- };
4177
- line.y = function(_) {
4178
- if (!arguments.length) return y;
4179
- y = _;
4180
- return line;
4181
- };
4182
- line.defined = function(_) {
4183
- if (!arguments.length) return defined;
4184
- defined = _;
4185
- return line;
4186
- };
4187
- line.interpolate = function(_) {
4188
- if (!arguments.length) return interpolateKey;
4189
- if (typeof _ === "function") interpolateKey = interpolate = _; else interpolateKey = (interpolate = d3_svg_lineInterpolators.get(_) || d3_svg_lineLinear).key;
4190
- return line;
4191
- };
4192
- line.tension = function(_) {
4193
- if (!arguments.length) return tension;
4194
- tension = _;
4195
- return line;
4196
- };
4197
- return line;
4198
- }
4199
- d3.svg.line = function() {
4200
- return d3_svg_line(d3_identity);
4201
- };
4202
- function d3_svg_lineX(d) {
4153
+ function d3_geom_pointX(d) {
4203
4154
  return d[0];
4204
4155
  }
4205
- function d3_svg_lineY(d) {
4156
+ function d3_geom_pointY(d) {
4206
4157
  return d[1];
4207
4158
  }
4208
- var d3_svg_lineInterpolators = d3.map({
4209
- linear: d3_svg_lineLinear,
4210
- "linear-closed": d3_svg_lineLinearClosed,
4211
- step: d3_svg_lineStep,
4212
- "step-before": d3_svg_lineStepBefore,
4213
- "step-after": d3_svg_lineStepAfter,
4214
- basis: d3_svg_lineBasis,
4215
- "basis-open": d3_svg_lineBasisOpen,
4216
- "basis-closed": d3_svg_lineBasisClosed,
4217
- bundle: d3_svg_lineBundle,
4218
- cardinal: d3_svg_lineCardinal,
4219
- "cardinal-open": d3_svg_lineCardinalOpen,
4220
- "cardinal-closed": d3_svg_lineCardinalClosed,
4221
- monotone: d3_svg_lineMonotone
4222
- });
4223
- d3_svg_lineInterpolators.forEach(function(key, value) {
4224
- value.key = key;
4225
- value.closed = /-closed$/.test(key);
4226
- });
4227
- function d3_svg_lineLinear(points) {
4228
- return points.join("L");
4229
- }
4230
- function d3_svg_lineLinearClosed(points) {
4231
- return d3_svg_lineLinear(points) + "Z";
4232
- }
4233
- function d3_svg_lineStep(points) {
4234
- var i = 0, n = points.length, p = points[0], path = [ p[0], ",", p[1] ];
4235
- while (++i < n) path.push("H", (p[0] + (p = points[i])[0]) / 2, "V", p[1]);
4236
- if (n > 1) path.push("H", p[0]);
4237
- return path.join("");
4238
- }
4239
- function d3_svg_lineStepBefore(points) {
4240
- var i = 0, n = points.length, p = points[0], path = [ p[0], ",", p[1] ];
4241
- while (++i < n) path.push("V", (p = points[i])[1], "H", p[0]);
4242
- return path.join("");
4243
- }
4244
- function d3_svg_lineStepAfter(points) {
4245
- var i = 0, n = points.length, p = points[0], path = [ p[0], ",", p[1] ];
4246
- while (++i < n) path.push("H", (p = points[i])[0], "V", p[1]);
4247
- return path.join("");
4248
- }
4249
- function d3_svg_lineCardinalOpen(points, tension) {
4250
- return points.length < 4 ? d3_svg_lineLinear(points) : points[1] + d3_svg_lineHermite(points.slice(1, points.length - 1), d3_svg_lineCardinalTangents(points, tension));
4251
- }
4252
- function d3_svg_lineCardinalClosed(points, tension) {
4253
- return points.length < 3 ? d3_svg_lineLinear(points) : points[0] + d3_svg_lineHermite((points.push(points[0]),
4254
- points), d3_svg_lineCardinalTangents([ points[points.length - 2] ].concat(points, [ points[1] ]), tension));
4255
- }
4256
- function d3_svg_lineCardinal(points, tension) {
4257
- return points.length < 3 ? d3_svg_lineLinear(points) : points[0] + d3_svg_lineHermite(points, d3_svg_lineCardinalTangents(points, tension));
4258
- }
4259
- function d3_svg_lineHermite(points, tangents) {
4260
- if (tangents.length < 1 || points.length != tangents.length && points.length != tangents.length + 2) {
4261
- return d3_svg_lineLinear(points);
4262
- }
4263
- var quad = points.length != tangents.length, path = "", p0 = points[0], p = points[1], t0 = tangents[0], t = t0, pi = 1;
4264
- if (quad) {
4265
- path += "Q" + (p[0] - t0[0] * 2 / 3) + "," + (p[1] - t0[1] * 2 / 3) + "," + p[0] + "," + p[1];
4266
- p0 = points[1];
4267
- pi = 2;
4268
- }
4269
- if (tangents.length > 1) {
4270
- t = tangents[1];
4271
- p = points[pi];
4272
- pi++;
4273
- path += "C" + (p0[0] + t0[0]) + "," + (p0[1] + t0[1]) + "," + (p[0] - t[0]) + "," + (p[1] - t[1]) + "," + p[0] + "," + p[1];
4274
- for (var i = 2; i < tangents.length; i++, pi++) {
4275
- p = points[pi];
4276
- t = tangents[i];
4277
- path += "S" + (p[0] - t[0]) + "," + (p[1] - t[1]) + "," + p[0] + "," + p[1];
4278
- }
4279
- }
4280
- if (quad) {
4281
- var lp = points[pi];
4282
- path += "Q" + (p[0] + t[0] * 2 / 3) + "," + (p[1] + t[1] * 2 / 3) + "," + lp[0] + "," + lp[1];
4283
- }
4284
- return path;
4285
- }
4286
- function d3_svg_lineCardinalTangents(points, tension) {
4287
- var tangents = [], a = (1 - tension) / 2, p0, p1 = points[0], p2 = points[1], i = 1, n = points.length;
4288
- while (++i < n) {
4289
- p0 = p1;
4290
- p1 = p2;
4291
- p2 = points[i];
4292
- tangents.push([ a * (p2[0] - p0[0]), a * (p2[1] - p0[1]) ]);
4293
- }
4294
- return tangents;
4295
- }
4296
- function d3_svg_lineBasis(points) {
4297
- if (points.length < 3) return d3_svg_lineLinear(points);
4298
- var i = 1, n = points.length, pi = points[0], x0 = pi[0], y0 = pi[1], px = [ x0, x0, x0, (pi = points[1])[0] ], py = [ y0, y0, y0, pi[1] ], path = [ x0, ",", y0, "L", d3_svg_lineDot4(d3_svg_lineBasisBezier3, px), ",", d3_svg_lineDot4(d3_svg_lineBasisBezier3, py) ];
4299
- points.push(points[n - 1]);
4300
- while (++i <= n) {
4301
- pi = points[i];
4302
- px.shift();
4303
- px.push(pi[0]);
4304
- py.shift();
4305
- py.push(pi[1]);
4306
- d3_svg_lineBasisBezier(path, px, py);
4307
- }
4308
- points.pop();
4309
- path.push("L", pi);
4310
- return path.join("");
4311
- }
4312
- function d3_svg_lineBasisOpen(points) {
4313
- if (points.length < 4) return d3_svg_lineLinear(points);
4314
- var path = [], i = -1, n = points.length, pi, px = [ 0 ], py = [ 0 ];
4315
- while (++i < 3) {
4316
- pi = points[i];
4317
- px.push(pi[0]);
4318
- py.push(pi[1]);
4319
- }
4320
- path.push(d3_svg_lineDot4(d3_svg_lineBasisBezier3, px) + "," + d3_svg_lineDot4(d3_svg_lineBasisBezier3, py));
4321
- --i;
4322
- while (++i < n) {
4323
- pi = points[i];
4324
- px.shift();
4325
- px.push(pi[0]);
4326
- py.shift();
4327
- py.push(pi[1]);
4328
- d3_svg_lineBasisBezier(path, px, py);
4329
- }
4330
- return path.join("");
4331
- }
4332
- function d3_svg_lineBasisClosed(points) {
4333
- var path, i = -1, n = points.length, m = n + 4, pi, px = [], py = [];
4334
- while (++i < 4) {
4335
- pi = points[i % n];
4336
- px.push(pi[0]);
4337
- py.push(pi[1]);
4338
- }
4339
- path = [ d3_svg_lineDot4(d3_svg_lineBasisBezier3, px), ",", d3_svg_lineDot4(d3_svg_lineBasisBezier3, py) ];
4340
- --i;
4341
- while (++i < m) {
4342
- pi = points[i % n];
4343
- px.shift();
4344
- px.push(pi[0]);
4345
- py.shift();
4346
- py.push(pi[1]);
4347
- d3_svg_lineBasisBezier(path, px, py);
4348
- }
4349
- return path.join("");
4350
- }
4351
- function d3_svg_lineBundle(points, tension) {
4352
- var n = points.length - 1;
4353
- if (n) {
4354
- var x0 = points[0][0], y0 = points[0][1], dx = points[n][0] - x0, dy = points[n][1] - y0, i = -1, p, t;
4355
- while (++i <= n) {
4356
- p = points[i];
4357
- t = i / n;
4358
- p[0] = tension * p[0] + (1 - tension) * (x0 + t * dx);
4359
- p[1] = tension * p[1] + (1 - tension) * (y0 + t * dy);
4360
- }
4361
- }
4362
- return d3_svg_lineBasis(points);
4363
- }
4364
- function d3_svg_lineDot4(a, b) {
4365
- return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3];
4366
- }
4367
- var d3_svg_lineBasisBezier1 = [ 0, 2 / 3, 1 / 3, 0 ], d3_svg_lineBasisBezier2 = [ 0, 1 / 3, 2 / 3, 0 ], d3_svg_lineBasisBezier3 = [ 0, 1 / 6, 2 / 3, 1 / 6 ];
4368
- function d3_svg_lineBasisBezier(path, x, y) {
4369
- path.push("C", d3_svg_lineDot4(d3_svg_lineBasisBezier1, x), ",", d3_svg_lineDot4(d3_svg_lineBasisBezier1, y), ",", d3_svg_lineDot4(d3_svg_lineBasisBezier2, x), ",", d3_svg_lineDot4(d3_svg_lineBasisBezier2, y), ",", d3_svg_lineDot4(d3_svg_lineBasisBezier3, x), ",", d3_svg_lineDot4(d3_svg_lineBasisBezier3, y));
4370
- }
4371
- function d3_svg_lineSlope(p0, p1) {
4372
- return (p1[1] - p0[1]) / (p1[0] - p0[0]);
4373
- }
4374
- function d3_svg_lineFiniteDifferences(points) {
4375
- var i = 0, j = points.length - 1, m = [], p0 = points[0], p1 = points[1], d = m[0] = d3_svg_lineSlope(p0, p1);
4376
- while (++i < j) {
4377
- m[i] = (d + (d = d3_svg_lineSlope(p0 = p1, p1 = points[i + 1]))) / 2;
4378
- }
4379
- m[i] = d;
4380
- return m;
4381
- }
4382
- function d3_svg_lineMonotoneTangents(points) {
4383
- var tangents = [], d, a, b, s, m = d3_svg_lineFiniteDifferences(points), i = -1, j = points.length - 1;
4384
- while (++i < j) {
4385
- d = d3_svg_lineSlope(points[i], points[i + 1]);
4386
- if (abs(d) < ε) {
4387
- m[i] = m[i + 1] = 0;
4388
- } else {
4389
- a = m[i] / d;
4390
- b = m[i + 1] / d;
4391
- s = a * a + b * b;
4392
- if (s > 9) {
4393
- s = d * 3 / Math.sqrt(s);
4394
- m[i] = s * a;
4395
- m[i + 1] = s * b;
4396
- }
4397
- }
4398
- }
4399
- i = -1;
4400
- while (++i <= j) {
4401
- s = (points[Math.min(j, i + 1)][0] - points[Math.max(0, i - 1)][0]) / (6 * (1 + m[i] * m[i]));
4402
- tangents.push([ s || 0, m[i] * s || 0 ]);
4403
- }
4404
- return tangents;
4405
- }
4406
- function d3_svg_lineMonotone(points) {
4407
- return points.length < 3 ? d3_svg_lineLinear(points) : points[0] + d3_svg_lineHermite(points, d3_svg_lineMonotoneTangents(points));
4408
- }
4409
4159
  d3.geom.hull = function(vertices) {
4410
- var x = d3_svg_lineX, y = d3_svg_lineY;
4160
+ var x = d3_geom_pointX, y = d3_geom_pointY;
4411
4161
  if (arguments.length) return hull(vertices);
4412
4162
  function hull(data) {
4413
4163
  if (data.length < 3) return [];
4414
4164
  var fx = d3_functor(x), fy = d3_functor(y), n = data.length, vertices, plen = n - 1, points = [], stack = [], d, i, j, h = 0, x1, y1, x2, y2, u, v, a, sp;
4415
- if (fx === d3_svg_lineX && y === d3_svg_lineY) vertices = data; else for (i = 0,
4165
+ if (fx === d3_geom_pointX && y === d3_geom_pointY) vertices = data; else for (i = 0,
4416
4166
  vertices = []; i < n; ++i) {
4417
4167
  vertices.push([ +fx.call(this, d = data[i], i), +fy.call(this, d, i) ]);
4418
4168
  }
@@ -5130,23 +4880,24 @@ d3 = function() {
5130
4880
  return b.y - a.y || b.x - a.x;
5131
4881
  }
5132
4882
  d3.geom.voronoi = function(points) {
5133
- var x = d3_svg_lineX, y = d3_svg_lineY, fx = x, fy = y, clipExtent = d3_geom_voronoiClipExtent;
4883
+ var x = d3_geom_pointX, y = d3_geom_pointY, fx = x, fy = y, clipExtent = d3_geom_voronoiClipExtent;
5134
4884
  if (points) return voronoi(points);
5135
4885
  function voronoi(data) {
5136
- var polygons = [];
4886
+ var polygons = new Array(data.length), x0 = clipExtent[0][0], y0 = clipExtent[0][1], x1 = clipExtent[1][0], y1 = clipExtent[1][1];
5137
4887
  d3_geom_voronoi(sites(data), clipExtent).cells.forEach(function(cell, i) {
5138
- (polygons[i] = cell.edges.length ? cell.edges.map(function(edge) {
5139
- var start = edge.start();
5140
- return [ start.x, start.y ];
5141
- }) : [ [ clipExtent[0][0], clipExtent[1][1] ], [ clipExtent[1][0], clipExtent[1][1] ], [ clipExtent[1][0], clipExtent[0][1] ], [ clipExtent[0][0], clipExtent[0][1] ] ]).point = data[i];
4888
+ var edges = cell.edges, site = cell.site, polygon = polygons[i] = edges.length ? edges.map(function(e) {
4889
+ var s = e.start();
4890
+ return [ s.x, s.y ];
4891
+ }) : site.x >= x0 && site.x <= x1 && site.y >= y0 && site.y <= y1 ? [ [ x0, y1 ], [ x1, y1 ], [ x1, y0 ], [ x0, y0 ] ] : [];
4892
+ polygon.point = data[i];
5142
4893
  });
5143
4894
  return polygons;
5144
4895
  }
5145
4896
  function sites(data) {
5146
4897
  return data.map(function(d, i) {
5147
4898
  return {
5148
- x: fx(d, i),
5149
- y: fy(d, i),
4899
+ x: Math.round(fx(d, i) / ε) * ε,
4900
+ y: Math.round(fy(d, i) / ε) * ε,
5150
4901
  i: i
5151
4902
  };
5152
4903
  });
@@ -5202,7 +4953,7 @@ d3 = function() {
5202
4953
  return d3.geom.voronoi().triangles(vertices);
5203
4954
  };
5204
4955
  d3.geom.quadtree = function(points, x1, y1, x2, y2) {
5205
- var x = d3_svg_lineX, y = d3_svg_lineY, compat;
4956
+ var x = d3_geom_pointX, y = d3_geom_pointY, compat;
5206
4957
  if (compat = arguments.length) {
5207
4958
  x = d3_geom_quadtreeCompatX;
5208
4959
  y = d3_geom_quadtreeCompatY;
@@ -6109,17 +5860,19 @@ d3 = function() {
6109
5860
  node.depth = depth;
6110
5861
  nodes.push(node);
6111
5862
  if (childs && (n = childs.length)) {
6112
- var i = -1, n, c = node.children = [], v = 0, j = depth + 1, d;
5863
+ var i = -1, n, c = node.children = new Array(n), v = 0, j = depth + 1, d;
6113
5864
  while (++i < n) {
6114
- d = recurse(childs[i], j, nodes);
5865
+ d = c[i] = recurse(childs[i], j, nodes);
6115
5866
  d.parent = node;
6116
- c.push(d);
6117
5867
  v += d.value;
6118
5868
  }
6119
5869
  if (sort) c.sort(sort);
6120
5870
  if (value) node.value = v;
6121
- } else if (value) {
6122
- node.value = +value.call(hierarchy, node, depth) || 0;
5871
+ } else {
5872
+ delete node.children;
5873
+ if (value) {
5874
+ node.value = +value.call(hierarchy, node, depth) || 0;
5875
+ }
6123
5876
  }
6124
5877
  return node;
6125
5878
  }
@@ -7544,6 +7297,7 @@ d3 = function() {
7544
7297
  };
7545
7298
  return identity;
7546
7299
  }
7300
+ d3.svg = {};
7547
7301
  d3.svg.arc = function() {
7548
7302
  var innerRadius = d3_svg_arcInnerRadius, outerRadius = d3_svg_arcOuterRadius, startAngle = d3_svg_arcStartAngle, endAngle = d3_svg_arcEndAngle;
7549
7303
  function arc() {
@@ -7590,6 +7344,255 @@ d3 = function() {
7590
7344
  function d3_svg_arcEndAngle(d) {
7591
7345
  return d.endAngle;
7592
7346
  }
7347
+ function d3_svg_line(projection) {
7348
+ var x = d3_geom_pointX, y = d3_geom_pointY, defined = d3_true, interpolate = d3_svg_lineLinear, interpolateKey = interpolate.key, tension = .7;
7349
+ function line(data) {
7350
+ var segments = [], points = [], i = -1, n = data.length, d, fx = d3_functor(x), fy = d3_functor(y);
7351
+ function segment() {
7352
+ segments.push("M", interpolate(projection(points), tension));
7353
+ }
7354
+ while (++i < n) {
7355
+ if (defined.call(this, d = data[i], i)) {
7356
+ points.push([ +fx.call(this, d, i), +fy.call(this, d, i) ]);
7357
+ } else if (points.length) {
7358
+ segment();
7359
+ points = [];
7360
+ }
7361
+ }
7362
+ if (points.length) segment();
7363
+ return segments.length ? segments.join("") : null;
7364
+ }
7365
+ line.x = function(_) {
7366
+ if (!arguments.length) return x;
7367
+ x = _;
7368
+ return line;
7369
+ };
7370
+ line.y = function(_) {
7371
+ if (!arguments.length) return y;
7372
+ y = _;
7373
+ return line;
7374
+ };
7375
+ line.defined = function(_) {
7376
+ if (!arguments.length) return defined;
7377
+ defined = _;
7378
+ return line;
7379
+ };
7380
+ line.interpolate = function(_) {
7381
+ if (!arguments.length) return interpolateKey;
7382
+ if (typeof _ === "function") interpolateKey = interpolate = _; else interpolateKey = (interpolate = d3_svg_lineInterpolators.get(_) || d3_svg_lineLinear).key;
7383
+ return line;
7384
+ };
7385
+ line.tension = function(_) {
7386
+ if (!arguments.length) return tension;
7387
+ tension = _;
7388
+ return line;
7389
+ };
7390
+ return line;
7391
+ }
7392
+ d3.svg.line = function() {
7393
+ return d3_svg_line(d3_identity);
7394
+ };
7395
+ var d3_svg_lineInterpolators = d3.map({
7396
+ linear: d3_svg_lineLinear,
7397
+ "linear-closed": d3_svg_lineLinearClosed,
7398
+ step: d3_svg_lineStep,
7399
+ "step-before": d3_svg_lineStepBefore,
7400
+ "step-after": d3_svg_lineStepAfter,
7401
+ basis: d3_svg_lineBasis,
7402
+ "basis-open": d3_svg_lineBasisOpen,
7403
+ "basis-closed": d3_svg_lineBasisClosed,
7404
+ bundle: d3_svg_lineBundle,
7405
+ cardinal: d3_svg_lineCardinal,
7406
+ "cardinal-open": d3_svg_lineCardinalOpen,
7407
+ "cardinal-closed": d3_svg_lineCardinalClosed,
7408
+ monotone: d3_svg_lineMonotone
7409
+ });
7410
+ d3_svg_lineInterpolators.forEach(function(key, value) {
7411
+ value.key = key;
7412
+ value.closed = /-closed$/.test(key);
7413
+ });
7414
+ function d3_svg_lineLinear(points) {
7415
+ return points.join("L");
7416
+ }
7417
+ function d3_svg_lineLinearClosed(points) {
7418
+ return d3_svg_lineLinear(points) + "Z";
7419
+ }
7420
+ function d3_svg_lineStep(points) {
7421
+ var i = 0, n = points.length, p = points[0], path = [ p[0], ",", p[1] ];
7422
+ while (++i < n) path.push("H", (p[0] + (p = points[i])[0]) / 2, "V", p[1]);
7423
+ if (n > 1) path.push("H", p[0]);
7424
+ return path.join("");
7425
+ }
7426
+ function d3_svg_lineStepBefore(points) {
7427
+ var i = 0, n = points.length, p = points[0], path = [ p[0], ",", p[1] ];
7428
+ while (++i < n) path.push("V", (p = points[i])[1], "H", p[0]);
7429
+ return path.join("");
7430
+ }
7431
+ function d3_svg_lineStepAfter(points) {
7432
+ var i = 0, n = points.length, p = points[0], path = [ p[0], ",", p[1] ];
7433
+ while (++i < n) path.push("H", (p = points[i])[0], "V", p[1]);
7434
+ return path.join("");
7435
+ }
7436
+ function d3_svg_lineCardinalOpen(points, tension) {
7437
+ return points.length < 4 ? d3_svg_lineLinear(points) : points[1] + d3_svg_lineHermite(points.slice(1, points.length - 1), d3_svg_lineCardinalTangents(points, tension));
7438
+ }
7439
+ function d3_svg_lineCardinalClosed(points, tension) {
7440
+ return points.length < 3 ? d3_svg_lineLinear(points) : points[0] + d3_svg_lineHermite((points.push(points[0]),
7441
+ points), d3_svg_lineCardinalTangents([ points[points.length - 2] ].concat(points, [ points[1] ]), tension));
7442
+ }
7443
+ function d3_svg_lineCardinal(points, tension) {
7444
+ return points.length < 3 ? d3_svg_lineLinear(points) : points[0] + d3_svg_lineHermite(points, d3_svg_lineCardinalTangents(points, tension));
7445
+ }
7446
+ function d3_svg_lineHermite(points, tangents) {
7447
+ if (tangents.length < 1 || points.length != tangents.length && points.length != tangents.length + 2) {
7448
+ return d3_svg_lineLinear(points);
7449
+ }
7450
+ var quad = points.length != tangents.length, path = "", p0 = points[0], p = points[1], t0 = tangents[0], t = t0, pi = 1;
7451
+ if (quad) {
7452
+ path += "Q" + (p[0] - t0[0] * 2 / 3) + "," + (p[1] - t0[1] * 2 / 3) + "," + p[0] + "," + p[1];
7453
+ p0 = points[1];
7454
+ pi = 2;
7455
+ }
7456
+ if (tangents.length > 1) {
7457
+ t = tangents[1];
7458
+ p = points[pi];
7459
+ pi++;
7460
+ path += "C" + (p0[0] + t0[0]) + "," + (p0[1] + t0[1]) + "," + (p[0] - t[0]) + "," + (p[1] - t[1]) + "," + p[0] + "," + p[1];
7461
+ for (var i = 2; i < tangents.length; i++, pi++) {
7462
+ p = points[pi];
7463
+ t = tangents[i];
7464
+ path += "S" + (p[0] - t[0]) + "," + (p[1] - t[1]) + "," + p[0] + "," + p[1];
7465
+ }
7466
+ }
7467
+ if (quad) {
7468
+ var lp = points[pi];
7469
+ path += "Q" + (p[0] + t[0] * 2 / 3) + "," + (p[1] + t[1] * 2 / 3) + "," + lp[0] + "," + lp[1];
7470
+ }
7471
+ return path;
7472
+ }
7473
+ function d3_svg_lineCardinalTangents(points, tension) {
7474
+ var tangents = [], a = (1 - tension) / 2, p0, p1 = points[0], p2 = points[1], i = 1, n = points.length;
7475
+ while (++i < n) {
7476
+ p0 = p1;
7477
+ p1 = p2;
7478
+ p2 = points[i];
7479
+ tangents.push([ a * (p2[0] - p0[0]), a * (p2[1] - p0[1]) ]);
7480
+ }
7481
+ return tangents;
7482
+ }
7483
+ function d3_svg_lineBasis(points) {
7484
+ if (points.length < 3) return d3_svg_lineLinear(points);
7485
+ var i = 1, n = points.length, pi = points[0], x0 = pi[0], y0 = pi[1], px = [ x0, x0, x0, (pi = points[1])[0] ], py = [ y0, y0, y0, pi[1] ], path = [ x0, ",", y0, "L", d3_svg_lineDot4(d3_svg_lineBasisBezier3, px), ",", d3_svg_lineDot4(d3_svg_lineBasisBezier3, py) ];
7486
+ points.push(points[n - 1]);
7487
+ while (++i <= n) {
7488
+ pi = points[i];
7489
+ px.shift();
7490
+ px.push(pi[0]);
7491
+ py.shift();
7492
+ py.push(pi[1]);
7493
+ d3_svg_lineBasisBezier(path, px, py);
7494
+ }
7495
+ points.pop();
7496
+ path.push("L", pi);
7497
+ return path.join("");
7498
+ }
7499
+ function d3_svg_lineBasisOpen(points) {
7500
+ if (points.length < 4) return d3_svg_lineLinear(points);
7501
+ var path = [], i = -1, n = points.length, pi, px = [ 0 ], py = [ 0 ];
7502
+ while (++i < 3) {
7503
+ pi = points[i];
7504
+ px.push(pi[0]);
7505
+ py.push(pi[1]);
7506
+ }
7507
+ path.push(d3_svg_lineDot4(d3_svg_lineBasisBezier3, px) + "," + d3_svg_lineDot4(d3_svg_lineBasisBezier3, py));
7508
+ --i;
7509
+ while (++i < n) {
7510
+ pi = points[i];
7511
+ px.shift();
7512
+ px.push(pi[0]);
7513
+ py.shift();
7514
+ py.push(pi[1]);
7515
+ d3_svg_lineBasisBezier(path, px, py);
7516
+ }
7517
+ return path.join("");
7518
+ }
7519
+ function d3_svg_lineBasisClosed(points) {
7520
+ var path, i = -1, n = points.length, m = n + 4, pi, px = [], py = [];
7521
+ while (++i < 4) {
7522
+ pi = points[i % n];
7523
+ px.push(pi[0]);
7524
+ py.push(pi[1]);
7525
+ }
7526
+ path = [ d3_svg_lineDot4(d3_svg_lineBasisBezier3, px), ",", d3_svg_lineDot4(d3_svg_lineBasisBezier3, py) ];
7527
+ --i;
7528
+ while (++i < m) {
7529
+ pi = points[i % n];
7530
+ px.shift();
7531
+ px.push(pi[0]);
7532
+ py.shift();
7533
+ py.push(pi[1]);
7534
+ d3_svg_lineBasisBezier(path, px, py);
7535
+ }
7536
+ return path.join("");
7537
+ }
7538
+ function d3_svg_lineBundle(points, tension) {
7539
+ var n = points.length - 1;
7540
+ if (n) {
7541
+ var x0 = points[0][0], y0 = points[0][1], dx = points[n][0] - x0, dy = points[n][1] - y0, i = -1, p, t;
7542
+ while (++i <= n) {
7543
+ p = points[i];
7544
+ t = i / n;
7545
+ p[0] = tension * p[0] + (1 - tension) * (x0 + t * dx);
7546
+ p[1] = tension * p[1] + (1 - tension) * (y0 + t * dy);
7547
+ }
7548
+ }
7549
+ return d3_svg_lineBasis(points);
7550
+ }
7551
+ function d3_svg_lineDot4(a, b) {
7552
+ return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3];
7553
+ }
7554
+ var d3_svg_lineBasisBezier1 = [ 0, 2 / 3, 1 / 3, 0 ], d3_svg_lineBasisBezier2 = [ 0, 1 / 3, 2 / 3, 0 ], d3_svg_lineBasisBezier3 = [ 0, 1 / 6, 2 / 3, 1 / 6 ];
7555
+ function d3_svg_lineBasisBezier(path, x, y) {
7556
+ path.push("C", d3_svg_lineDot4(d3_svg_lineBasisBezier1, x), ",", d3_svg_lineDot4(d3_svg_lineBasisBezier1, y), ",", d3_svg_lineDot4(d3_svg_lineBasisBezier2, x), ",", d3_svg_lineDot4(d3_svg_lineBasisBezier2, y), ",", d3_svg_lineDot4(d3_svg_lineBasisBezier3, x), ",", d3_svg_lineDot4(d3_svg_lineBasisBezier3, y));
7557
+ }
7558
+ function d3_svg_lineSlope(p0, p1) {
7559
+ return (p1[1] - p0[1]) / (p1[0] - p0[0]);
7560
+ }
7561
+ function d3_svg_lineFiniteDifferences(points) {
7562
+ var i = 0, j = points.length - 1, m = [], p0 = points[0], p1 = points[1], d = m[0] = d3_svg_lineSlope(p0, p1);
7563
+ while (++i < j) {
7564
+ m[i] = (d + (d = d3_svg_lineSlope(p0 = p1, p1 = points[i + 1]))) / 2;
7565
+ }
7566
+ m[i] = d;
7567
+ return m;
7568
+ }
7569
+ function d3_svg_lineMonotoneTangents(points) {
7570
+ var tangents = [], d, a, b, s, m = d3_svg_lineFiniteDifferences(points), i = -1, j = points.length - 1;
7571
+ while (++i < j) {
7572
+ d = d3_svg_lineSlope(points[i], points[i + 1]);
7573
+ if (abs(d) < ε) {
7574
+ m[i] = m[i + 1] = 0;
7575
+ } else {
7576
+ a = m[i] / d;
7577
+ b = m[i + 1] / d;
7578
+ s = a * a + b * b;
7579
+ if (s > 9) {
7580
+ s = d * 3 / Math.sqrt(s);
7581
+ m[i] = s * a;
7582
+ m[i + 1] = s * b;
7583
+ }
7584
+ }
7585
+ }
7586
+ i = -1;
7587
+ while (++i <= j) {
7588
+ s = (points[Math.min(j, i + 1)][0] - points[Math.max(0, i - 1)][0]) / (6 * (1 + m[i] * m[i]));
7589
+ tangents.push([ s || 0, m[i] * s || 0 ]);
7590
+ }
7591
+ return tangents;
7592
+ }
7593
+ function d3_svg_lineMonotone(points) {
7594
+ return points.length < 3 ? d3_svg_lineLinear(points) : points[0] + d3_svg_lineHermite(points, d3_svg_lineMonotoneTangents(points));
7595
+ }
7593
7596
  d3.svg.line.radial = function() {
7594
7597
  var line = d3_svg_line(d3_svg_lineRadial);
7595
7598
  line.radius = line.x, delete line.x;
@@ -7608,7 +7611,7 @@ d3 = function() {
7608
7611
  return points;
7609
7612
  }
7610
7613
  function d3_svg_area(projection) {
7611
- var x0 = d3_svg_lineX, x1 = d3_svg_lineX, y0 = 0, y1 = d3_svg_lineY, defined = d3_true, interpolate = d3_svg_lineLinear, interpolateKey = interpolate.key, interpolateReverse = interpolate, L = "L", tension = .7;
7614
+ var x0 = d3_geom_pointX, x1 = d3_geom_pointX, y0 = 0, y1 = d3_geom_pointY, defined = d3_true, interpolate = d3_svg_lineLinear, interpolateKey = interpolate.key, interpolateReverse = interpolate, L = "L", tension = .7;
7612
7615
  function area(data) {
7613
7616
  var segments = [], points0 = [], points1 = [], i = -1, n = data.length, d, fx0 = d3_functor(x0), fy0 = d3_functor(y0), fx1 = x0 === x1 ? function() {
7614
7617
  return x;