d3_rails 3.4.12 → 3.4.13

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: 5a866284ed74601277c56f97e30a548a33e7b496
4
- data.tar.gz: 3ff0ac715a3b2b52808195bf8a880aff16e99bce
3
+ metadata.gz: 9d37fd1b298532d28388dc70dcbb683601833dd4
4
+ data.tar.gz: 6d741120dd5ae4616e53ac4e073bddfd7f04aac3
5
5
  SHA512:
6
- metadata.gz: 0137880bc6f6dcf1086d04263dc60903acc01ed4722105c59c76f6be385c26770e7e34a1f024dd9529d9ec8bc5d6c5658458bd8cb96bd4192c8ab555dd630f54
7
- data.tar.gz: 0925ac799a8171ca1a293f550c7e76e3986ba97d6ef7109c7d1be9592b614bc159eb804ff243438135c4e7eabc89e53044288590b7d8a39b0270fe0f2018061c
6
+ metadata.gz: 9abc200f85d156050e5f9d978c29d9f73767ec2a1aad4830a2c0b429d98385a3d2f5c905764a6334b426982ad9e1dfb4aaa5c89acbf2e1c286c1384869eccab4
7
+ data.tar.gz: a26d3cff8f3dac03d478d9b53a7963b771728d5709583a735897303bbe7aea5c5ab8d6fe533318738b8fa6ddf146019991a29a5bc1eebfe7e91be16534307f44
@@ -1,6 +1,6 @@
1
1
  !function() {
2
2
  var d3 = {
3
- version: "3.4.12"
3
+ version: "3.4.13"
4
4
  };
5
5
  if (!Date.now) Date.now = function() {
6
6
  return +new Date();
@@ -78,24 +78,27 @@
78
78
  }
79
79
  return [ a, c ];
80
80
  };
81
+ function d3_number(x) {
82
+ return x === null ? NaN : +x;
83
+ }
84
+ function d3_numeric(x) {
85
+ return !isNaN(x);
86
+ }
81
87
  d3.sum = function(array, f) {
82
88
  var s = 0, n = array.length, a, i = -1;
83
89
  if (arguments.length === 1) {
84
- while (++i < n) if (!isNaN(a = +array[i])) s += a;
90
+ while (++i < n) if (d3_numeric(a = +array[i])) s += a;
85
91
  } else {
86
- while (++i < n) if (!isNaN(a = +f.call(array, array[i], i))) s += a;
92
+ while (++i < n) if (d3_numeric(a = +f.call(array, array[i], i))) s += a;
87
93
  }
88
94
  return s;
89
95
  };
90
- function d3_number(x) {
91
- return x != null && !isNaN(x);
92
- }
93
96
  d3.mean = function(array, f) {
94
97
  var s = 0, n = array.length, a, i = -1, j = n;
95
98
  if (arguments.length === 1) {
96
- while (++i < n) if (d3_number(a = array[i])) s += a; else --j;
99
+ while (++i < n) if (d3_numeric(a = d3_number(array[i]))) s += a; else --j;
97
100
  } else {
98
- while (++i < n) if (d3_number(a = f.call(array, array[i], i))) s += a; else --j;
101
+ while (++i < n) if (d3_numeric(a = d3_number(f.call(array, array[i], i)))) s += a; else --j;
99
102
  }
100
103
  return j ? s / j : undefined;
101
104
  };
@@ -104,9 +107,13 @@
104
107
  return e ? v + e * (values[h] - v) : v;
105
108
  };
106
109
  d3.median = function(array, f) {
107
- if (arguments.length > 1) array = array.map(f);
108
- array = array.filter(d3_number);
109
- return array.length ? d3.quantile(array.sort(d3_ascending), .5) : undefined;
110
+ var numbers = [], n = array.length, a, i = -1;
111
+ if (arguments.length === 1) {
112
+ while (++i < n) if (d3_numeric(a = d3_number(array[i]))) numbers.push(a);
113
+ } else {
114
+ while (++i < n) if (d3_numeric(a = d3_number(f.call(array, array[i], i)))) numbers.push(a);
115
+ }
116
+ return numbers.length ? d3.quantile(numbers.sort(d3_ascending), .5) : undefined;
110
117
  };
111
118
  function d3_bisector(compare) {
112
119
  return {
@@ -223,15 +230,11 @@
223
230
  return k;
224
231
  }
225
232
  function d3_class(ctor, properties) {
226
- try {
227
- for (var key in properties) {
228
- Object.defineProperty(ctor.prototype, key, {
229
- value: properties[key],
230
- enumerable: false
231
- });
232
- }
233
- } catch (e) {
234
- ctor.prototype = properties;
233
+ for (var key in properties) {
234
+ Object.defineProperty(ctor.prototype, key, {
235
+ value: properties[key],
236
+ enumerable: false
237
+ });
235
238
  }
236
239
  }
237
240
  d3.map = function(object) {
@@ -241,62 +244,63 @@
241
244
  }); else for (var key in object) map.set(key, object[key]);
242
245
  return map;
243
246
  };
244
- function d3_Map() {}
247
+ function d3_Map() {
248
+ this._ = Object.create(null);
249
+ }
250
+ var d3_map_proto = "__proto__", d3_map_zero = "\x00";
245
251
  d3_class(d3_Map, {
246
252
  has: d3_map_has,
247
253
  get: function(key) {
248
- return this[d3_map_prefix + key];
254
+ return this._[d3_map_escape(key)];
249
255
  },
250
256
  set: function(key, value) {
251
- return this[d3_map_prefix + key] = value;
257
+ return this._[d3_map_escape(key)] = value;
252
258
  },
253
259
  remove: d3_map_remove,
254
260
  keys: d3_map_keys,
255
261
  values: function() {
256
262
  var values = [];
257
- this.forEach(function(key, value) {
258
- values.push(value);
259
- });
263
+ for (var key in this._) values.push(this._[key]);
260
264
  return values;
261
265
  },
262
266
  entries: function() {
263
267
  var entries = [];
264
- this.forEach(function(key, value) {
265
- entries.push({
266
- key: key,
267
- value: value
268
- });
268
+ for (var key in this._) entries.push({
269
+ key: d3_map_unescape(key),
270
+ value: this._[key]
269
271
  });
270
272
  return entries;
271
273
  },
272
274
  size: d3_map_size,
273
275
  empty: d3_map_empty,
274
276
  forEach: function(f) {
275
- for (var key in this) if (key.charCodeAt(0) === d3_map_prefixCode) f.call(this, key.slice(1), this[key]);
277
+ for (var key in this._) f.call(this, d3_map_unescape(key), this._[key]);
276
278
  }
277
279
  });
278
- var d3_map_prefix = "\x00", d3_map_prefixCode = d3_map_prefix.charCodeAt(0);
280
+ function d3_map_escape(key) {
281
+ return (key += "") === d3_map_proto || key[0] === d3_map_zero ? d3_map_zero + key : key;
282
+ }
283
+ function d3_map_unescape(key) {
284
+ return (key += "")[0] === d3_map_zero ? key.slice(1) : key;
285
+ }
279
286
  function d3_map_has(key) {
280
- return d3_map_prefix + key in this;
287
+ return d3_map_escape(key) in this._;
281
288
  }
282
289
  function d3_map_remove(key) {
283
- key = d3_map_prefix + key;
284
- return key in this && delete this[key];
290
+ return (key = d3_map_escape(key)) in this._ && delete this._[key];
285
291
  }
286
292
  function d3_map_keys() {
287
293
  var keys = [];
288
- this.forEach(function(key) {
289
- keys.push(key);
290
- });
294
+ for (var key in this._) keys.push(d3_map_unescape(key));
291
295
  return keys;
292
296
  }
293
297
  function d3_map_size() {
294
298
  var size = 0;
295
- for (var key in this) if (key.charCodeAt(0) === d3_map_prefixCode) ++size;
299
+ for (var key in this._) ++size;
296
300
  return size;
297
301
  }
298
302
  function d3_map_empty() {
299
- for (var key in this) if (key.charCodeAt(0) === d3_map_prefixCode) return false;
303
+ for (var key in this._) return false;
300
304
  return true;
301
305
  }
302
306
  d3.nest = function() {
@@ -367,22 +371,21 @@
367
371
  if (array) for (var i = 0, n = array.length; i < n; ++i) set.add(array[i]);
368
372
  return set;
369
373
  };
370
- function d3_Set() {}
374
+ function d3_Set() {
375
+ this._ = Object.create(null);
376
+ }
371
377
  d3_class(d3_Set, {
372
378
  has: d3_map_has,
373
- add: function(value) {
374
- this[d3_map_prefix + value] = true;
375
- return value;
376
- },
377
- remove: function(value) {
378
- value = d3_map_prefix + value;
379
- return value in this && delete this[value];
379
+ add: function(key) {
380
+ this._[d3_map_escape(key += "")] = true;
381
+ return key;
380
382
  },
383
+ remove: d3_map_remove,
381
384
  values: d3_map_keys,
382
385
  size: d3_map_size,
383
386
  empty: d3_map_empty,
384
387
  forEach: function(f) {
385
- for (var value in this) if (value.charCodeAt(0) === d3_map_prefixCode) f.call(this, value.slice(1));
388
+ for (var key in this._) f.call(this, d3_map_unescape(key));
386
389
  }
387
390
  });
388
391
  d3.behavior = {};
@@ -762,29 +765,26 @@
762
765
  function bind(group, groupData) {
763
766
  var i, n = group.length, m = groupData.length, n0 = Math.min(n, m), updateNodes = new Array(m), enterNodes = new Array(m), exitNodes = new Array(n), node, nodeData;
764
767
  if (key) {
765
- var nodeByKeyValue = new d3_Map(), dataByKeyValue = new d3_Map(), keyValues = [], keyValue;
768
+ var nodeByKeyValue = new d3_Map(), keyValues = new Array(n), keyValue;
766
769
  for (i = -1; ++i < n; ) {
767
- keyValue = key.call(node = group[i], node.__data__, i);
768
- if (nodeByKeyValue.has(keyValue)) {
770
+ if (nodeByKeyValue.has(keyValue = key.call(node = group[i], node.__data__, i))) {
769
771
  exitNodes[i] = node;
770
772
  } else {
771
773
  nodeByKeyValue.set(keyValue, node);
772
774
  }
773
- keyValues.push(keyValue);
775
+ keyValues[i] = keyValue;
774
776
  }
775
777
  for (i = -1; ++i < m; ) {
776
- keyValue = key.call(groupData, nodeData = groupData[i], i);
777
- if (node = nodeByKeyValue.get(keyValue)) {
778
+ if (!(node = nodeByKeyValue.get(keyValue = key.call(groupData, nodeData = groupData[i], i)))) {
779
+ enterNodes[i] = d3_selection_dataNode(nodeData);
780
+ } else if (node !== true) {
778
781
  updateNodes[i] = node;
779
782
  node.__data__ = nodeData;
780
- } else if (!dataByKeyValue.has(keyValue)) {
781
- enterNodes[i] = d3_selection_dataNode(nodeData);
782
783
  }
783
- dataByKeyValue.set(keyValue, nodeData);
784
- nodeByKeyValue.remove(keyValue);
784
+ nodeByKeyValue.set(keyValue, true);
785
785
  }
786
786
  for (i = -1; ++i < n; ) {
787
- if (nodeByKeyValue.has(keyValues[i])) {
787
+ if (nodeByKeyValue.get(keyValues[i]) !== true) {
788
788
  exitNodes[i] = group[i];
789
789
  }
790
790
  }
@@ -1548,7 +1548,7 @@
1548
1548
  }
1549
1549
  d3.lab = d3_lab;
1550
1550
  function d3_lab(l, a, b) {
1551
- return this instanceof d3_lab ? void (this.l = +l, this.a = +a, this.b = +b) : arguments.length < 2 ? l instanceof d3_lab ? new d3_lab(l.l, l.a, l.b) : l instanceof d3_hcl ? d3_hcl_lab(l.l, l.c, l.h) : d3_rgb_lab((l = d3_rgb(l)).r, l.g, l.b) : new d3_lab(l, a, b);
1551
+ return this instanceof d3_lab ? void (this.l = +l, this.a = +a, this.b = +b) : arguments.length < 2 ? l instanceof d3_lab ? new d3_lab(l.l, l.a, l.b) : l instanceof d3_hcl ? d3_hcl_lab(l.h, l.c, l.l) : d3_rgb_lab((l = d3_rgb(l)).r, l.g, l.b) : new d3_lab(l, a, b);
1552
1552
  }
1553
1553
  var d3_lab_K = 18;
1554
1554
  var d3_lab_X = .95047, d3_lab_Y = 1, d3_lab_Z = 1.08883;
@@ -1997,7 +1997,7 @@
1997
1997
  a.push(t);
1998
1998
  t = token();
1999
1999
  }
2000
- if (f && !(a = f(a, n++))) continue;
2000
+ if (f && (a = f(a, n++)) == null) continue;
2001
2001
  rows.push(a);
2002
2002
  }
2003
2003
  return rows;
@@ -2120,21 +2120,22 @@
2120
2120
  };
2121
2121
  }
2122
2122
  function d3_locale_numberFormat(locale) {
2123
- var locale_decimal = locale.decimal, locale_thousands = locale.thousands, locale_grouping = locale.grouping, locale_currency = locale.currency, formatGroup = locale_grouping ? function(value) {
2124
- var i = value.length, t = [], j = 0, g = locale_grouping[0];
2125
- while (g > 0 && i > 0) {
2123
+ var locale_decimal = locale.decimal, locale_thousands = locale.thousands, locale_grouping = locale.grouping, locale_currency = locale.currency, formatGroup = locale_grouping && locale_thousands ? function(value, width) {
2124
+ var i = value.length, t = [], j = 0, g = locale_grouping[0], length = 0;
2125
+ while (i > 0 && g > 0) {
2126
+ if (length + g + 1 > width) g = Math.max(1, width - length);
2126
2127
  t.push(value.substring(i -= g, i + g));
2128
+ if ((length += g + 1) > width) break;
2127
2129
  g = locale_grouping[j = (j + 1) % locale_grouping.length];
2128
2130
  }
2129
2131
  return t.reverse().join(locale_thousands);
2130
2132
  } : d3_identity;
2131
2133
  return function(specifier) {
2132
- var match = d3_format_re.exec(specifier), fill = match[1] || " ", align = match[2] || ">", sign = match[3] || "", symbol = match[4] || "", zfill = match[5], width = +match[6], comma = match[7], precision = match[8], type = match[9], scale = 1, prefix = "", suffix = "", integer = false;
2134
+ var match = d3_format_re.exec(specifier), fill = match[1] || " ", align = match[2] || ">", sign = match[3] || "-", symbol = match[4] || "", zfill = match[5], width = +match[6], comma = match[7], precision = match[8], type = match[9], scale = 1, prefix = "", suffix = "", integer = false, exponent = true;
2133
2135
  if (precision) precision = +precision.substring(1);
2134
2136
  if (zfill || fill === "0" && align === "=") {
2135
2137
  zfill = fill = "0";
2136
2138
  align = "=";
2137
- if (comma) width -= Math.floor((width - 1) / 4);
2138
2139
  }
2139
2140
  switch (type) {
2140
2141
  case "n":
@@ -2161,6 +2162,8 @@
2161
2162
  if (symbol === "#") prefix = "0" + type.toLowerCase();
2162
2163
 
2163
2164
  case "c":
2165
+ exponent = false;
2166
+
2164
2167
  case "d":
2165
2168
  integer = true;
2166
2169
  precision = 0;
@@ -2181,7 +2184,7 @@
2181
2184
  return function(value) {
2182
2185
  var fullSuffix = suffix;
2183
2186
  if (integer && value % 1) return "";
2184
- var negative = value < 0 || value === 0 && 1 / value < 0 ? (value = -value, "-") : sign;
2187
+ var negative = value < 0 || value === 0 && 1 / value < 0 ? (value = -value, "-") : sign === "-" ? "" : sign;
2185
2188
  if (scale < 0) {
2186
2189
  var unit = d3.formatPrefix(value, precision);
2187
2190
  value = unit.scale(value);
@@ -2190,10 +2193,17 @@
2190
2193
  value *= scale;
2191
2194
  }
2192
2195
  value = type(value, precision);
2193
- var i = value.lastIndexOf("."), before = i < 0 ? value : value.substring(0, i), after = i < 0 ? "" : locale_decimal + value.substring(i + 1);
2194
- if (!zfill && comma) before = formatGroup(before);
2196
+ var i = value.lastIndexOf("."), before, after;
2197
+ if (i < 0) {
2198
+ var j = exponent ? value.lastIndexOf("e") : -1;
2199
+ if (j < 0) before = value, after = ""; else before = value.substring(0, j), after = value.substring(j);
2200
+ } else {
2201
+ before = value.substring(0, i);
2202
+ after = locale_decimal + value.substring(i + 1);
2203
+ }
2204
+ if (!zfill && comma) before = formatGroup(before, Infinity);
2195
2205
  var length = prefix.length + before.length + after.length + (zcomma ? 0 : negative.length), padding = length < width ? new Array(length = width - length + 1).join(fill) : "";
2196
- if (zcomma) before = formatGroup(padding + before);
2206
+ if (zcomma) before = formatGroup(padding + before, padding.length ? width - after.length : Infinity);
2197
2207
  negative += prefix;
2198
2208
  value = before + after;
2199
2209
  return (align === "<" ? negative + value + padding : align === ">" ? padding + negative + value : align === "^" ? padding.substring(0, length >>= 1) + negative + value + padding.substring(length) : negative + (zcomma ? value : padding + value)) + fullSuffix;
@@ -5605,9 +5615,9 @@
5605
5615
  }
5606
5616
  d3.interpolateNumber = d3_interpolateNumber;
5607
5617
  function d3_interpolateNumber(a, b) {
5608
- b -= a = +a;
5618
+ a = +a, b = +b;
5609
5619
  return function(t) {
5610
- return a + b * t;
5620
+ return a * (1 - t) + b * t;
5611
5621
  };
5612
5622
  }
5613
5623
  d3.interpolateString = d3_interpolateString;
@@ -5906,15 +5916,15 @@
5906
5916
  };
5907
5917
  }
5908
5918
  function d3_uninterpolateNumber(a, b) {
5909
- b = b - (a = +a) ? 1 / (b - a) : 0;
5919
+ b = (b -= a = +a) || 1 / b;
5910
5920
  return function(x) {
5911
- return (x - a) * b;
5921
+ return (x - a) / b;
5912
5922
  };
5913
5923
  }
5914
5924
  function d3_uninterpolateClamp(a, b) {
5915
- b = b - (a = +a) ? 1 / (b - a) : 0;
5925
+ b = (b -= a = +a) || 1 / b;
5916
5926
  return function(x) {
5917
- return Math.max(0, Math.min(1, (x - a) * b));
5927
+ return Math.max(0, Math.min(1, (x - a) / b));
5918
5928
  };
5919
5929
  }
5920
5930
  d3.layout = {};
@@ -6516,6 +6526,7 @@
6516
6526
  d3.layout.stack = function() {
6517
6527
  var values = d3_identity, order = d3_layout_stackOrderDefault, offset = d3_layout_stackOffsetZero, out = d3_layout_stackOut, x = d3_layout_stackX, y = d3_layout_stackY;
6518
6528
  function stack(data, index) {
6529
+ if (!(n = data.length)) return data;
6519
6530
  var series = data.map(function(d, i) {
6520
6531
  return values.call(stack, d, i);
6521
6532
  });
@@ -6528,7 +6539,7 @@
6528
6539
  series = d3.permute(series, orders);
6529
6540
  points = d3.permute(points, orders);
6530
6541
  var offsets = offset.call(stack, points, index);
6531
- var n = series.length, m = series[0].length, i, j, o;
6542
+ var m = series[0].length, n, i, j, o;
6532
6543
  for (j = 0; j < m; ++j) {
6533
6544
  out.call(stack, series[0][j], o = offsets[j], points[0][j][1]);
6534
6545
  for (i = 1; i < n; ++i) {
@@ -7683,7 +7694,7 @@
7683
7694
  }
7684
7695
  scale.domain = function(x) {
7685
7696
  if (!arguments.length) return domain;
7686
- domain = x.filter(d3_number).sort(d3_ascending);
7697
+ domain = x.map(d3_number).filter(d3_numeric).sort(d3_ascending);
7687
7698
  return rescale();
7688
7699
  };
7689
7700
  scale.range = function(x) {
@@ -8632,61 +8643,25 @@
8632
8643
  g.each(function() {
8633
8644
  var g = d3.select(this);
8634
8645
  var scale0 = this.__chart__ || scale, scale1 = this.__chart__ = scale.copy();
8635
- var ticks = tickValues == null ? scale1.ticks ? scale1.ticks.apply(scale1, tickArguments_) : scale1.domain() : tickValues, tickFormat = tickFormat_ == null ? scale1.tickFormat ? scale1.tickFormat.apply(scale1, tickArguments_) : d3_identity : tickFormat_, tick = g.selectAll(".tick").data(ticks, scale1), tickEnter = tick.enter().insert("g", ".domain").attr("class", "tick").style("opacity", ε), tickExit = d3.transition(tick.exit()).style("opacity", ε).remove(), tickUpdate = d3.transition(tick.order()).style("opacity", 1), tickTransform;
8646
+ var ticks = tickValues == null ? scale1.ticks ? scale1.ticks.apply(scale1, tickArguments_) : scale1.domain() : tickValues, tickFormat = tickFormat_ == null ? scale1.tickFormat ? scale1.tickFormat.apply(scale1, tickArguments_) : d3_identity : tickFormat_, tick = g.selectAll(".tick").data(ticks, scale1), tickEnter = tick.enter().insert("g", ".domain").attr("class", "tick").style("opacity", ε), tickExit = d3.transition(tick.exit()).style("opacity", ε).remove(), tickUpdate = d3.transition(tick.order()).style("opacity", 1), tickSpacing = Math.max(innerTickSize, 0) + tickPadding, tickTransform;
8636
8647
  var range = d3_scaleRange(scale1), path = g.selectAll(".domain").data([ 0 ]), pathUpdate = (path.enter().append("path").attr("class", "domain"),
8637
8648
  d3.transition(path));
8638
8649
  tickEnter.append("line");
8639
8650
  tickEnter.append("text");
8640
- var lineEnter = tickEnter.select("line"), lineUpdate = tickUpdate.select("line"), text = tick.select("text").text(tickFormat), textEnter = tickEnter.select("text"), textUpdate = tickUpdate.select("text");
8641
- switch (orient) {
8642
- case "bottom":
8643
- {
8644
- tickTransform = d3_svg_axisX;
8645
- lineEnter.attr("y2", innerTickSize);
8646
- textEnter.attr("y", Math.max(innerTickSize, 0) + tickPadding);
8647
- lineUpdate.attr("x2", 0).attr("y2", innerTickSize);
8648
- textUpdate.attr("x", 0).attr("y", Math.max(innerTickSize, 0) + tickPadding);
8649
- text.attr("dy", ".71em").style("text-anchor", "middle");
8650
- pathUpdate.attr("d", "M" + range[0] + "," + outerTickSize + "V0H" + range[1] + "V" + outerTickSize);
8651
- break;
8652
- }
8653
-
8654
- case "top":
8655
- {
8656
- tickTransform = d3_svg_axisX;
8657
- lineEnter.attr("y2", -innerTickSize);
8658
- textEnter.attr("y", -(Math.max(innerTickSize, 0) + tickPadding));
8659
- lineUpdate.attr("x2", 0).attr("y2", -innerTickSize);
8660
- textUpdate.attr("x", 0).attr("y", -(Math.max(innerTickSize, 0) + tickPadding));
8661
- text.attr("dy", "0em").style("text-anchor", "middle");
8662
- pathUpdate.attr("d", "M" + range[0] + "," + -outerTickSize + "V0H" + range[1] + "V" + -outerTickSize);
8663
- break;
8664
- }
8665
-
8666
- case "left":
8667
- {
8668
- tickTransform = d3_svg_axisY;
8669
- lineEnter.attr("x2", -innerTickSize);
8670
- textEnter.attr("x", -(Math.max(innerTickSize, 0) + tickPadding));
8671
- lineUpdate.attr("x2", -innerTickSize).attr("y2", 0);
8672
- textUpdate.attr("x", -(Math.max(innerTickSize, 0) + tickPadding)).attr("y", 0);
8673
- text.attr("dy", ".32em").style("text-anchor", "end");
8674
- pathUpdate.attr("d", "M" + -outerTickSize + "," + range[0] + "H0V" + range[1] + "H" + -outerTickSize);
8675
- break;
8676
- }
8677
-
8678
- case "right":
8679
- {
8680
- tickTransform = d3_svg_axisY;
8681
- lineEnter.attr("x2", innerTickSize);
8682
- textEnter.attr("x", Math.max(innerTickSize, 0) + tickPadding);
8683
- lineUpdate.attr("x2", innerTickSize).attr("y2", 0);
8684
- textUpdate.attr("x", Math.max(innerTickSize, 0) + tickPadding).attr("y", 0);
8685
- text.attr("dy", ".32em").style("text-anchor", "start");
8686
- pathUpdate.attr("d", "M" + outerTickSize + "," + range[0] + "H0V" + range[1] + "H" + outerTickSize);
8687
- break;
8688
- }
8689
- }
8651
+ var lineEnter = tickEnter.select("line"), lineUpdate = tickUpdate.select("line"), text = tick.select("text").text(tickFormat), textEnter = tickEnter.select("text"), textUpdate = tickUpdate.select("text"), sign = orient === "top" || orient === "left" ? -1 : 1, x1, x2, y1, y2;
8652
+ if (orient === "bottom" || orient === "top") {
8653
+ tickTransform = d3_svg_axisX, x1 = "x", y1 = "y", x2 = "x2", y2 = "y2";
8654
+ text.attr("dy", sign < 0 ? "0em" : ".71em").style("text-anchor", "middle");
8655
+ pathUpdate.attr("d", "M" + range[0] + "," + sign * outerTickSize + "V0H" + range[1] + "V" + sign * outerTickSize);
8656
+ } else {
8657
+ tickTransform = d3_svg_axisY, x1 = "y", y1 = "x", x2 = "y2", y2 = "x2";
8658
+ text.attr("dy", ".32em").style("text-anchor", sign < 0 ? "end" : "start");
8659
+ pathUpdate.attr("d", "M" + sign * outerTickSize + "," + range[0] + "H0V" + range[1] + "H" + sign * outerTickSize);
8660
+ }
8661
+ lineEnter.attr(y2, sign * innerTickSize);
8662
+ textEnter.attr(y1, sign * tickSpacing);
8663
+ lineUpdate.attr(x2, 0).attr(y2, sign * innerTickSize);
8664
+ textUpdate.attr(x1, 0).attr(y1, sign * tickSpacing);
8690
8665
  if (scale1.rangeBand) {
8691
8666
  var x = scale1, dx = x.rangeBand() / 2;
8692
8667
  scale0 = scale1 = function(d) {
@@ -8695,10 +8670,10 @@
8695
8670
  } else if (scale0.rangeBand) {
8696
8671
  scale0 = scale1;
8697
8672
  } else {
8698
- tickExit.call(tickTransform, scale1);
8673
+ tickExit.call(tickTransform, scale1, scale0);
8699
8674
  }
8700
- tickEnter.call(tickTransform, scale0);
8701
- tickUpdate.call(tickTransform, scale1);
8675
+ tickEnter.call(tickTransform, scale0, scale1);
8676
+ tickUpdate.call(tickTransform, scale1, scale1);
8702
8677
  });
8703
8678
  }
8704
8679
  axis.scale = function(x) {
@@ -8759,14 +8734,16 @@
8759
8734
  bottom: 1,
8760
8735
  left: 1
8761
8736
  };
8762
- function d3_svg_axisX(selection, x) {
8737
+ function d3_svg_axisX(selection, x0, x1) {
8763
8738
  selection.attr("transform", function(d) {
8764
- return "translate(" + x(d) + ",0)";
8739
+ var v0 = x0(d);
8740
+ return "translate(" + (isFinite(v0) ? v0 : x1(d)) + ",0)";
8765
8741
  });
8766
8742
  }
8767
- function d3_svg_axisY(selection, y) {
8743
+ function d3_svg_axisY(selection, y0, y1) {
8768
8744
  selection.attr("transform", function(d) {
8769
- return "translate(0," + y(d) + ")";
8745
+ var v0 = y0(d);
8746
+ return "translate(0," + (isFinite(v0) ? v0 : y1(d)) + ")";
8770
8747
  });
8771
8748
  }
8772
8749
  d3.svg.brush = function() {