d3-rails 5.7.0 → 5.9.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c6cd47f285146a34396fa1925924bb1a5006733b333f0a77d08133f51aec6b36
4
- data.tar.gz: 274fba6604e2d018d492238a30b3507dea8955db9ffe665a25aea9518d52c907
3
+ metadata.gz: 8422687bdd54a25af8d7ec2fcf7523b1dadba274f890a0ed09877e7728e2a431
4
+ data.tar.gz: 1fc90e4be3d875635d5e55d03a2b61ce62cf1c1b098507d2e1b99ebe4c31a502
5
5
  SHA512:
6
- metadata.gz: e350fbd34bb84c4a9b9abb72bedbbff16f5ec3523628a4523b59821704251a40d0d4521bb9f4969bf3729fd265accb59d72b5af0daa7c8f0ad425befd009827e
7
- data.tar.gz: 227723e1a154f1a9eb4b80a537eda9e6885a2467e819fc52cfad7037ed8f8ad5bbe6578ce9f259a6ee1fcd2862821dde9242466b7853559a1b1d70489b523e8d
6
+ metadata.gz: 8c319c728078db89f2f359cc8682f2ca936476ad44d66f90de23de415194852a695ad80e6f9b982c1ecfeb93de75c86ffa19aabc1ef689e6e909cfe6b4dd8e2e
7
+ data.tar.gz: 6424e4d59b659fc5e31f5124b039857630f3bfe38501966aef47713a99c9259b815d97453748f77015b77273aad4ff8f426b27f410e6ab172316ca92895aa1dd
@@ -1,3 +1,6 @@
1
+ ## 5.9.2 (28 May 2019)
2
+ * Upgrade D3 to 5.9.2
3
+
1
4
  ## 5.7.0 (29 Sep 2018)
2
5
  * Upgrade D3 to 5.7.0
3
6
 
data/README.md CHANGED
@@ -8,7 +8,7 @@ d3-rails provides D3 for Rails 3.1 and higher.
8
8
 
9
9
  ## Version
10
10
 
11
- d3-rails comes with version 5.7.0 of D3.js. The d3-rails version will
11
+ d3-rails comes with version 5.9.2 of D3.js. The d3-rails version will
12
12
  always mirror the version of D3. If you need a newer version of
13
13
  d3-rails, see section Development (below).
14
14
 
@@ -1,11 +1,11 @@
1
- // https://d3js.org v5.7.0 Copyright 2018 Mike Bostock
1
+ // https://d3js.org v5.9.2 Copyright 2019 Mike Bostock
2
2
  (function (global, factory) {
3
3
  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
4
4
  typeof define === 'function' && define.amd ? define(['exports'], factory) :
5
5
  (factory((global.d3 = global.d3 || {})));
6
6
  }(this, (function (exports) { 'use strict';
7
7
 
8
- var version = "5.7.0";
8
+ var version = "5.9.2";
9
9
 
10
10
  function ascending(a, b) {
11
11
  return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;
@@ -903,31 +903,14 @@ function selection_selectAll(select) {
903
903
  return new Selection(subgroups, parents);
904
904
  }
905
905
 
906
- var matcher = function(selector) {
906
+ function matcher(selector) {
907
907
  return function() {
908
908
  return this.matches(selector);
909
909
  };
910
- };
911
-
912
- if (typeof document !== "undefined") {
913
- var element = document.documentElement;
914
- if (!element.matches) {
915
- var vendorMatches = element.webkitMatchesSelector
916
- || element.msMatchesSelector
917
- || element.mozMatchesSelector
918
- || element.oMatchesSelector;
919
- matcher = function(selector) {
920
- return function() {
921
- return vendorMatches.call(this, selector);
922
- };
923
- };
924
- }
925
910
  }
926
911
 
927
- var matcher$1 = matcher;
928
-
929
912
  function selection_filter(match) {
930
- if (typeof match !== "function") match = matcher$1(match);
913
+ if (typeof match !== "function") match = matcher(match);
931
914
 
932
915
  for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0; j < m; ++j) {
933
916
  for (var group = groups[j], n = group.length, subgroup = subgroups[j] = [], node, i = 0; i < n; ++i) {
@@ -1089,6 +1072,14 @@ function selection_exit() {
1089
1072
  return new Selection(this._exit || this._groups.map(sparse), this._parents);
1090
1073
  }
1091
1074
 
1075
+ function selection_join(onenter, onupdate, onexit) {
1076
+ var enter = this.enter(), update = this, exit = this.exit();
1077
+ enter = typeof onenter === "function" ? onenter(enter) : enter.append(onenter + "");
1078
+ if (onupdate != null) update = onupdate(update);
1079
+ if (onexit == null) exit.remove(); else onexit(exit);
1080
+ return enter && update ? enter.merge(update).order() : update;
1081
+ }
1082
+
1092
1083
  function selection_merge(selection$$1) {
1093
1084
 
1094
1085
  for (var groups0 = this._groups, groups1 = selection$$1._groups, m0 = groups0.length, m1 = groups1.length, m = Math.min(m0, m1), merges = new Array(m0), j = 0; j < m; ++j) {
@@ -1111,7 +1102,7 @@ function selection_order() {
1111
1102
  for (var groups = this._groups, j = -1, m = groups.length; ++j < m;) {
1112
1103
  for (var group = groups[j], i = group.length - 1, next = group[i], node; --i >= 0;) {
1113
1104
  if (node = group[i]) {
1114
- if (next && next !== node.nextSibling) next.parentNode.insertBefore(node, next);
1105
+ if (next && node.compareDocumentPosition(next) ^ 4) next.parentNode.insertBefore(node, next);
1115
1106
  next = node;
1116
1107
  }
1117
1108
  }
@@ -1509,8 +1500,8 @@ var filterEvents = {};
1509
1500
  exports.event = null;
1510
1501
 
1511
1502
  if (typeof document !== "undefined") {
1512
- var element$1 = document.documentElement;
1513
- if (!("onmouseenter" in element$1)) {
1503
+ var element = document.documentElement;
1504
+ if (!("onmouseenter" in element)) {
1514
1505
  filterEvents = {mouseenter: "mouseover", mouseleave: "mouseout"};
1515
1506
  }
1516
1507
  }
@@ -1664,6 +1655,7 @@ Selection.prototype = selection.prototype = {
1664
1655
  data: selection_data,
1665
1656
  enter: selection_enter,
1666
1657
  exit: selection_exit,
1658
+ join: selection_join,
1667
1659
  merge: selection_merge,
1668
1660
  order: selection_order,
1669
1661
  sort: selection_sort,
@@ -3200,7 +3192,7 @@ function interval$1(callback, delay, time) {
3200
3192
  return t;
3201
3193
  }
3202
3194
 
3203
- var emptyOn = dispatch("start", "end", "interrupt");
3195
+ var emptyOn = dispatch("start", "end", "cancel", "interrupt");
3204
3196
  var emptyTween = [];
3205
3197
 
3206
3198
  var CREATED = 0;
@@ -3238,7 +3230,7 @@ function init(node, id) {
3238
3230
 
3239
3231
  function set$1(node, id) {
3240
3232
  var schedule = get$1(node, id);
3241
- if (schedule.state > STARTING) throw new Error("too late; already started");
3233
+ if (schedule.state > STARTED) throw new Error("too late; already running");
3242
3234
  return schedule;
3243
3235
  }
3244
3236
 
@@ -3281,7 +3273,6 @@ function create$1(node, id, self) {
3281
3273
  if (o.state === STARTED) return timeout$1(start);
3282
3274
 
3283
3275
  // Interrupt the active transition, if any.
3284
- // Dispatch the interrupt event.
3285
3276
  if (o.state === RUNNING) {
3286
3277
  o.state = ENDED;
3287
3278
  o.timer.stop();
@@ -3289,12 +3280,11 @@ function create$1(node, id, self) {
3289
3280
  delete schedules[i];
3290
3281
  }
3291
3282
 
3292
- // Cancel any pre-empted transitions. No interrupt event is dispatched
3293
- // because the cancelled transitions never started. Note that this also
3294
- // removes this transition from the pending list!
3283
+ // Cancel any pre-empted transitions.
3295
3284
  else if (+i < id) {
3296
3285
  o.state = ENDED;
3297
3286
  o.timer.stop();
3287
+ o.on.call("cancel", node, node.__data__, o.index, o.group);
3298
3288
  delete schedules[i];
3299
3289
  }
3300
3290
  }
@@ -3334,7 +3324,7 @@ function create$1(node, id, self) {
3334
3324
  n = tween.length;
3335
3325
 
3336
3326
  while (++i < n) {
3337
- tween[i].call(null, t);
3327
+ tween[i].call(node, t);
3338
3328
  }
3339
3329
 
3340
3330
  // Dispatch the end event.
@@ -3369,7 +3359,7 @@ function interrupt(node, name) {
3369
3359
  active = schedule$$1.state > STARTING && schedule$$1.state < ENDING;
3370
3360
  schedule$$1.state = ENDED;
3371
3361
  schedule$$1.timer.stop();
3372
- if (active) schedule$$1.on.call("interrupt", node, node.__data__, schedule$$1.index, schedule$$1.group);
3362
+ schedule$$1.on.call(active ? "interrupt" : "cancel", node, node.__data__, schedule$$1.index, schedule$$1.group);
3373
3363
  delete schedules[i];
3374
3364
  }
3375
3365
 
@@ -3483,52 +3473,56 @@ function attrRemoveNS$1(fullname) {
3483
3473
  }
3484
3474
 
3485
3475
  function attrConstant$1(name, interpolate$$1, value1) {
3486
- var value00,
3476
+ var string00,
3477
+ string1 = value1 + "",
3487
3478
  interpolate0;
3488
3479
  return function() {
3489
- var value0 = this.getAttribute(name);
3490
- return value0 === value1 ? null
3491
- : value0 === value00 ? interpolate0
3492
- : interpolate0 = interpolate$$1(value00 = value0, value1);
3480
+ var string0 = this.getAttribute(name);
3481
+ return string0 === string1 ? null
3482
+ : string0 === string00 ? interpolate0
3483
+ : interpolate0 = interpolate$$1(string00 = string0, value1);
3493
3484
  };
3494
3485
  }
3495
3486
 
3496
3487
  function attrConstantNS$1(fullname, interpolate$$1, value1) {
3497
- var value00,
3488
+ var string00,
3489
+ string1 = value1 + "",
3498
3490
  interpolate0;
3499
3491
  return function() {
3500
- var value0 = this.getAttributeNS(fullname.space, fullname.local);
3501
- return value0 === value1 ? null
3502
- : value0 === value00 ? interpolate0
3503
- : interpolate0 = interpolate$$1(value00 = value0, value1);
3492
+ var string0 = this.getAttributeNS(fullname.space, fullname.local);
3493
+ return string0 === string1 ? null
3494
+ : string0 === string00 ? interpolate0
3495
+ : interpolate0 = interpolate$$1(string00 = string0, value1);
3504
3496
  };
3505
3497
  }
3506
3498
 
3507
3499
  function attrFunction$1(name, interpolate$$1, value) {
3508
- var value00,
3509
- value10,
3500
+ var string00,
3501
+ string10,
3510
3502
  interpolate0;
3511
3503
  return function() {
3512
- var value0, value1 = value(this);
3504
+ var string0, value1 = value(this), string1;
3513
3505
  if (value1 == null) return void this.removeAttribute(name);
3514
- value0 = this.getAttribute(name);
3515
- return value0 === value1 ? null
3516
- : value0 === value00 && value1 === value10 ? interpolate0
3517
- : interpolate0 = interpolate$$1(value00 = value0, value10 = value1);
3506
+ string0 = this.getAttribute(name);
3507
+ string1 = value1 + "";
3508
+ return string0 === string1 ? null
3509
+ : string0 === string00 && string1 === string10 ? interpolate0
3510
+ : (string10 = string1, interpolate0 = interpolate$$1(string00 = string0, value1));
3518
3511
  };
3519
3512
  }
3520
3513
 
3521
3514
  function attrFunctionNS$1(fullname, interpolate$$1, value) {
3522
- var value00,
3523
- value10,
3515
+ var string00,
3516
+ string10,
3524
3517
  interpolate0;
3525
3518
  return function() {
3526
- var value0, value1 = value(this);
3519
+ var string0, value1 = value(this), string1;
3527
3520
  if (value1 == null) return void this.removeAttributeNS(fullname.space, fullname.local);
3528
- value0 = this.getAttributeNS(fullname.space, fullname.local);
3529
- return value0 === value1 ? null
3530
- : value0 === value00 && value1 === value10 ? interpolate0
3531
- : interpolate0 = interpolate$$1(value00 = value0, value10 = value1);
3521
+ string0 = this.getAttributeNS(fullname.space, fullname.local);
3522
+ string1 = value1 + "";
3523
+ return string0 === string1 ? null
3524
+ : string0 === string00 && string1 === string10 ? interpolate0
3525
+ : (string10 = string1, interpolate0 = interpolate$$1(string00 = string0, value1));
3532
3526
  };
3533
3527
  }
3534
3528
 
@@ -3537,26 +3531,38 @@ function transition_attr(name, value) {
3537
3531
  return this.attrTween(name, typeof value === "function"
3538
3532
  ? (fullname.local ? attrFunctionNS$1 : attrFunction$1)(fullname, i, tweenValue(this, "attr." + name, value))
3539
3533
  : value == null ? (fullname.local ? attrRemoveNS$1 : attrRemove$1)(fullname)
3540
- : (fullname.local ? attrConstantNS$1 : attrConstant$1)(fullname, i, value + ""));
3534
+ : (fullname.local ? attrConstantNS$1 : attrConstant$1)(fullname, i, value));
3535
+ }
3536
+
3537
+ function attrInterpolate(name, i) {
3538
+ return function(t) {
3539
+ this.setAttribute(name, i(t));
3540
+ };
3541
+ }
3542
+
3543
+ function attrInterpolateNS(fullname, i) {
3544
+ return function(t) {
3545
+ this.setAttributeNS(fullname.space, fullname.local, i(t));
3546
+ };
3541
3547
  }
3542
3548
 
3543
3549
  function attrTweenNS(fullname, value) {
3550
+ var t0, i0;
3544
3551
  function tween() {
3545
- var node = this, i = value.apply(node, arguments);
3546
- return i && function(t) {
3547
- node.setAttributeNS(fullname.space, fullname.local, i(t));
3548
- };
3552
+ var i = value.apply(this, arguments);
3553
+ if (i !== i0) t0 = (i0 = i) && attrInterpolateNS(fullname, i);
3554
+ return t0;
3549
3555
  }
3550
3556
  tween._value = value;
3551
3557
  return tween;
3552
3558
  }
3553
3559
 
3554
3560
  function attrTween(name, value) {
3561
+ var t0, i0;
3555
3562
  function tween() {
3556
- var node = this, i = value.apply(node, arguments);
3557
- return i && function(t) {
3558
- node.setAttribute(name, i(t));
3559
- };
3563
+ var i = value.apply(this, arguments);
3564
+ if (i !== i0) t0 = (i0 = i) && attrInterpolate(name, i);
3565
+ return t0;
3560
3566
  }
3561
3567
  tween._value = value;
3562
3568
  return tween;
@@ -3631,7 +3637,7 @@ function transition_ease(value) {
3631
3637
  }
3632
3638
 
3633
3639
  function transition_filter(match) {
3634
- if (typeof match !== "function") match = matcher$1(match);
3640
+ if (typeof match !== "function") match = matcher(match);
3635
3641
 
3636
3642
  for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0; j < m; ++j) {
3637
3643
  for (var group = groups[j], n = group.length, subgroup = subgroups[j] = [], node, i = 0; i < n; ++i) {
@@ -3753,66 +3759,93 @@ function transition_selection() {
3753
3759
  return new Selection$1(this._groups, this._parents);
3754
3760
  }
3755
3761
 
3756
- function styleRemove$1(name, interpolate$$1) {
3757
- var value00,
3758
- value10,
3762
+ function styleNull(name, interpolate$$1) {
3763
+ var string00,
3764
+ string10,
3759
3765
  interpolate0;
3760
3766
  return function() {
3761
- var value0 = styleValue(this, name),
3762
- value1 = (this.style.removeProperty(name), styleValue(this, name));
3763
- return value0 === value1 ? null
3764
- : value0 === value00 && value1 === value10 ? interpolate0
3765
- : interpolate0 = interpolate$$1(value00 = value0, value10 = value1);
3767
+ var string0 = styleValue(this, name),
3768
+ string1 = (this.style.removeProperty(name), styleValue(this, name));
3769
+ return string0 === string1 ? null
3770
+ : string0 === string00 && string1 === string10 ? interpolate0
3771
+ : interpolate0 = interpolate$$1(string00 = string0, string10 = string1);
3766
3772
  };
3767
3773
  }
3768
3774
 
3769
- function styleRemoveEnd(name) {
3775
+ function styleRemove$1(name) {
3770
3776
  return function() {
3771
3777
  this.style.removeProperty(name);
3772
3778
  };
3773
3779
  }
3774
3780
 
3775
3781
  function styleConstant$1(name, interpolate$$1, value1) {
3776
- var value00,
3782
+ var string00,
3783
+ string1 = value1 + "",
3777
3784
  interpolate0;
3778
3785
  return function() {
3779
- var value0 = styleValue(this, name);
3780
- return value0 === value1 ? null
3781
- : value0 === value00 ? interpolate0
3782
- : interpolate0 = interpolate$$1(value00 = value0, value1);
3786
+ var string0 = styleValue(this, name);
3787
+ return string0 === string1 ? null
3788
+ : string0 === string00 ? interpolate0
3789
+ : interpolate0 = interpolate$$1(string00 = string0, value1);
3783
3790
  };
3784
3791
  }
3785
3792
 
3786
3793
  function styleFunction$1(name, interpolate$$1, value) {
3787
- var value00,
3788
- value10,
3794
+ var string00,
3795
+ string10,
3789
3796
  interpolate0;
3790
3797
  return function() {
3791
- var value0 = styleValue(this, name),
3792
- value1 = value(this);
3793
- if (value1 == null) value1 = (this.style.removeProperty(name), styleValue(this, name));
3794
- return value0 === value1 ? null
3795
- : value0 === value00 && value1 === value10 ? interpolate0
3796
- : interpolate0 = interpolate$$1(value00 = value0, value10 = value1);
3798
+ var string0 = styleValue(this, name),
3799
+ value1 = value(this),
3800
+ string1 = value1 + "";
3801
+ if (value1 == null) string1 = value1 = (this.style.removeProperty(name), styleValue(this, name));
3802
+ return string0 === string1 ? null
3803
+ : string0 === string00 && string1 === string10 ? interpolate0
3804
+ : (string10 = string1, interpolate0 = interpolate$$1(string00 = string0, value1));
3805
+ };
3806
+ }
3807
+
3808
+ function styleMaybeRemove(id, name) {
3809
+ var on0, on1, listener0, key = "style." + name, event = "end." + key, remove;
3810
+ return function() {
3811
+ var schedule$$1 = set$1(this, id),
3812
+ on = schedule$$1.on,
3813
+ listener = schedule$$1.value[key] == null ? remove || (remove = styleRemove$1(name)) : undefined;
3814
+
3815
+ // If this node shared a dispatch with the previous node,
3816
+ // just assign the updated shared dispatch and we’re done!
3817
+ // Otherwise, copy-on-write.
3818
+ if (on !== on0 || listener0 !== listener) (on1 = (on0 = on).copy()).on(event, listener0 = listener);
3819
+
3820
+ schedule$$1.on = on1;
3797
3821
  };
3798
3822
  }
3799
3823
 
3800
3824
  function transition_style(name, value, priority) {
3801
3825
  var i = (name += "") === "transform" ? interpolateTransformCss : interpolate;
3802
3826
  return value == null ? this
3803
- .styleTween(name, styleRemove$1(name, i))
3804
- .on("end.style." + name, styleRemoveEnd(name))
3805
- : this.styleTween(name, typeof value === "function"
3806
- ? styleFunction$1(name, i, tweenValue(this, "style." + name, value))
3807
- : styleConstant$1(name, i, value + ""), priority);
3827
+ .styleTween(name, styleNull(name, i))
3828
+ .on("end.style." + name, styleRemove$1(name))
3829
+ : typeof value === "function" ? this
3830
+ .styleTween(name, styleFunction$1(name, i, tweenValue(this, "style." + name, value)))
3831
+ .each(styleMaybeRemove(this._id, name))
3832
+ : this
3833
+ .styleTween(name, styleConstant$1(name, i, value), priority)
3834
+ .on("end.style." + name, null);
3835
+ }
3836
+
3837
+ function styleInterpolate(name, i, priority) {
3838
+ return function(t) {
3839
+ this.style.setProperty(name, i(t), priority);
3840
+ };
3808
3841
  }
3809
3842
 
3810
3843
  function styleTween(name, value, priority) {
3844
+ var t, i0;
3811
3845
  function tween() {
3812
- var node = this, i = value.apply(node, arguments);
3813
- return i && function(t) {
3814
- node.style.setProperty(name, i(t), priority);
3815
- };
3846
+ var i = value.apply(this, arguments);
3847
+ if (i !== i0) t = (i0 = i) && styleInterpolate(name, i, priority);
3848
+ return t;
3816
3849
  }
3817
3850
  tween._value = value;
3818
3851
  return tween;
@@ -3867,6 +3900,31 @@ function transition_transition() {
3867
3900
  return new Transition(groups, this._parents, name, id1);
3868
3901
  }
3869
3902
 
3903
+ function transition_end() {
3904
+ var on0, on1, that = this, id = that._id, size = that.size();
3905
+ return new Promise(function(resolve, reject) {
3906
+ var cancel = {value: reject},
3907
+ end = {value: function() { if (--size === 0) resolve(); }};
3908
+
3909
+ that.each(function() {
3910
+ var schedule$$1 = set$1(this, id),
3911
+ on = schedule$$1.on;
3912
+
3913
+ // If this node shared a dispatch with the previous node,
3914
+ // just assign the updated shared dispatch and we’re done!
3915
+ // Otherwise, copy-on-write.
3916
+ if (on !== on0) {
3917
+ on1 = (on0 = on).copy();
3918
+ on1._.cancel.push(cancel);
3919
+ on1._.interrupt.push(cancel);
3920
+ on1._.end.push(end);
3921
+ }
3922
+
3923
+ schedule$$1.on = on1;
3924
+ });
3925
+ });
3926
+ }
3927
+
3870
3928
  var id = 0;
3871
3929
 
3872
3930
  function Transition(groups, parents, name, id) {
@@ -3910,7 +3968,8 @@ Transition.prototype = transition.prototype = {
3910
3968
  tween: transition_tween,
3911
3969
  delay: transition_delay,
3912
3970
  duration: transition_duration,
3913
- ease: transition_ease
3971
+ ease: transition_ease,
3972
+ end: transition_end
3914
3973
  };
3915
3974
 
3916
3975
  function linear$1(t) {
@@ -5735,6 +5794,30 @@ function inferColumns(rows) {
5735
5794
  return columns;
5736
5795
  }
5737
5796
 
5797
+ function pad(value, width) {
5798
+ var s = value + "", length = s.length;
5799
+ return length < width ? new Array(width - length + 1).join(0) + s : s;
5800
+ }
5801
+
5802
+ function formatYear(year) {
5803
+ return year < 0 ? "-" + pad(-year, 6)
5804
+ : year > 9999 ? "+" + pad(year, 6)
5805
+ : pad(year, 4);
5806
+ }
5807
+
5808
+ function formatDate(date) {
5809
+ var hours = date.getUTCHours(),
5810
+ minutes = date.getUTCMinutes(),
5811
+ seconds = date.getUTCSeconds(),
5812
+ milliseconds = date.getUTCMilliseconds();
5813
+ return isNaN(date) ? "Invalid Date"
5814
+ : formatYear(date.getUTCFullYear(), 4) + "-" + pad(date.getUTCMonth() + 1, 2) + "-" + pad(date.getUTCDate(), 2)
5815
+ + (milliseconds ? "T" + pad(hours, 2) + ":" + pad(minutes, 2) + ":" + pad(seconds, 2) + "." + pad(milliseconds, 3) + "Z"
5816
+ : seconds ? "T" + pad(hours, 2) + ":" + pad(minutes, 2) + ":" + pad(seconds, 2) + "Z"
5817
+ : minutes || hours ? "T" + pad(hours, 2) + ":" + pad(minutes, 2) + "Z"
5818
+ : "");
5819
+ }
5820
+
5738
5821
  function dsvFormat(delimiter) {
5739
5822
  var reFormat = new RegExp("[\"" + delimiter + "\n\r]"),
5740
5823
  DELIMITER = delimiter.charCodeAt(0);
@@ -5797,13 +5880,22 @@ function dsvFormat(delimiter) {
5797
5880
  return rows;
5798
5881
  }
5799
5882
 
5800
- function format(rows, columns) {
5801
- if (columns == null) columns = inferColumns(rows);
5802
- return [columns.map(formatValue).join(delimiter)].concat(rows.map(function(row) {
5883
+ function preformatBody(rows, columns) {
5884
+ return rows.map(function(row) {
5803
5885
  return columns.map(function(column) {
5804
5886
  return formatValue(row[column]);
5805
5887
  }).join(delimiter);
5806
- })).join("\n");
5888
+ });
5889
+ }
5890
+
5891
+ function format(rows, columns) {
5892
+ if (columns == null) columns = inferColumns(rows);
5893
+ return [columns.map(formatValue).join(delimiter)].concat(preformatBody(rows, columns)).join("\n");
5894
+ }
5895
+
5896
+ function formatBody(rows, columns) {
5897
+ if (columns == null) columns = inferColumns(rows);
5898
+ return preformatBody(rows, columns).join("\n");
5807
5899
  }
5808
5900
 
5809
5901
  function formatRows(rows) {
@@ -5814,16 +5906,18 @@ function dsvFormat(delimiter) {
5814
5906
  return row.map(formatValue).join(delimiter);
5815
5907
  }
5816
5908
 
5817
- function formatValue(text) {
5818
- return text == null ? ""
5819
- : reFormat.test(text += "") ? "\"" + text.replace(/"/g, "\"\"") + "\""
5820
- : text;
5909
+ function formatValue(value) {
5910
+ return value == null ? ""
5911
+ : value instanceof Date ? formatDate(value)
5912
+ : reFormat.test(value += "") ? "\"" + value.replace(/"/g, "\"\"") + "\""
5913
+ : value;
5821
5914
  }
5822
5915
 
5823
5916
  return {
5824
5917
  parse: parse,
5825
5918
  parseRows: parseRows,
5826
5919
  format: format,
5920
+ formatBody: formatBody,
5827
5921
  formatRows: formatRows
5828
5922
  };
5829
5923
  }
@@ -5833,6 +5927,7 @@ var csv = dsvFormat(",");
5833
5927
  var csvParse = csv.parse;
5834
5928
  var csvParseRows = csv.parseRows;
5835
5929
  var csvFormat = csv.format;
5930
+ var csvFormatBody = csv.formatBody;
5836
5931
  var csvFormatRows = csv.formatRows;
5837
5932
 
5838
5933
  var tsv = dsvFormat("\t");
@@ -5840,8 +5935,24 @@ var tsv = dsvFormat("\t");
5840
5935
  var tsvParse = tsv.parse;
5841
5936
  var tsvParseRows = tsv.parseRows;
5842
5937
  var tsvFormat = tsv.format;
5938
+ var tsvFormatBody = tsv.formatBody;
5843
5939
  var tsvFormatRows = tsv.formatRows;
5844
5940
 
5941
+ function autoType(object) {
5942
+ for (var key in object) {
5943
+ var value = object[key].trim(), number;
5944
+ if (!value) value = null;
5945
+ else if (value === "true") value = true;
5946
+ else if (value === "false") value = false;
5947
+ else if (value === "NaN") value = NaN;
5948
+ else if (!isNaN(number = +value)) value = number;
5949
+ else if (/^([-+]\d{2})?\d{4}(-\d{2}(-\d{2})?)?(T\d{2}:\d{2}(:\d{2}(\.\d{3})?)?(Z|[-+]\d{2}:\d{2})?)?$/.test(value)) value = new Date(value);
5950
+ else continue;
5951
+ object[key] = value;
5952
+ }
5953
+ return object;
5954
+ }
5955
+
5845
5956
  function responseBlob(response) {
5846
5957
  if (!response.ok) throw new Error(response.status + " " + response.statusText);
5847
5958
  return response.blob();
@@ -6040,9 +6151,8 @@ function addAll(data) {
6040
6151
  if (y > y1) y1 = y;
6041
6152
  }
6042
6153
 
6043
- // If there were no (valid) points, inherit the existing extent.
6044
- if (x1 < x0) x0 = this._x0, x1 = this._x1;
6045
- if (y1 < y0) y0 = this._y0, y1 = this._y1;
6154
+ // If there were no (valid) points, abort.
6155
+ if (x0 > x1 || y0 > y1) return this;
6046
6156
 
6047
6157
  // Expand the tree to cover the new points.
6048
6158
  this.cover(x0, y0).cover(x1, y1);
@@ -6072,41 +6182,26 @@ function tree_cover(x, y) {
6072
6182
  }
6073
6183
 
6074
6184
  // Otherwise, double repeatedly to cover.
6075
- else if (x0 > x || x > x1 || y0 > y || y > y1) {
6185
+ else {
6076
6186
  var z = x1 - x0,
6077
6187
  node = this._root,
6078
6188
  parent,
6079
6189
  i;
6080
6190
 
6081
- switch (i = (y < (y0 + y1) / 2) << 1 | (x < (x0 + x1) / 2)) {
6082
- case 0: {
6083
- do parent = new Array(4), parent[i] = node, node = parent;
6084
- while (z *= 2, x1 = x0 + z, y1 = y0 + z, x > x1 || y > y1);
6085
- break;
6086
- }
6087
- case 1: {
6088
- do parent = new Array(4), parent[i] = node, node = parent;
6089
- while (z *= 2, x0 = x1 - z, y1 = y0 + z, x0 > x || y > y1);
6090
- break;
6091
- }
6092
- case 2: {
6093
- do parent = new Array(4), parent[i] = node, node = parent;
6094
- while (z *= 2, x1 = x0 + z, y0 = y1 - z, x > x1 || y0 > y);
6095
- break;
6096
- }
6097
- case 3: {
6098
- do parent = new Array(4), parent[i] = node, node = parent;
6099
- while (z *= 2, x0 = x1 - z, y0 = y1 - z, x0 > x || y0 > y);
6100
- break;
6191
+ while (x0 > x || x >= x1 || y0 > y || y >= y1) {
6192
+ i = (y < y0) << 1 | (x < x0);
6193
+ parent = new Array(4), parent[i] = node, node = parent, z *= 2;
6194
+ switch (i) {
6195
+ case 0: x1 = x0 + z, y1 = y0 + z; break;
6196
+ case 1: x0 = x1 - z, y1 = y0 + z; break;
6197
+ case 2: x1 = x0 + z, y0 = y1 - z; break;
6198
+ case 3: x0 = x1 - z, y0 = y1 - z; break;
6101
6199
  }
6102
6200
  }
6103
6201
 
6104
6202
  if (this._root && this._root.length) this._root = node;
6105
6203
  }
6106
6204
 
6107
- // If the quadtree covers the point already, just return.
6108
- else return this;
6109
-
6110
6205
  this._x0 = x0;
6111
6206
  this._y0 = y0;
6112
6207
  this._x1 = x1;
@@ -6633,27 +6728,35 @@ function simulation(nodes) {
6633
6728
  }
6634
6729
  }
6635
6730
 
6636
- function tick() {
6731
+ function tick(iterations) {
6637
6732
  var i, n = nodes.length, node;
6638
6733
 
6639
- alpha += (alphaTarget - alpha) * alphaDecay;
6734
+ if (iterations === undefined) iterations = 1;
6640
6735
 
6641
- forces.each(function(force) {
6642
- force(alpha);
6643
- });
6736
+ for (var k = 0; k < iterations; ++k) {
6737
+ alpha += (alphaTarget - alpha) * alphaDecay;
6644
6738
 
6645
- for (i = 0; i < n; ++i) {
6646
- node = nodes[i];
6647
- if (node.fx == null) node.x += node.vx *= velocityDecay;
6648
- else node.x = node.fx, node.vx = 0;
6649
- if (node.fy == null) node.y += node.vy *= velocityDecay;
6650
- else node.y = node.fy, node.vy = 0;
6739
+ forces.each(function (force) {
6740
+ force(alpha);
6741
+ });
6742
+
6743
+ for (i = 0; i < n; ++i) {
6744
+ node = nodes[i];
6745
+ if (node.fx == null) node.x += node.vx *= velocityDecay;
6746
+ else node.x = node.fx, node.vx = 0;
6747
+ if (node.fy == null) node.y += node.vy *= velocityDecay;
6748
+ else node.y = node.fy, node.vy = 0;
6749
+ }
6651
6750
  }
6751
+
6752
+ return simulation;
6652
6753
  }
6653
6754
 
6654
6755
  function initializeNodes() {
6655
6756
  for (var i = 0, n = nodes.length, node; i < n; ++i) {
6656
6757
  node = nodes[i], node.index = i;
6758
+ if (node.fx != null) node.x = node.fx;
6759
+ if (node.fy != null) node.y = node.fy;
6657
6760
  if (isNaN(node.x) || isNaN(node.y)) {
6658
6761
  var radius = initialRadius * Math.sqrt(i), angle = i * initialAngle;
6659
6762
  node.x = radius * Math.cos(angle);
@@ -7867,7 +7970,7 @@ function compose(a, b) {
7867
7970
  }
7868
7971
 
7869
7972
  function rotationIdentity(lambda, phi) {
7870
- return [lambda > pi$3 ? lambda - tau$3 : lambda < -pi$3 ? lambda + tau$3 : lambda, phi];
7973
+ return [abs(lambda) > pi$3 ? lambda + Math.round(-lambda / tau$3) * tau$3 : lambda, phi];
7871
7974
  }
7872
7975
 
7873
7976
  rotationIdentity.invert = rotationIdentity;
@@ -11828,6 +11931,24 @@ var exponential$1 = (function sourceRandomExponential(source) {
11828
11931
  return randomExponential;
11829
11932
  })(defaultSource$1);
11830
11933
 
11934
+ function initRange(domain, range) {
11935
+ switch (arguments.length) {
11936
+ case 0: break;
11937
+ case 1: this.range(domain); break;
11938
+ default: this.range(range).domain(domain); break;
11939
+ }
11940
+ return this;
11941
+ }
11942
+
11943
+ function initInterpolator(domain, interpolator) {
11944
+ switch (arguments.length) {
11945
+ case 0: break;
11946
+ case 1: this.interpolator(domain); break;
11947
+ default: this.interpolator(interpolator).domain(domain); break;
11948
+ }
11949
+ return this;
11950
+ }
11951
+
11831
11952
  var array$3 = Array.prototype;
11832
11953
 
11833
11954
  var map$2 = array$3.map;
@@ -11835,13 +11956,12 @@ var slice$5 = array$3.slice;
11835
11956
 
11836
11957
  var implicit = {name: "implicit"};
11837
11958
 
11838
- function ordinal(range) {
11959
+ function ordinal() {
11839
11960
  var index = map$1(),
11840
11961
  domain = [],
11962
+ range = [],
11841
11963
  unknown = implicit;
11842
11964
 
11843
- range = range == null ? [] : slice$5.call(range);
11844
-
11845
11965
  function scale(d) {
11846
11966
  var key = d + "", i = index.get(key);
11847
11967
  if (!i) {
@@ -11868,12 +11988,11 @@ function ordinal(range) {
11868
11988
  };
11869
11989
 
11870
11990
  scale.copy = function() {
11871
- return ordinal()
11872
- .domain(domain)
11873
- .range(range)
11874
- .unknown(unknown);
11991
+ return ordinal(domain, range).unknown(unknown);
11875
11992
  };
11876
11993
 
11994
+ initRange.apply(scale, arguments);
11995
+
11877
11996
  return scale;
11878
11997
  }
11879
11998
 
@@ -11930,15 +12049,15 @@ function band() {
11930
12049
  };
11931
12050
 
11932
12051
  scale.padding = function(_) {
11933
- return arguments.length ? (paddingInner = paddingOuter = Math.max(0, Math.min(1, _)), rescale()) : paddingInner;
12052
+ return arguments.length ? (paddingInner = Math.min(1, paddingOuter = +_), rescale()) : paddingInner;
11934
12053
  };
11935
12054
 
11936
12055
  scale.paddingInner = function(_) {
11937
- return arguments.length ? (paddingInner = Math.max(0, Math.min(1, _)), rescale()) : paddingInner;
12056
+ return arguments.length ? (paddingInner = Math.min(1, _), rescale()) : paddingInner;
11938
12057
  };
11939
12058
 
11940
12059
  scale.paddingOuter = function(_) {
11941
- return arguments.length ? (paddingOuter = Math.max(0, Math.min(1, _)), rescale()) : paddingOuter;
12060
+ return arguments.length ? (paddingOuter = +_, rescale()) : paddingOuter;
11942
12061
  };
11943
12062
 
11944
12063
  scale.align = function(_) {
@@ -11946,16 +12065,14 @@ function band() {
11946
12065
  };
11947
12066
 
11948
12067
  scale.copy = function() {
11949
- return band()
11950
- .domain(domain())
11951
- .range(range$$1)
12068
+ return band(domain(), range$$1)
11952
12069
  .round(round)
11953
12070
  .paddingInner(paddingInner)
11954
12071
  .paddingOuter(paddingOuter)
11955
12072
  .align(align);
11956
12073
  };
11957
12074
 
11958
- return rescale();
12075
+ return initRange.apply(rescale(), arguments);
11959
12076
  }
11960
12077
 
11961
12078
  function pointish(scale) {
@@ -11973,7 +12090,7 @@ function pointish(scale) {
11973
12090
  }
11974
12091
 
11975
12092
  function point$1() {
11976
- return pointish(band().paddingInner(1));
12093
+ return pointish(band.apply(null, arguments).paddingInner(1));
11977
12094
  }
11978
12095
 
11979
12096
  function constant$a(x) {
@@ -11988,34 +12105,32 @@ function number$2(x) {
11988
12105
 
11989
12106
  var unit = [0, 1];
11990
12107
 
11991
- function deinterpolateLinear(a, b) {
11992
- return (b -= (a = +a))
11993
- ? function(x) { return (x - a) / b; }
11994
- : constant$a(b);
12108
+ function identity$6(x) {
12109
+ return x;
11995
12110
  }
11996
12111
 
11997
- function deinterpolateClamp(deinterpolate) {
11998
- return function(a, b) {
11999
- var d = deinterpolate(a = +a, b = +b);
12000
- return function(x) { return x <= a ? 0 : x >= b ? 1 : d(x); };
12001
- };
12112
+ function normalize(a, b) {
12113
+ return (b -= (a = +a))
12114
+ ? function(x) { return (x - a) / b; }
12115
+ : constant$a(isNaN(b) ? NaN : 0.5);
12002
12116
  }
12003
12117
 
12004
- function reinterpolateClamp(reinterpolate) {
12005
- return function(a, b) {
12006
- var r = reinterpolate(a = +a, b = +b);
12007
- return function(t) { return t <= 0 ? a : t >= 1 ? b : r(t); };
12008
- };
12118
+ function clamper(domain) {
12119
+ var a = domain[0], b = domain[domain.length - 1], t;
12120
+ if (a > b) t = a, a = b, b = t;
12121
+ return function(x) { return Math.max(a, Math.min(b, x)); };
12009
12122
  }
12010
12123
 
12011
- function bimap(domain, range, deinterpolate, reinterpolate) {
12124
+ // normalize(a, b)(x) takes a domain value x in [a,b] and returns the corresponding parameter t in [0,1].
12125
+ // interpolate(a, b)(t) takes a parameter t in [0,1] and returns the corresponding range value x in [a,b].
12126
+ function bimap(domain, range, interpolate$$1) {
12012
12127
  var d0 = domain[0], d1 = domain[1], r0 = range[0], r1 = range[1];
12013
- if (d1 < d0) d0 = deinterpolate(d1, d0), r0 = reinterpolate(r1, r0);
12014
- else d0 = deinterpolate(d0, d1), r0 = reinterpolate(r0, r1);
12128
+ if (d1 < d0) d0 = normalize(d1, d0), r0 = interpolate$$1(r1, r0);
12129
+ else d0 = normalize(d0, d1), r0 = interpolate$$1(r0, r1);
12015
12130
  return function(x) { return r0(d0(x)); };
12016
12131
  }
12017
12132
 
12018
- function polymap(domain, range, deinterpolate, reinterpolate) {
12133
+ function polymap(domain, range, interpolate$$1) {
12019
12134
  var j = Math.min(domain.length, range.length) - 1,
12020
12135
  d = new Array(j),
12021
12136
  r = new Array(j),
@@ -12028,8 +12143,8 @@ function polymap(domain, range, deinterpolate, reinterpolate) {
12028
12143
  }
12029
12144
 
12030
12145
  while (++i < j) {
12031
- d[i] = deinterpolate(domain[i], domain[i + 1]);
12032
- r[i] = reinterpolate(range[i], range[i + 1]);
12146
+ d[i] = normalize(domain[i], domain[i + 1]);
12147
+ r[i] = interpolate$$1(range[i], range[i + 1]);
12033
12148
  }
12034
12149
 
12035
12150
  return function(x) {
@@ -12043,16 +12158,18 @@ function copy(source, target) {
12043
12158
  .domain(source.domain())
12044
12159
  .range(source.range())
12045
12160
  .interpolate(source.interpolate())
12046
- .clamp(source.clamp());
12161
+ .clamp(source.clamp())
12162
+ .unknown(source.unknown());
12047
12163
  }
12048
12164
 
12049
- // deinterpolate(a, b)(x) takes a domain value x in [a,b] and returns the corresponding parameter t in [0,1].
12050
- // reinterpolate(a, b)(t) takes a parameter t in [0,1] and returns the corresponding domain value x in [a,b].
12051
- function continuous(deinterpolate, reinterpolate) {
12165
+ function transformer$1() {
12052
12166
  var domain = unit,
12053
12167
  range = unit,
12054
12168
  interpolate$$1 = interpolateValue,
12055
- clamp = false,
12169
+ transform,
12170
+ untransform,
12171
+ unknown,
12172
+ clamp = identity$6,
12056
12173
  piecewise$$1,
12057
12174
  output,
12058
12175
  input;
@@ -12064,15 +12181,15 @@ function continuous(deinterpolate, reinterpolate) {
12064
12181
  }
12065
12182
 
12066
12183
  function scale(x) {
12067
- return (output || (output = piecewise$$1(domain, range, clamp ? deinterpolateClamp(deinterpolate) : deinterpolate, interpolate$$1)))(+x);
12184
+ return isNaN(x = +x) ? unknown : (output || (output = piecewise$$1(domain.map(transform), range, interpolate$$1)))(transform(clamp(x)));
12068
12185
  }
12069
12186
 
12070
12187
  scale.invert = function(y) {
12071
- return (input || (input = piecewise$$1(range, domain, deinterpolateLinear, clamp ? reinterpolateClamp(reinterpolate) : reinterpolate)))(+y);
12188
+ return clamp(untransform((input || (input = piecewise$$1(range, domain.map(transform), interpolateNumber)))(y)));
12072
12189
  };
12073
12190
 
12074
12191
  scale.domain = function(_) {
12075
- return arguments.length ? (domain = map$2.call(_, number$2), rescale()) : domain.slice();
12192
+ return arguments.length ? (domain = map$2.call(_, number$2), clamp === identity$6 || (clamp = clamper(domain)), rescale()) : domain.slice();
12076
12193
  };
12077
12194
 
12078
12195
  scale.range = function(_) {
@@ -12084,20 +12201,29 @@ function continuous(deinterpolate, reinterpolate) {
12084
12201
  };
12085
12202
 
12086
12203
  scale.clamp = function(_) {
12087
- return arguments.length ? (clamp = !!_, rescale()) : clamp;
12204
+ return arguments.length ? (clamp = _ ? clamper(domain) : identity$6, scale) : clamp !== identity$6;
12088
12205
  };
12089
12206
 
12090
12207
  scale.interpolate = function(_) {
12091
12208
  return arguments.length ? (interpolate$$1 = _, rescale()) : interpolate$$1;
12092
12209
  };
12093
12210
 
12094
- return rescale();
12211
+ scale.unknown = function(_) {
12212
+ return arguments.length ? (unknown = _, scale) : unknown;
12213
+ };
12214
+
12215
+ return function(t, u) {
12216
+ transform = t, untransform = u;
12217
+ return rescale();
12218
+ };
12095
12219
  }
12096
12220
 
12097
- function tickFormat(domain, count, specifier) {
12098
- var start = domain[0],
12099
- stop = domain[domain.length - 1],
12100
- step = tickStep(start, stop, count == null ? 10 : count),
12221
+ function continuous(transform, untransform) {
12222
+ return transformer$1()(transform, untransform);
12223
+ }
12224
+
12225
+ function tickFormat(start, stop, count, specifier) {
12226
+ var step = tickStep(start, stop, count),
12101
12227
  precision;
12102
12228
  specifier = formatSpecifier(specifier == null ? ",f" : specifier);
12103
12229
  switch (specifier.type) {
@@ -12132,7 +12258,8 @@ function linearish(scale) {
12132
12258
  };
12133
12259
 
12134
12260
  scale.tickFormat = function(count, specifier) {
12135
- return tickFormat(domain(), count, specifier);
12261
+ var d = domain();
12262
+ return tickFormat(d[0], d[d.length - 1], count == null ? 10 : count, specifier);
12136
12263
  };
12137
12264
 
12138
12265
  scale.nice = function(count) {
@@ -12179,20 +12306,22 @@ function linearish(scale) {
12179
12306
  }
12180
12307
 
12181
12308
  function linear$2() {
12182
- var scale = continuous(deinterpolateLinear, interpolateNumber);
12309
+ var scale = continuous(identity$6, identity$6);
12183
12310
 
12184
12311
  scale.copy = function() {
12185
12312
  return copy(scale, linear$2());
12186
12313
  };
12187
12314
 
12315
+ initRange.apply(scale, arguments);
12316
+
12188
12317
  return linearish(scale);
12189
12318
  }
12190
12319
 
12191
- function identity$6() {
12192
- var domain = [0, 1];
12320
+ function identity$7(domain) {
12321
+ var unknown;
12193
12322
 
12194
12323
  function scale(x) {
12195
- return +x;
12324
+ return isNaN(x = +x) ? unknown : x;
12196
12325
  }
12197
12326
 
12198
12327
  scale.invert = scale;
@@ -12201,10 +12330,16 @@ function identity$6() {
12201
12330
  return arguments.length ? (domain = map$2.call(_, number$2), scale) : domain.slice();
12202
12331
  };
12203
12332
 
12333
+ scale.unknown = function(_) {
12334
+ return arguments.length ? (unknown = _, scale) : unknown;
12335
+ };
12336
+
12204
12337
  scale.copy = function() {
12205
- return identity$6().domain(domain);
12338
+ return identity$7(domain).unknown(unknown);
12206
12339
  };
12207
12340
 
12341
+ domain = arguments.length ? map$2.call(domain, number$2) : [0, 1];
12342
+
12208
12343
  return linearish(scale);
12209
12344
  }
12210
12345
 
@@ -12227,16 +12362,20 @@ function nice(domain, interval) {
12227
12362
  return domain;
12228
12363
  }
12229
12364
 
12230
- function deinterpolate(a, b) {
12231
- return (b = Math.log(b / a))
12232
- ? function(x) { return Math.log(x / a) / b; }
12233
- : constant$a(b);
12365
+ function transformLog(x) {
12366
+ return Math.log(x);
12367
+ }
12368
+
12369
+ function transformExp(x) {
12370
+ return Math.exp(x);
12371
+ }
12372
+
12373
+ function transformLogn(x) {
12374
+ return -Math.log(-x);
12234
12375
  }
12235
12376
 
12236
- function reinterpolate(a, b) {
12237
- return a < 0
12238
- ? function(t) { return -Math.pow(-b, t) * Math.pow(-a, 1 - t); }
12239
- : function(t) { return Math.pow(b, t) * Math.pow(a, 1 - t); };
12377
+ function transformExpn(x) {
12378
+ return -Math.exp(-x);
12240
12379
  }
12241
12380
 
12242
12381
  function pow10(x) {
@@ -12262,16 +12401,21 @@ function reflect(f) {
12262
12401
  };
12263
12402
  }
12264
12403
 
12265
- function log$1() {
12266
- var scale = continuous(deinterpolate, reinterpolate).domain([1, 10]),
12404
+ function loggish(transform) {
12405
+ var scale = transform(transformLog, transformExp),
12267
12406
  domain = scale.domain,
12268
12407
  base = 10,
12269
- logs = logp(10),
12270
- pows = powp(10);
12408
+ logs,
12409
+ pows;
12271
12410
 
12272
12411
  function rescale() {
12273
12412
  logs = logp(base), pows = powp(base);
12274
- if (domain()[0] < 0) logs = reflect(logs), pows = reflect(pows);
12413
+ if (domain()[0] < 0) {
12414
+ logs = reflect(logs), pows = reflect(pows);
12415
+ transform(transformLogn, transformExpn);
12416
+ } else {
12417
+ transform(transformLog, transformExp);
12418
+ }
12275
12419
  return scale;
12276
12420
  }
12277
12421
 
@@ -12343,52 +12487,105 @@ function log$1() {
12343
12487
  }));
12344
12488
  };
12345
12489
 
12490
+ return scale;
12491
+ }
12492
+
12493
+ function log$1() {
12494
+ var scale = loggish(transformer$1()).domain([1, 10]);
12495
+
12346
12496
  scale.copy = function() {
12347
- return copy(scale, log$1().base(base));
12497
+ return copy(scale, log$1()).base(scale.base());
12348
12498
  };
12349
12499
 
12500
+ initRange.apply(scale, arguments);
12501
+
12350
12502
  return scale;
12351
12503
  }
12352
12504
 
12353
- function raise$1(x, exponent) {
12354
- return x < 0 ? -Math.pow(-x, exponent) : Math.pow(x, exponent);
12505
+ function transformSymlog(c) {
12506
+ return function(x) {
12507
+ return Math.sign(x) * Math.log1p(Math.abs(x / c));
12508
+ };
12355
12509
  }
12356
12510
 
12357
- function pow$1() {
12358
- var exponent = 1,
12359
- scale = continuous(deinterpolate, reinterpolate),
12360
- domain = scale.domain;
12511
+ function transformSymexp(c) {
12512
+ return function(x) {
12513
+ return Math.sign(x) * Math.expm1(Math.abs(x)) * c;
12514
+ };
12515
+ }
12361
12516
 
12362
- function deinterpolate(a, b) {
12363
- return (b = raise$1(b, exponent) - (a = raise$1(a, exponent)))
12364
- ? function(x) { return (raise$1(x, exponent) - a) / b; }
12365
- : constant$a(b);
12366
- }
12517
+ function symlogish(transform) {
12518
+ var c = 1, scale = transform(transformSymlog(c), transformSymexp(c));
12367
12519
 
12368
- function reinterpolate(a, b) {
12369
- b = raise$1(b, exponent) - (a = raise$1(a, exponent));
12370
- return function(t) { return raise$1(a + b * t, 1 / exponent); };
12520
+ scale.constant = function(_) {
12521
+ return arguments.length ? transform(transformSymlog(c = +_), transformSymexp(c)) : c;
12522
+ };
12523
+
12524
+ return linearish(scale);
12525
+ }
12526
+
12527
+ function symlog() {
12528
+ var scale = symlogish(transformer$1());
12529
+
12530
+ scale.copy = function() {
12531
+ return copy(scale, symlog()).constant(scale.constant());
12532
+ };
12533
+
12534
+ return initRange.apply(scale, arguments);
12535
+ }
12536
+
12537
+ function transformPow(exponent) {
12538
+ return function(x) {
12539
+ return x < 0 ? -Math.pow(-x, exponent) : Math.pow(x, exponent);
12540
+ };
12541
+ }
12542
+
12543
+ function transformSqrt(x) {
12544
+ return x < 0 ? -Math.sqrt(-x) : Math.sqrt(x);
12545
+ }
12546
+
12547
+ function transformSquare(x) {
12548
+ return x < 0 ? -x * x : x * x;
12549
+ }
12550
+
12551
+ function powish(transform) {
12552
+ var scale = transform(identity$6, identity$6),
12553
+ exponent = 1;
12554
+
12555
+ function rescale() {
12556
+ return exponent === 1 ? transform(identity$6, identity$6)
12557
+ : exponent === 0.5 ? transform(transformSqrt, transformSquare)
12558
+ : transform(transformPow(exponent), transformPow(1 / exponent));
12371
12559
  }
12372
12560
 
12373
12561
  scale.exponent = function(_) {
12374
- return arguments.length ? (exponent = +_, domain(domain())) : exponent;
12562
+ return arguments.length ? (exponent = +_, rescale()) : exponent;
12375
12563
  };
12376
12564
 
12565
+ return linearish(scale);
12566
+ }
12567
+
12568
+ function pow$1() {
12569
+ var scale = powish(transformer$1());
12570
+
12377
12571
  scale.copy = function() {
12378
- return copy(scale, pow$1().exponent(exponent));
12572
+ return copy(scale, pow$1()).exponent(scale.exponent());
12379
12573
  };
12380
12574
 
12381
- return linearish(scale);
12575
+ initRange.apply(scale, arguments);
12576
+
12577
+ return scale;
12382
12578
  }
12383
12579
 
12384
12580
  function sqrt$1() {
12385
- return pow$1().exponent(0.5);
12581
+ return pow$1.apply(null, arguments).exponent(0.5);
12386
12582
  }
12387
12583
 
12388
12584
  function quantile$$1() {
12389
12585
  var domain = [],
12390
12586
  range = [],
12391
- thresholds = [];
12587
+ thresholds = [],
12588
+ unknown;
12392
12589
 
12393
12590
  function rescale() {
12394
12591
  var i = 0, n = Math.max(1, range.length);
@@ -12398,7 +12595,7 @@ function quantile$$1() {
12398
12595
  }
12399
12596
 
12400
12597
  function scale(x) {
12401
- if (!isNaN(x = +x)) return range[bisectRight(thresholds, x)];
12598
+ return isNaN(x = +x) ? unknown : range[bisectRight(thresholds, x)];
12402
12599
  }
12403
12600
 
12404
12601
  scale.invertExtent = function(y) {
@@ -12421,6 +12618,10 @@ function quantile$$1() {
12421
12618
  return arguments.length ? (range = slice$5.call(_), rescale()) : range.slice();
12422
12619
  };
12423
12620
 
12621
+ scale.unknown = function(_) {
12622
+ return arguments.length ? (unknown = _, scale) : unknown;
12623
+ };
12624
+
12424
12625
  scale.quantiles = function() {
12425
12626
  return thresholds.slice();
12426
12627
  };
@@ -12428,10 +12629,11 @@ function quantile$$1() {
12428
12629
  scale.copy = function() {
12429
12630
  return quantile$$1()
12430
12631
  .domain(domain)
12431
- .range(range);
12632
+ .range(range)
12633
+ .unknown(unknown);
12432
12634
  };
12433
12635
 
12434
- return scale;
12636
+ return initRange.apply(scale, arguments);
12435
12637
  }
12436
12638
 
12437
12639
  function quantize$1() {
@@ -12439,10 +12641,11 @@ function quantize$1() {
12439
12641
  x1 = 1,
12440
12642
  n = 1,
12441
12643
  domain = [0.5],
12442
- range = [0, 1];
12644
+ range = [0, 1],
12645
+ unknown;
12443
12646
 
12444
12647
  function scale(x) {
12445
- if (x <= x) return range[bisectRight(domain, x, 0, n)];
12648
+ return x <= x ? range[bisectRight(domain, x, 0, n)] : unknown;
12446
12649
  }
12447
12650
 
12448
12651
  function rescale() {
@@ -12468,22 +12671,32 @@ function quantize$1() {
12468
12671
  : [domain[i - 1], domain[i]];
12469
12672
  };
12470
12673
 
12674
+ scale.unknown = function(_) {
12675
+ return arguments.length ? (unknown = _, scale) : scale;
12676
+ };
12677
+
12678
+ scale.thresholds = function() {
12679
+ return domain.slice();
12680
+ };
12681
+
12471
12682
  scale.copy = function() {
12472
12683
  return quantize$1()
12473
12684
  .domain([x0, x1])
12474
- .range(range);
12685
+ .range(range)
12686
+ .unknown(unknown);
12475
12687
  };
12476
12688
 
12477
- return linearish(scale);
12689
+ return initRange.apply(linearish(scale), arguments);
12478
12690
  }
12479
12691
 
12480
12692
  function threshold$1() {
12481
12693
  var domain = [0.5],
12482
12694
  range = [0, 1],
12695
+ unknown,
12483
12696
  n = 1;
12484
12697
 
12485
12698
  function scale(x) {
12486
- if (x <= x) return range[bisectRight(domain, x, 0, n)];
12699
+ return x <= x ? range[bisectRight(domain, x, 0, n)] : unknown;
12487
12700
  }
12488
12701
 
12489
12702
  scale.domain = function(_) {
@@ -12499,13 +12712,18 @@ function threshold$1() {
12499
12712
  return [domain[i - 1], domain[i]];
12500
12713
  };
12501
12714
 
12715
+ scale.unknown = function(_) {
12716
+ return arguments.length ? (unknown = _, scale) : unknown;
12717
+ };
12718
+
12502
12719
  scale.copy = function() {
12503
12720
  return threshold$1()
12504
12721
  .domain(domain)
12505
- .range(range);
12722
+ .range(range)
12723
+ .unknown(unknown);
12506
12724
  };
12507
12725
 
12508
- return scale;
12726
+ return initRange.apply(scale, arguments);
12509
12727
  }
12510
12728
 
12511
12729
  var t0$1 = new Date,
@@ -12607,7 +12825,7 @@ var durationDay = 864e5;
12607
12825
  var durationWeek = 6048e5;
12608
12826
 
12609
12827
  var second = newInterval(function(date) {
12610
- date.setTime(Math.floor(date / durationSecond) * durationSecond);
12828
+ date.setTime(date - date.getMilliseconds());
12611
12829
  }, function(date, step) {
12612
12830
  date.setTime(+date + step * durationSecond);
12613
12831
  }, function(start, end) {
@@ -12618,7 +12836,7 @@ var second = newInterval(function(date) {
12618
12836
  var seconds = second.range;
12619
12837
 
12620
12838
  var minute = newInterval(function(date) {
12621
- date.setTime(Math.floor(date / durationMinute) * durationMinute);
12839
+ date.setTime(date - date.getMilliseconds() - date.getSeconds() * durationSecond);
12622
12840
  }, function(date, step) {
12623
12841
  date.setTime(+date + step * durationMinute);
12624
12842
  }, function(start, end) {
@@ -12629,9 +12847,7 @@ var minute = newInterval(function(date) {
12629
12847
  var minutes = minute.range;
12630
12848
 
12631
12849
  var hour = newInterval(function(date) {
12632
- var offset = date.getTimezoneOffset() * durationMinute % durationHour;
12633
- if (offset < 0) offset += durationHour;
12634
- date.setTime(Math.floor((+date - offset) / durationHour) * durationHour + offset);
12850
+ date.setTime(date - date.getMilliseconds() - date.getSeconds() * durationSecond - date.getMinutes() * durationMinute);
12635
12851
  }, function(date, step) {
12636
12852
  date.setTime(+date + step * durationHour);
12637
12853
  }, function(start, end) {
@@ -12878,7 +13094,7 @@ function formatLocale$1(locale) {
12878
13094
  "W": formatWeekNumberMonday,
12879
13095
  "x": null,
12880
13096
  "X": null,
12881
- "y": formatYear,
13097
+ "y": formatYear$1,
12882
13098
  "Y": formatFullYear,
12883
13099
  "Z": formatZone,
12884
13100
  "%": formatLiteralPercent
@@ -13164,7 +13380,7 @@ var pads = {"-": "", "_": " ", "0": "0"},
13164
13380
  percentRe = /^%/,
13165
13381
  requoteRe = /[\\^$*+?|[\]().{}]/g;
13166
13382
 
13167
- function pad(value, fill, width) {
13383
+ function pad$1(value, fill, width) {
13168
13384
  var sign = value < 0 ? "-" : "",
13169
13385
  string = (sign ? -value : value) + "",
13170
13386
  length = string.length;
@@ -13281,23 +13497,23 @@ function parseUnixTimestampSeconds(d, string, i) {
13281
13497
  }
13282
13498
 
13283
13499
  function formatDayOfMonth(d, p) {
13284
- return pad(d.getDate(), p, 2);
13500
+ return pad$1(d.getDate(), p, 2);
13285
13501
  }
13286
13502
 
13287
13503
  function formatHour24(d, p) {
13288
- return pad(d.getHours(), p, 2);
13504
+ return pad$1(d.getHours(), p, 2);
13289
13505
  }
13290
13506
 
13291
13507
  function formatHour12(d, p) {
13292
- return pad(d.getHours() % 12 || 12, p, 2);
13508
+ return pad$1(d.getHours() % 12 || 12, p, 2);
13293
13509
  }
13294
13510
 
13295
13511
  function formatDayOfYear(d, p) {
13296
- return pad(1 + day.count(year(d), d), p, 3);
13512
+ return pad$1(1 + day.count(year(d), d), p, 3);
13297
13513
  }
13298
13514
 
13299
13515
  function formatMilliseconds(d, p) {
13300
- return pad(d.getMilliseconds(), p, 3);
13516
+ return pad$1(d.getMilliseconds(), p, 3);
13301
13517
  }
13302
13518
 
13303
13519
  function formatMicroseconds(d, p) {
@@ -13305,15 +13521,15 @@ function formatMicroseconds(d, p) {
13305
13521
  }
13306
13522
 
13307
13523
  function formatMonthNumber(d, p) {
13308
- return pad(d.getMonth() + 1, p, 2);
13524
+ return pad$1(d.getMonth() + 1, p, 2);
13309
13525
  }
13310
13526
 
13311
13527
  function formatMinutes(d, p) {
13312
- return pad(d.getMinutes(), p, 2);
13528
+ return pad$1(d.getMinutes(), p, 2);
13313
13529
  }
13314
13530
 
13315
13531
  function formatSeconds(d, p) {
13316
- return pad(d.getSeconds(), p, 2);
13532
+ return pad$1(d.getSeconds(), p, 2);
13317
13533
  }
13318
13534
 
13319
13535
  function formatWeekdayNumberMonday(d) {
@@ -13322,13 +13538,13 @@ function formatWeekdayNumberMonday(d) {
13322
13538
  }
13323
13539
 
13324
13540
  function formatWeekNumberSunday(d, p) {
13325
- return pad(sunday.count(year(d), d), p, 2);
13541
+ return pad$1(sunday.count(year(d), d), p, 2);
13326
13542
  }
13327
13543
 
13328
13544
  function formatWeekNumberISO(d, p) {
13329
13545
  var day$$1 = d.getDay();
13330
13546
  d = (day$$1 >= 4 || day$$1 === 0) ? thursday(d) : thursday.ceil(d);
13331
- return pad(thursday.count(year(d), d) + (year(d).getDay() === 4), p, 2);
13547
+ return pad$1(thursday.count(year(d), d) + (year(d).getDay() === 4), p, 2);
13332
13548
  }
13333
13549
 
13334
13550
  function formatWeekdayNumberSunday(d) {
@@ -13336,42 +13552,42 @@ function formatWeekdayNumberSunday(d) {
13336
13552
  }
13337
13553
 
13338
13554
  function formatWeekNumberMonday(d, p) {
13339
- return pad(monday.count(year(d), d), p, 2);
13555
+ return pad$1(monday.count(year(d), d), p, 2);
13340
13556
  }
13341
13557
 
13342
- function formatYear(d, p) {
13343
- return pad(d.getFullYear() % 100, p, 2);
13558
+ function formatYear$1(d, p) {
13559
+ return pad$1(d.getFullYear() % 100, p, 2);
13344
13560
  }
13345
13561
 
13346
13562
  function formatFullYear(d, p) {
13347
- return pad(d.getFullYear() % 10000, p, 4);
13563
+ return pad$1(d.getFullYear() % 10000, p, 4);
13348
13564
  }
13349
13565
 
13350
13566
  function formatZone(d) {
13351
13567
  var z = d.getTimezoneOffset();
13352
13568
  return (z > 0 ? "-" : (z *= -1, "+"))
13353
- + pad(z / 60 | 0, "0", 2)
13354
- + pad(z % 60, "0", 2);
13569
+ + pad$1(z / 60 | 0, "0", 2)
13570
+ + pad$1(z % 60, "0", 2);
13355
13571
  }
13356
13572
 
13357
13573
  function formatUTCDayOfMonth(d, p) {
13358
- return pad(d.getUTCDate(), p, 2);
13574
+ return pad$1(d.getUTCDate(), p, 2);
13359
13575
  }
13360
13576
 
13361
13577
  function formatUTCHour24(d, p) {
13362
- return pad(d.getUTCHours(), p, 2);
13578
+ return pad$1(d.getUTCHours(), p, 2);
13363
13579
  }
13364
13580
 
13365
13581
  function formatUTCHour12(d, p) {
13366
- return pad(d.getUTCHours() % 12 || 12, p, 2);
13582
+ return pad$1(d.getUTCHours() % 12 || 12, p, 2);
13367
13583
  }
13368
13584
 
13369
13585
  function formatUTCDayOfYear(d, p) {
13370
- return pad(1 + utcDay.count(utcYear(d), d), p, 3);
13586
+ return pad$1(1 + utcDay.count(utcYear(d), d), p, 3);
13371
13587
  }
13372
13588
 
13373
13589
  function formatUTCMilliseconds(d, p) {
13374
- return pad(d.getUTCMilliseconds(), p, 3);
13590
+ return pad$1(d.getUTCMilliseconds(), p, 3);
13375
13591
  }
13376
13592
 
13377
13593
  function formatUTCMicroseconds(d, p) {
@@ -13379,15 +13595,15 @@ function formatUTCMicroseconds(d, p) {
13379
13595
  }
13380
13596
 
13381
13597
  function formatUTCMonthNumber(d, p) {
13382
- return pad(d.getUTCMonth() + 1, p, 2);
13598
+ return pad$1(d.getUTCMonth() + 1, p, 2);
13383
13599
  }
13384
13600
 
13385
13601
  function formatUTCMinutes(d, p) {
13386
- return pad(d.getUTCMinutes(), p, 2);
13602
+ return pad$1(d.getUTCMinutes(), p, 2);
13387
13603
  }
13388
13604
 
13389
13605
  function formatUTCSeconds(d, p) {
13390
- return pad(d.getUTCSeconds(), p, 2);
13606
+ return pad$1(d.getUTCSeconds(), p, 2);
13391
13607
  }
13392
13608
 
13393
13609
  function formatUTCWeekdayNumberMonday(d) {
@@ -13396,13 +13612,13 @@ function formatUTCWeekdayNumberMonday(d) {
13396
13612
  }
13397
13613
 
13398
13614
  function formatUTCWeekNumberSunday(d, p) {
13399
- return pad(utcSunday.count(utcYear(d), d), p, 2);
13615
+ return pad$1(utcSunday.count(utcYear(d), d), p, 2);
13400
13616
  }
13401
13617
 
13402
13618
  function formatUTCWeekNumberISO(d, p) {
13403
13619
  var day$$1 = d.getUTCDay();
13404
13620
  d = (day$$1 >= 4 || day$$1 === 0) ? utcThursday(d) : utcThursday.ceil(d);
13405
- return pad(utcThursday.count(utcYear(d), d) + (utcYear(d).getUTCDay() === 4), p, 2);
13621
+ return pad$1(utcThursday.count(utcYear(d), d) + (utcYear(d).getUTCDay() === 4), p, 2);
13406
13622
  }
13407
13623
 
13408
13624
  function formatUTCWeekdayNumberSunday(d) {
@@ -13410,15 +13626,15 @@ function formatUTCWeekdayNumberSunday(d) {
13410
13626
  }
13411
13627
 
13412
13628
  function formatUTCWeekNumberMonday(d, p) {
13413
- return pad(utcMonday.count(utcYear(d), d), p, 2);
13629
+ return pad$1(utcMonday.count(utcYear(d), d), p, 2);
13414
13630
  }
13415
13631
 
13416
13632
  function formatUTCYear(d, p) {
13417
- return pad(d.getUTCFullYear() % 100, p, 2);
13633
+ return pad$1(d.getUTCFullYear() % 100, p, 2);
13418
13634
  }
13419
13635
 
13420
13636
  function formatUTCFullYear(d, p) {
13421
- return pad(d.getUTCFullYear() % 10000, p, 4);
13637
+ return pad$1(d.getUTCFullYear() % 10000, p, 4);
13422
13638
  }
13423
13639
 
13424
13640
  function formatUTCZone() {
@@ -13495,7 +13711,7 @@ function number$3(t) {
13495
13711
  }
13496
13712
 
13497
13713
  function calendar(year$$1, month$$1, week, day$$1, hour$$1, minute$$1, second$$1, millisecond$$1, format) {
13498
- var scale = continuous(deinterpolateLinear, interpolateNumber),
13714
+ var scale = continuous(identity$6, identity$6),
13499
13715
  invert = scale.invert,
13500
13716
  domain = scale.domain;
13501
13717
 
@@ -13529,14 +13745,14 @@ function calendar(year$$1, month$$1, week, day$$1, hour$$1, minute$$1, second$$1
13529
13745
  [ year$$1, 1, durationYear ]
13530
13746
  ];
13531
13747
 
13532
- function tickFormat(date$$1) {
13533
- return (second$$1(date$$1) < date$$1 ? formatMillisecond
13534
- : minute$$1(date$$1) < date$$1 ? formatSecond
13535
- : hour$$1(date$$1) < date$$1 ? formatMinute
13536
- : day$$1(date$$1) < date$$1 ? formatHour
13537
- : month$$1(date$$1) < date$$1 ? (week(date$$1) < date$$1 ? formatDay : formatWeek)
13538
- : year$$1(date$$1) < date$$1 ? formatMonth
13539
- : formatYear)(date$$1);
13748
+ function tickFormat(date) {
13749
+ return (second$$1(date) < date ? formatMillisecond
13750
+ : minute$$1(date) < date ? formatSecond
13751
+ : hour$$1(date) < date ? formatMinute
13752
+ : day$$1(date) < date ? formatHour
13753
+ : month$$1(date) < date ? (week(date) < date ? formatDay : formatWeek)
13754
+ : year$$1(date) < date ? formatMonth
13755
+ : formatYear)(date);
13540
13756
  }
13541
13757
 
13542
13758
  function tickInterval(interval, start, stop, step) {
@@ -13603,26 +13819,30 @@ function calendar(year$$1, month$$1, week, day$$1, hour$$1, minute$$1, second$$1
13603
13819
  }
13604
13820
 
13605
13821
  function time() {
13606
- return calendar(year, month, sunday, day, hour, minute, second, millisecond, exports.timeFormat).domain([new Date(2000, 0, 1), new Date(2000, 0, 2)]);
13822
+ return initRange.apply(calendar(year, month, sunday, day, hour, minute, second, millisecond, exports.timeFormat).domain([new Date(2000, 0, 1), new Date(2000, 0, 2)]), arguments);
13607
13823
  }
13608
13824
 
13609
13825
  function utcTime() {
13610
- return calendar(utcYear, utcMonth, utcSunday, utcDay, utcHour, utcMinute, second, millisecond, exports.utcFormat).domain([Date.UTC(2000, 0, 1), Date.UTC(2000, 0, 2)]);
13826
+ return initRange.apply(calendar(utcYear, utcMonth, utcSunday, utcDay, utcHour, utcMinute, second, millisecond, exports.utcFormat).domain([Date.UTC(2000, 0, 1), Date.UTC(2000, 0, 2)]), arguments);
13611
13827
  }
13612
13828
 
13613
- function sequential(interpolator) {
13829
+ function transformer$2() {
13614
13830
  var x0 = 0,
13615
13831
  x1 = 1,
13616
- k10 = 1,
13617
- clamp = false;
13832
+ t0,
13833
+ t1,
13834
+ k10,
13835
+ transform,
13836
+ interpolator = identity$6,
13837
+ clamp = false,
13838
+ unknown;
13618
13839
 
13619
13840
  function scale(x) {
13620
- var t = (x - x0) * k10;
13621
- return interpolator(clamp ? Math.max(0, Math.min(1, t)) : t);
13841
+ return isNaN(x = +x) ? unknown : interpolator(k10 === 0 ? 0.5 : (x = (transform(x) - t0) * k10, clamp ? Math.max(0, Math.min(1, x)) : x));
13622
13842
  }
13623
13843
 
13624
13844
  scale.domain = function(_) {
13625
- return arguments.length ? (x0 = +_[0], x1 = +_[1], k10 = x0 === x1 ? 0 : 1 / (x1 - x0), scale) : [x0, x1];
13845
+ return arguments.length ? (t0 = transform(x0 = +_[0]), t1 = transform(x1 = +_[1]), k10 = t0 === t1 ? 0 : 1 / (t1 - t0), scale) : [x0, x1];
13626
13846
  };
13627
13847
 
13628
13848
  scale.clamp = function(_) {
@@ -13633,28 +13853,115 @@ function sequential(interpolator) {
13633
13853
  return arguments.length ? (interpolator = _, scale) : interpolator;
13634
13854
  };
13635
13855
 
13856
+ scale.unknown = function(_) {
13857
+ return arguments.length ? (unknown = _, scale) : unknown;
13858
+ };
13859
+
13860
+ return function(t) {
13861
+ transform = t, t0 = t(x0), t1 = t(x1), k10 = t0 === t1 ? 0 : 1 / (t1 - t0);
13862
+ return scale;
13863
+ };
13864
+ }
13865
+
13866
+ function copy$1(source, target) {
13867
+ return target
13868
+ .domain(source.domain())
13869
+ .interpolator(source.interpolator())
13870
+ .clamp(source.clamp())
13871
+ .unknown(source.unknown());
13872
+ }
13873
+
13874
+ function sequential() {
13875
+ var scale = linearish(transformer$2()(identity$6));
13876
+
13877
+ scale.copy = function() {
13878
+ return copy$1(scale, sequential());
13879
+ };
13880
+
13881
+ return initInterpolator.apply(scale, arguments);
13882
+ }
13883
+
13884
+ function sequentialLog() {
13885
+ var scale = loggish(transformer$2()).domain([1, 10]);
13886
+
13636
13887
  scale.copy = function() {
13637
- return sequential(interpolator).domain([x0, x1]).clamp(clamp);
13888
+ return copy$1(scale, sequentialLog()).base(scale.base());
13638
13889
  };
13639
13890
 
13640
- return linearish(scale);
13891
+ return initInterpolator.apply(scale, arguments);
13641
13892
  }
13642
13893
 
13643
- function diverging(interpolator) {
13894
+ function sequentialSymlog() {
13895
+ var scale = symlogish(transformer$2());
13896
+
13897
+ scale.copy = function() {
13898
+ return copy$1(scale, sequentialSymlog()).constant(scale.constant());
13899
+ };
13900
+
13901
+ return initInterpolator.apply(scale, arguments);
13902
+ }
13903
+
13904
+ function sequentialPow() {
13905
+ var scale = powish(transformer$2());
13906
+
13907
+ scale.copy = function() {
13908
+ return copy$1(scale, sequentialPow()).exponent(scale.exponent());
13909
+ };
13910
+
13911
+ return initInterpolator.apply(scale, arguments);
13912
+ }
13913
+
13914
+ function sequentialSqrt() {
13915
+ return sequentialPow.apply(null, arguments).exponent(0.5);
13916
+ }
13917
+
13918
+ function sequentialQuantile() {
13919
+ var domain = [],
13920
+ interpolator = identity$6;
13921
+
13922
+ function scale(x) {
13923
+ if (!isNaN(x = +x)) return interpolator((bisectRight(domain, x) - 1) / (domain.length - 1));
13924
+ }
13925
+
13926
+ scale.domain = function(_) {
13927
+ if (!arguments.length) return domain.slice();
13928
+ domain = [];
13929
+ for (var i = 0, n = _.length, d; i < n; ++i) if (d = _[i], d != null && !isNaN(d = +d)) domain.push(d);
13930
+ domain.sort(ascending);
13931
+ return scale;
13932
+ };
13933
+
13934
+ scale.interpolator = function(_) {
13935
+ return arguments.length ? (interpolator = _, scale) : interpolator;
13936
+ };
13937
+
13938
+ scale.copy = function() {
13939
+ return sequentialQuantile(interpolator).domain(domain);
13940
+ };
13941
+
13942
+ return initInterpolator.apply(scale, arguments);
13943
+ }
13944
+
13945
+ function transformer$3() {
13644
13946
  var x0 = 0,
13645
13947
  x1 = 0.5,
13646
13948
  x2 = 1,
13647
- k10 = 1,
13648
- k21 = 1,
13649
- clamp = false;
13949
+ t0,
13950
+ t1,
13951
+ t2,
13952
+ k10,
13953
+ k21,
13954
+ interpolator = identity$6,
13955
+ transform,
13956
+ clamp = false,
13957
+ unknown;
13650
13958
 
13651
13959
  function scale(x) {
13652
- var t = 0.5 + ((x = +x) - x1) * (x < x1 ? k10 : k21);
13653
- return interpolator(clamp ? Math.max(0, Math.min(1, t)) : t);
13960
+ return isNaN(x = +x) ? unknown : (x = 0.5 + ((x = +transform(x)) - t1) * (x < t1 ? k10 : k21), interpolator(clamp ? Math.max(0, Math.min(1, x)) : x));
13654
13961
  }
13655
13962
 
13656
13963
  scale.domain = function(_) {
13657
- return arguments.length ? (x0 = +_[0], x1 = +_[1], x2 = +_[2], k10 = x0 === x1 ? 0 : 0.5 / (x1 - x0), k21 = x1 === x2 ? 0 : 0.5 / (x2 - x1), scale) : [x0, x1, x2];
13964
+ return arguments.length ? (t0 = transform(x0 = +_[0]), t1 = transform(x1 = +_[1]), t2 = transform(x2 = +_[2]), k10 = t0 === t1 ? 0 : 0.5 / (t1 - t0), k21 = t1 === t2 ? 0 : 0.5 / (t2 - t1), scale) : [x0, x1, x2];
13658
13965
  };
13659
13966
 
13660
13967
  scale.clamp = function(_) {
@@ -13665,11 +13972,58 @@ function diverging(interpolator) {
13665
13972
  return arguments.length ? (interpolator = _, scale) : interpolator;
13666
13973
  };
13667
13974
 
13975
+ scale.unknown = function(_) {
13976
+ return arguments.length ? (unknown = _, scale) : unknown;
13977
+ };
13978
+
13979
+ return function(t) {
13980
+ transform = t, t0 = t(x0), t1 = t(x1), t2 = t(x2), k10 = t0 === t1 ? 0 : 0.5 / (t1 - t0), k21 = t1 === t2 ? 0 : 0.5 / (t2 - t1);
13981
+ return scale;
13982
+ };
13983
+ }
13984
+
13985
+ function diverging() {
13986
+ var scale = linearish(transformer$3()(identity$6));
13987
+
13668
13988
  scale.copy = function() {
13669
- return diverging(interpolator).domain([x0, x1, x2]).clamp(clamp);
13989
+ return copy$1(scale, diverging());
13670
13990
  };
13671
13991
 
13672
- return linearish(scale);
13992
+ return initInterpolator.apply(scale, arguments);
13993
+ }
13994
+
13995
+ function divergingLog() {
13996
+ var scale = loggish(transformer$3()).domain([0.1, 1, 10]);
13997
+
13998
+ scale.copy = function() {
13999
+ return copy$1(scale, divergingLog()).base(scale.base());
14000
+ };
14001
+
14002
+ return initInterpolator.apply(scale, arguments);
14003
+ }
14004
+
14005
+ function divergingSymlog() {
14006
+ var scale = symlogish(transformer$3());
14007
+
14008
+ scale.copy = function() {
14009
+ return copy$1(scale, divergingSymlog()).constant(scale.constant());
14010
+ };
14011
+
14012
+ return initInterpolator.apply(scale, arguments);
14013
+ }
14014
+
14015
+ function divergingPow() {
14016
+ var scale = powish(transformer$3());
14017
+
14018
+ scale.copy = function() {
14019
+ return copy$1(scale, divergingPow()).exponent(scale.exponent());
14020
+ };
14021
+
14022
+ return initInterpolator.apply(scale, arguments);
14023
+ }
14024
+
14025
+ function divergingSqrt() {
14026
+ return divergingPow.apply(null, arguments).exponent(0.5);
13673
14027
  }
13674
14028
 
13675
14029
  function colors(specifier) {
@@ -14137,7 +14491,9 @@ function arcPadAngle(d) {
14137
14491
  function intersect(x0, y0, x1, y1, x2, y2, x3, y3) {
14138
14492
  var x10 = x1 - x0, y10 = y1 - y0,
14139
14493
  x32 = x3 - x2, y32 = y3 - y2,
14140
- t = (x32 * (y0 - y2) - y32 * (x0 - x2)) / (y32 * x10 - x32 * y10);
14494
+ t = y32 * x10 - x32 * y10;
14495
+ if (t * t < epsilon$3) return;
14496
+ t = (x32 * (y0 - y2) - y32 * (x0 - x2)) / t;
14141
14497
  return [x0 + t * x10, y0 + t * y10];
14142
14498
  }
14143
14499
 
@@ -14258,12 +14614,12 @@ function arc() {
14258
14614
  var x11 = r1 * cos$2(a11),
14259
14615
  y11 = r1 * sin$2(a11),
14260
14616
  x00 = r0 * cos$2(a00),
14261
- y00 = r0 * sin$2(a00);
14617
+ y00 = r0 * sin$2(a00),
14618
+ oc;
14262
14619
 
14263
14620
  // Restrict the corner radius according to the sector angle.
14264
- if (da < pi$4) {
14265
- var oc = da0 > epsilon$3 ? intersect(x01, y01, x00, y00, x11, y11, x10, y10) : [x10, y10],
14266
- ax = x01 - oc[0],
14621
+ if (da < pi$4 && (oc = intersect(x01, y01, x00, y00, x11, y11, x10, y10))) {
14622
+ var ax = x01 - oc[0],
14267
14623
  ay = y01 - oc[1],
14268
14624
  bx = x11 - oc[0],
14269
14625
  by = y11 - oc[1],
@@ -14569,12 +14925,12 @@ function descending$1(a, b) {
14569
14925
  return b < a ? -1 : b > a ? 1 : b >= a ? 0 : NaN;
14570
14926
  }
14571
14927
 
14572
- function identity$7(d) {
14928
+ function identity$8(d) {
14573
14929
  return d;
14574
14930
  }
14575
14931
 
14576
14932
  function pie() {
14577
- var value = identity$7,
14933
+ var value = identity$8,
14578
14934
  sortValues = descending$1,
14579
14935
  sort = null,
14580
14936
  startAngle = constant$b(0),
@@ -15917,6 +16273,17 @@ function wiggle(series, order) {
15917
16273
  none$1(series, order);
15918
16274
  }
15919
16275
 
16276
+ function appearance(series) {
16277
+ var peaks = series.map(peak);
16278
+ return none$2(series).sort(function(a, b) { return peaks[a] - peaks[b]; });
16279
+ }
16280
+
16281
+ function peak(series) {
16282
+ var i = -1, j = 0, n = series.length, vi, vj = -Infinity;
16283
+ while (++i < n) if ((vi = +series[i][1]) > vj) vj = vi, j = i;
16284
+ return j;
16285
+ }
16286
+
15920
16287
  function ascending$3(series) {
15921
16288
  var sums = series.map(sum$2);
15922
16289
  return none$2(series).sort(function(a, b) { return sums[a] - sums[b]; });
@@ -15937,7 +16304,7 @@ function insideOut(series) {
15937
16304
  i,
15938
16305
  j,
15939
16306
  sums = series.map(sum$2),
15940
- order = none$2(series).sort(function(a, b) { return sums[b] - sums[a]; }),
16307
+ order = appearance(series),
15941
16308
  top = 0,
15942
16309
  bottom = 0,
15943
16310
  tops = [],
@@ -17003,12 +17370,12 @@ Transform.prototype = {
17003
17370
  }
17004
17371
  };
17005
17372
 
17006
- var identity$8 = new Transform(1, 0, 0);
17373
+ var identity$9 = new Transform(1, 0, 0);
17007
17374
 
17008
17375
  transform$1.prototype = Transform.prototype;
17009
17376
 
17010
17377
  function transform$1(node) {
17011
- return node.__zoom || identity$8;
17378
+ return node.__zoom || identity$9;
17012
17379
  }
17013
17380
 
17014
17381
  function nopropagation$2() {
@@ -17039,7 +17406,7 @@ function defaultExtent$1() {
17039
17406
  }
17040
17407
 
17041
17408
  function defaultTransform() {
17042
- return this.__zoom || identity$8;
17409
+ return this.__zoom || identity$9;
17043
17410
  }
17044
17411
 
17045
17412
  function defaultWheelDelta() {
@@ -17141,7 +17508,7 @@ function zoom() {
17141
17508
  var e = extent.apply(this, arguments),
17142
17509
  t = this.__zoom,
17143
17510
  p = centroid(e);
17144
- return constrain(identity$8.translate(p[0], p[1]).scale(t.k).translate(
17511
+ return constrain(identity$9.translate(p[0], p[1]).scale(t.k).translate(
17145
17512
  typeof x === "function" ? -x.apply(this, arguments) : -x,
17146
17513
  typeof y === "function" ? -y.apply(this, arguments) : -y
17147
17514
  ), e, translateExtent);
@@ -17502,11 +17869,14 @@ exports.dsvFormat = dsvFormat;
17502
17869
  exports.csvParse = csvParse;
17503
17870
  exports.csvParseRows = csvParseRows;
17504
17871
  exports.csvFormat = csvFormat;
17872
+ exports.csvFormatBody = csvFormatBody;
17505
17873
  exports.csvFormatRows = csvFormatRows;
17506
17874
  exports.tsvParse = tsvParse;
17507
17875
  exports.tsvParseRows = tsvParseRows;
17508
17876
  exports.tsvFormat = tsvFormat;
17877
+ exports.tsvFormatBody = tsvFormatBody;
17509
17878
  exports.tsvFormatRows = tsvFormatRows;
17879
+ exports.autoType = autoType;
17510
17880
  exports.easeLinear = linear$1;
17511
17881
  exports.easeQuad = quadInOut;
17512
17882
  exports.easeQuadIn = quadIn;
@@ -17674,9 +18044,10 @@ exports.randomIrwinHall = irwinHall;
17674
18044
  exports.randomExponential = exponential$1;
17675
18045
  exports.scaleBand = band;
17676
18046
  exports.scalePoint = point$1;
17677
- exports.scaleIdentity = identity$6;
18047
+ exports.scaleIdentity = identity$7;
17678
18048
  exports.scaleLinear = linear$2;
17679
18049
  exports.scaleLog = log$1;
18050
+ exports.scaleSymlog = symlog;
17680
18051
  exports.scaleOrdinal = ordinal;
17681
18052
  exports.scaleImplicit = implicit;
17682
18053
  exports.scalePow = pow$1;
@@ -17687,7 +18058,17 @@ exports.scaleThreshold = threshold$1;
17687
18058
  exports.scaleTime = time;
17688
18059
  exports.scaleUtc = utcTime;
17689
18060
  exports.scaleSequential = sequential;
18061
+ exports.scaleSequentialLog = sequentialLog;
18062
+ exports.scaleSequentialPow = sequentialPow;
18063
+ exports.scaleSequentialSqrt = sequentialSqrt;
18064
+ exports.scaleSequentialSymlog = sequentialSymlog;
18065
+ exports.scaleSequentialQuantile = sequentialQuantile;
17690
18066
  exports.scaleDiverging = diverging;
18067
+ exports.scaleDivergingLog = divergingLog;
18068
+ exports.scaleDivergingPow = divergingPow;
18069
+ exports.scaleDivergingSqrt = divergingSqrt;
18070
+ exports.scaleDivergingSymlog = divergingSymlog;
18071
+ exports.tickFormat = tickFormat;
17691
18072
  exports.schemeCategory10 = category10;
17692
18073
  exports.schemeAccent = Accent;
17693
18074
  exports.schemeDark2 = Dark2;
@@ -17763,7 +18144,7 @@ exports.interpolatePlasma = plasma;
17763
18144
  exports.create = create;
17764
18145
  exports.creator = creator;
17765
18146
  exports.local = local;
17766
- exports.matcher = matcher$1;
18147
+ exports.matcher = matcher;
17767
18148
  exports.mouse = mouse;
17768
18149
  exports.namespace = namespace;
17769
18150
  exports.namespaces = namespaces;
@@ -17823,6 +18204,7 @@ exports.stackOffsetDiverging = diverging$1;
17823
18204
  exports.stackOffsetNone = none$1;
17824
18205
  exports.stackOffsetSilhouette = silhouette;
17825
18206
  exports.stackOffsetWiggle = wiggle;
18207
+ exports.stackOrderAppearance = appearance;
17826
18208
  exports.stackOrderAscending = ascending$3;
17827
18209
  exports.stackOrderDescending = descending$2;
17828
18210
  exports.stackOrderInsideOut = insideOut;
@@ -17904,7 +18286,7 @@ exports.interrupt = interrupt;
17904
18286
  exports.voronoi = voronoi;
17905
18287
  exports.zoom = zoom;
17906
18288
  exports.zoomTransform = transform$1;
17907
- exports.zoomIdentity = identity$8;
18289
+ exports.zoomIdentity = identity$9;
17908
18290
 
17909
18291
  Object.defineProperty(exports, '__esModule', { value: true });
17910
18292