@hpcc-js/chart 2.80.0 → 2.80.2

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.
package/dist/index.es6.js CHANGED
@@ -1,12 +1,12 @@
1
1
  import { INDChart, ITooltip, I2DChart, I1DChart, I2DAggrChart } from '@hpcc-js/api';
2
- import { select, scaleTime, timeParse, timeFormat, scaleLog, format, scalePow, scaleLinear, scaleBand, publish, SVGWidget, brushSelection, d3Event, hsl, min as min$1, max as max$1, Utility, brush, brushX, brushY, scaleSqrt, extent, Text, local, FAChar, descending as descending$1, HTMLWidget, tickStep, range, thresholdSturges, drag, event, dispatch, interpolate, interpolateHcl, Palette, rgb, CanvasWidget, zoom } from '@hpcc-js/common';
2
+ import { select, scaleTime, timeParse, timeFormat, scaleLog, format, scalePow, scaleLinear, scaleBand, publish, SVGWidget, brushSelection, d3Event, hsl, min as min$1, max as max$1, Utility, brush, brushX, brushY, scaleSqrt, extent, Text, local, FAChar, descending as descending$1, HTMLWidget, thresholdSturges, tickStep, range, drag, event, dispatch, interpolate, interpolateHcl, Palette, rgb, CanvasWidget, zoom } from '@hpcc-js/common';
3
3
  import { normalizeRadians, degreesToRadians } from '@hpcc-js/util';
4
4
 
5
5
  var PKG_NAME = "@hpcc-js/chart";
6
- var PKG_VERSION = "2.80.0";
7
- var BUILD_VERSION = "2.104.0";
6
+ var PKG_VERSION = "2.80.2";
7
+ var BUILD_VERSION = "2.104.5";
8
8
 
9
- /*! *****************************************************************************
9
+ /******************************************************************************
10
10
  Copyright (c) Microsoft Corporation.
11
11
 
12
12
  Permission to use, copy, modify, and/or distribute this software for any
@@ -750,7 +750,7 @@ function d3Pie() {
750
750
  return pie;
751
751
  }
752
752
 
753
- function point$6(that, x, y) {
753
+ function point$7(that, x, y) {
754
754
  that._context.bezierCurveTo(
755
755
  (2 * that._x0 + that._x1) / 3,
756
756
  (2 * that._y0 + that._y1) / 3,
@@ -761,11 +761,11 @@ function point$6(that, x, y) {
761
761
  );
762
762
  }
763
763
 
764
- function Basis(context) {
764
+ function Basis$1(context) {
765
765
  this._context = context;
766
766
  }
767
767
 
768
- Basis.prototype = {
768
+ Basis$1.prototype = {
769
769
  areaStart: function() {
770
770
  this._line = 0;
771
771
  },
@@ -779,7 +779,7 @@ Basis.prototype = {
779
779
  },
780
780
  lineEnd: function() {
781
781
  switch (this._point) {
782
- case 3: point$6(this, this._x1, this._y1); // proceed
782
+ case 3: point$7(this, this._x1, this._y1); // proceed
783
783
  case 2: this._context.lineTo(this._x1, this._y1); break;
784
784
  }
785
785
  if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath();
@@ -791,7 +791,7 @@ Basis.prototype = {
791
791
  case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break;
792
792
  case 1: this._point = 2; break;
793
793
  case 2: this._point = 3; this._context.lineTo((5 * this._x0 + this._x1) / 6, (5 * this._y0 + this._y1) / 6); // proceed
794
- default: point$6(this, x, y); break;
794
+ default: point$7(this, x, y); break;
795
795
  }
796
796
  this._x0 = this._x1, this._x1 = x;
797
797
  this._y0 = this._y1, this._y1 = y;
@@ -799,15 +799,15 @@ Basis.prototype = {
799
799
  };
800
800
 
801
801
  function d3CurveBasis(context) {
802
- return new Basis(context);
802
+ return new Basis$1(context);
803
803
  }
804
804
 
805
- function Bundle(context, beta) {
806
- this._basis = new Basis(context);
805
+ function Bundle$1(context, beta) {
806
+ this._basis = new Basis$1(context);
807
807
  this._beta = beta;
808
808
  }
809
809
 
810
- Bundle.prototype = {
810
+ Bundle$1.prototype = {
811
811
  lineStart: function() {
812
812
  this._x = [];
813
813
  this._y = [];
@@ -847,7 +847,7 @@ Bundle.prototype = {
847
847
  var d3CurveBundle = (function custom(beta) {
848
848
 
849
849
  function bundle(context) {
850
- return beta === 1 ? new Basis(context) : new Bundle(context, beta);
850
+ return beta === 1 ? new Basis$1(context) : new Bundle$1(context, beta);
851
851
  }
852
852
 
853
853
  bundle.beta = function(beta) {
@@ -857,7 +857,7 @@ var d3CurveBundle = (function custom(beta) {
857
857
  return bundle;
858
858
  })(0.85);
859
859
 
860
- function point$5(that, x, y) {
860
+ function point$6(that, x, y) {
861
861
  that._context.bezierCurveTo(
862
862
  that._x1 + that._k * (that._x2 - that._x0),
863
863
  that._y1 + that._k * (that._y2 - that._y0),
@@ -888,7 +888,7 @@ Cardinal$1.prototype = {
888
888
  lineEnd: function() {
889
889
  switch (this._point) {
890
890
  case 2: this._context.lineTo(this._x2, this._y2); break;
891
- case 3: point$5(this, this._x1, this._y1); break;
891
+ case 3: point$6(this, this._x1, this._y1); break;
892
892
  }
893
893
  if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath();
894
894
  this._line = 1 - this._line;
@@ -899,7 +899,7 @@ Cardinal$1.prototype = {
899
899
  case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break;
900
900
  case 1: this._point = 2; this._x1 = x, this._y1 = y; break;
901
901
  case 2: this._point = 3; // proceed
902
- default: point$5(this, x, y); break;
902
+ default: point$6(this, x, y); break;
903
903
  }
904
904
  this._x0 = this._x1, this._x1 = this._x2, this._x2 = x;
905
905
  this._y0 = this._y1, this._y1 = this._y2, this._y2 = y;
@@ -919,7 +919,7 @@ var d3CurveCardinal = (function custom(tension) {
919
919
  return cardinal;
920
920
  })(0);
921
921
 
922
- function point$4(that, x, y) {
922
+ function point$5(that, x, y) {
923
923
  var x1 = that._x1,
924
924
  y1 = that._y1,
925
925
  x2 = that._x2,
@@ -982,7 +982,7 @@ CatmullRom$1.prototype = {
982
982
  case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break;
983
983
  case 1: this._point = 2; break;
984
984
  case 2: this._point = 3; // proceed
985
- default: point$4(this, x, y); break;
985
+ default: point$5(this, x, y); break;
986
986
  }
987
987
 
988
988
  this._l01_a = this._l12_a, this._l12_a = this._l23_a;
@@ -1031,7 +1031,7 @@ function slope2$1(that, t) {
1031
1031
  // According to https://en.wikipedia.org/wiki/Cubic_Hermite_spline#Representations
1032
1032
  // "you can express cubic Hermite interpolation in terms of cubic Bézier curves
1033
1033
  // with respect to the four values p0, p0 + m0 / 3, p1 - m1 / 3, p1".
1034
- function point$3(that, t0, t1) {
1034
+ function point$4(that, t0, t1) {
1035
1035
  var x0 = that._x0,
1036
1036
  y0 = that._y0,
1037
1037
  x1 = that._x1,
@@ -1060,7 +1060,7 @@ MonotoneX$1.prototype = {
1060
1060
  lineEnd: function() {
1061
1061
  switch (this._point) {
1062
1062
  case 2: this._context.lineTo(this._x1, this._y1); break;
1063
- case 3: point$3(this, this._t0, slope2$1(this, this._t0)); break;
1063
+ case 3: point$4(this, this._t0, slope2$1(this, this._t0)); break;
1064
1064
  }
1065
1065
  if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath();
1066
1066
  this._line = 1 - this._line;
@@ -1073,8 +1073,8 @@ MonotoneX$1.prototype = {
1073
1073
  switch (this._point) {
1074
1074
  case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break;
1075
1075
  case 1: this._point = 2; break;
1076
- case 2: this._point = 3; point$3(this, slope2$1(this, t1 = slope3$1(this, x, y)), t1); break;
1077
- default: point$3(this, this._t0, t1 = slope3$1(this, x, y)); break;
1076
+ case 2: this._point = 3; point$4(this, slope2$1(this, t1 = slope3$1(this, x, y)), t1); break;
1077
+ default: point$4(this, this._t0, t1 = slope3$1(this, x, y)); break;
1078
1078
  }
1079
1079
 
1080
1080
  this._x0 = this._x1, this._x1 = x;
@@ -4143,7 +4143,13 @@ var BubbleXY = /** @class */ (function (_super) {
4143
4143
  }(Scatter));
4144
4144
  BubbleXY.prototype._class += " chart_BubbleXY";
4145
4145
 
4146
- var taskHead,
4146
+ var frame = 0, // is an animation frame pending?
4147
+ timeout = 0, // is a timeout pending?
4148
+ interval = 0, // are any timers active?
4149
+ pokeDelay = 1000, // how frequently we check for clock skew
4150
+ taskHead,
4151
+ taskTail,
4152
+ clockLast = 0,
4147
4153
  clockNow = 0,
4148
4154
  clockSkew = 0,
4149
4155
  clock = typeof performance === "object" && performance.now ? performance : Date,
@@ -4157,13 +4163,89 @@ function clearNow() {
4157
4163
  clockNow = 0;
4158
4164
  }
4159
4165
 
4166
+ function Timer() {
4167
+ this._call =
4168
+ this._time =
4169
+ this._next = null;
4170
+ }
4171
+
4172
+ Timer.prototype = {
4173
+ constructor: Timer,
4174
+ restart: function(callback, delay, time) {
4175
+ if (typeof callback !== "function") throw new TypeError("callback is not a function");
4176
+ time = (time == null ? now() : +time) + (delay == null ? 0 : +delay);
4177
+ if (!this._next && taskTail !== this) {
4178
+ if (taskTail) taskTail._next = this;
4179
+ else taskHead = this;
4180
+ taskTail = this;
4181
+ }
4182
+ this._call = callback;
4183
+ this._time = time;
4184
+ sleep();
4185
+ },
4186
+ stop: function() {
4187
+ if (this._call) {
4188
+ this._call = null;
4189
+ this._time = Infinity;
4190
+ sleep();
4191
+ }
4192
+ }
4193
+ };
4194
+
4160
4195
  function timerFlush() {
4161
4196
  now(); // Get the current time, if not already set.
4197
+ ++frame; // Pretend we’ve set an alarm, if we haven’t already.
4162
4198
  var t = taskHead, e;
4163
4199
  while (t) {
4164
4200
  if ((e = clockNow - t._time) >= 0) t._call.call(null, e);
4165
4201
  t = t._next;
4166
4202
  }
4203
+ --frame;
4204
+ }
4205
+
4206
+ function wake() {
4207
+ clockNow = (clockLast = clock.now()) + clockSkew;
4208
+ frame = timeout = 0;
4209
+ try {
4210
+ timerFlush();
4211
+ } finally {
4212
+ frame = 0;
4213
+ nap();
4214
+ clockNow = 0;
4215
+ }
4216
+ }
4217
+
4218
+ function poke() {
4219
+ var now = clock.now(), delay = now - clockLast;
4220
+ if (delay > pokeDelay) clockSkew -= delay, clockLast = now;
4221
+ }
4222
+
4223
+ function nap() {
4224
+ var t0, t1 = taskHead, t2, time = Infinity;
4225
+ while (t1) {
4226
+ if (t1._call) {
4227
+ if (time > t1._time) time = t1._time;
4228
+ t0 = t1, t1 = t1._next;
4229
+ } else {
4230
+ t2 = t1._next, t1._next = null;
4231
+ t1 = t0 ? t0._next = t2 : taskHead = t2;
4232
+ }
4233
+ }
4234
+ taskTail = t0;
4235
+ sleep(time);
4236
+ }
4237
+
4238
+ function sleep(time) {
4239
+ if (frame) return; // Soonest alarm already set, or will be.
4240
+ if (timeout) timeout = clearTimeout(timeout);
4241
+ var delay = time - clockNow; // Strictly less than if we recomputed clockNow.
4242
+ if (delay > 24) {
4243
+ if (time < Infinity) timeout = setTimeout(wake, time - clock.now() - clockSkew);
4244
+ if (interval) interval = clearInterval(interval);
4245
+ } else {
4246
+ if (!interval) clockLast = clock.now(), interval = setInterval(poke, pokeDelay);
4247
+ frame = 1, setFrame(wake);
4248
+ }
4167
4249
  }
4168
4250
 
4169
4251
  function d3Bullet () {
@@ -4533,7 +4615,7 @@ function within(p, q, r) {
4533
4615
  return p <= q && q <= r || r <= q && q <= p;
4534
4616
  }
4535
4617
 
4536
- function noop$1() {}
4618
+ function noop$2() {}
4537
4619
 
4538
4620
  var cases = [
4539
4621
  [],
@@ -4725,7 +4807,7 @@ function contours() {
4725
4807
  };
4726
4808
 
4727
4809
  contours.smooth = function(_) {
4728
- return arguments.length ? (smooth = _ ? smoothLinear : noop$1, contours) : smooth === smoothLinear;
4810
+ return arguments.length ? (smooth = _ ? smoothLinear : noop$2, contours) : smooth === smoothLinear;
4729
4811
  };
4730
4812
 
4731
4813
  return contours;
@@ -4950,7 +5032,7 @@ var tau$1 = pi$1 * 2;
4950
5032
  var abs = Math.abs;
4951
5033
  var sqrt = Math.sqrt;
4952
5034
 
4953
- function noop() {}
5035
+ function noop$1() {}
4954
5036
 
4955
5037
  function streamGeometry(geometry, stream) {
4956
5038
  if (geometry && streamGeometryType.hasOwnProperty(geometry.type)) {
@@ -5034,15 +5116,15 @@ var areaSum = adder(),
5034
5116
  y0$3;
5035
5117
 
5036
5118
  var areaStream = {
5037
- point: noop,
5038
- lineStart: noop,
5039
- lineEnd: noop,
5119
+ point: noop$1,
5120
+ lineStart: noop$1,
5121
+ lineEnd: noop$1,
5040
5122
  polygonStart: function() {
5041
5123
  areaStream.lineStart = areaRingStart;
5042
5124
  areaStream.lineEnd = areaRingEnd;
5043
5125
  },
5044
5126
  polygonEnd: function() {
5045
- areaStream.lineStart = areaStream.lineEnd = areaStream.point = noop;
5127
+ areaStream.lineStart = areaStream.lineEnd = areaStream.point = noop$1;
5046
5128
  areaSum.add(abs(areaRingSum));
5047
5129
  areaRingSum.reset();
5048
5130
  },
@@ -5080,10 +5162,10 @@ var x0$2 = Infinity,
5080
5162
 
5081
5163
  var boundsStream = {
5082
5164
  point: boundsPoint,
5083
- lineStart: noop,
5084
- lineEnd: noop,
5085
- polygonStart: noop,
5086
- polygonEnd: noop,
5165
+ lineStart: noop$1,
5166
+ lineEnd: noop$1,
5167
+ polygonStart: noop$1,
5168
+ polygonEnd: noop$1,
5087
5169
  result: function() {
5088
5170
  var bounds = [[x0$2, y0$2], [x1, y1]];
5089
5171
  x1 = y1 = -(y0$2 = x0$2 = Infinity);
@@ -5239,7 +5321,7 @@ PathContext.prototype = {
5239
5321
  }
5240
5322
  }
5241
5323
  },
5242
- result: noop
5324
+ result: noop$1
5243
5325
  };
5244
5326
 
5245
5327
  var lengthSum = adder(),
@@ -5250,13 +5332,13 @@ var lengthSum = adder(),
5250
5332
  y0;
5251
5333
 
5252
5334
  var lengthStream = {
5253
- point: noop,
5335
+ point: noop$1,
5254
5336
  lineStart: function() {
5255
5337
  lengthStream.point = lengthPointFirst;
5256
5338
  },
5257
5339
  lineEnd: function() {
5258
5340
  if (lengthRing) lengthPoint(x00, y00);
5259
- lengthStream.point = noop;
5341
+ lengthStream.point = noop$1;
5260
5342
  },
5261
5343
  polygonStart: function() {
5262
5344
  lengthRing = true;
@@ -5841,6 +5923,111 @@ function line() {
5841
5923
  return line;
5842
5924
  }
5843
5925
 
5926
+ function noop() {}
5927
+
5928
+ function point$3(that, x, y) {
5929
+ that._context.bezierCurveTo(
5930
+ (2 * that._x0 + that._x1) / 3,
5931
+ (2 * that._y0 + that._y1) / 3,
5932
+ (that._x0 + 2 * that._x1) / 3,
5933
+ (that._y0 + 2 * that._y1) / 3,
5934
+ (that._x0 + 4 * that._x1 + x) / 6,
5935
+ (that._y0 + 4 * that._y1 + y) / 6
5936
+ );
5937
+ }
5938
+
5939
+ function Basis(context) {
5940
+ this._context = context;
5941
+ }
5942
+
5943
+ Basis.prototype = {
5944
+ areaStart: function() {
5945
+ this._line = 0;
5946
+ },
5947
+ areaEnd: function() {
5948
+ this._line = NaN;
5949
+ },
5950
+ lineStart: function() {
5951
+ this._x0 = this._x1 =
5952
+ this._y0 = this._y1 = NaN;
5953
+ this._point = 0;
5954
+ },
5955
+ lineEnd: function() {
5956
+ switch (this._point) {
5957
+ case 3: point$3(this, this._x1, this._y1); // proceed
5958
+ case 2: this._context.lineTo(this._x1, this._y1); break;
5959
+ }
5960
+ if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath();
5961
+ this._line = 1 - this._line;
5962
+ },
5963
+ point: function(x, y) {
5964
+ x = +x, y = +y;
5965
+ switch (this._point) {
5966
+ case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break;
5967
+ case 1: this._point = 2; break;
5968
+ case 2: this._point = 3; this._context.lineTo((5 * this._x0 + this._x1) / 6, (5 * this._y0 + this._y1) / 6); // proceed
5969
+ default: point$3(this, x, y); break;
5970
+ }
5971
+ this._x0 = this._x1, this._x1 = x;
5972
+ this._y0 = this._y1, this._y1 = y;
5973
+ }
5974
+ };
5975
+
5976
+ function Bundle(context, beta) {
5977
+ this._basis = new Basis(context);
5978
+ this._beta = beta;
5979
+ }
5980
+
5981
+ Bundle.prototype = {
5982
+ lineStart: function() {
5983
+ this._x = [];
5984
+ this._y = [];
5985
+ this._basis.lineStart();
5986
+ },
5987
+ lineEnd: function() {
5988
+ var x = this._x,
5989
+ y = this._y,
5990
+ j = x.length - 1;
5991
+
5992
+ if (j > 0) {
5993
+ var x0 = x[0],
5994
+ y0 = y[0],
5995
+ dx = x[j] - x0,
5996
+ dy = y[j] - y0,
5997
+ i = -1,
5998
+ t;
5999
+
6000
+ while (++i <= j) {
6001
+ t = i / j;
6002
+ this._basis.point(
6003
+ this._beta * x[i] + (1 - this._beta) * (x0 + t * dx),
6004
+ this._beta * y[i] + (1 - this._beta) * (y0 + t * dy)
6005
+ );
6006
+ }
6007
+ }
6008
+
6009
+ this._x = this._y = null;
6010
+ this._basis.lineEnd();
6011
+ },
6012
+ point: function(x, y) {
6013
+ this._x.push(+x);
6014
+ this._y.push(+y);
6015
+ }
6016
+ };
6017
+
6018
+ ((function custom(beta) {
6019
+
6020
+ function bundle(context) {
6021
+ return beta === 1 ? new Basis(context) : new Bundle(context, beta);
6022
+ }
6023
+
6024
+ bundle.beta = function(beta) {
6025
+ return custom(+beta);
6026
+ };
6027
+
6028
+ return bundle;
6029
+ }))(0.85);
6030
+
5844
6031
  function point$2(that, x, y) {
5845
6032
  that._context.bezierCurveTo(
5846
6033
  that._x1 + that._k * (that._x2 - that._x0),
@@ -5890,6 +6077,126 @@ Cardinal.prototype = {
5890
6077
  }
5891
6078
  };
5892
6079
 
6080
+ ((function custom(tension) {
6081
+
6082
+ function cardinal(context) {
6083
+ return new Cardinal(context, tension);
6084
+ }
6085
+
6086
+ cardinal.tension = function(tension) {
6087
+ return custom(+tension);
6088
+ };
6089
+
6090
+ return cardinal;
6091
+ }))(0);
6092
+
6093
+ function CardinalClosed(context, tension) {
6094
+ this._context = context;
6095
+ this._k = (1 - tension) / 6;
6096
+ }
6097
+
6098
+ CardinalClosed.prototype = {
6099
+ areaStart: noop,
6100
+ areaEnd: noop,
6101
+ lineStart: function() {
6102
+ this._x0 = this._x1 = this._x2 = this._x3 = this._x4 = this._x5 =
6103
+ this._y0 = this._y1 = this._y2 = this._y3 = this._y4 = this._y5 = NaN;
6104
+ this._point = 0;
6105
+ },
6106
+ lineEnd: function() {
6107
+ switch (this._point) {
6108
+ case 1: {
6109
+ this._context.moveTo(this._x3, this._y3);
6110
+ this._context.closePath();
6111
+ break;
6112
+ }
6113
+ case 2: {
6114
+ this._context.lineTo(this._x3, this._y3);
6115
+ this._context.closePath();
6116
+ break;
6117
+ }
6118
+ case 3: {
6119
+ this.point(this._x3, this._y3);
6120
+ this.point(this._x4, this._y4);
6121
+ this.point(this._x5, this._y5);
6122
+ break;
6123
+ }
6124
+ }
6125
+ },
6126
+ point: function(x, y) {
6127
+ x = +x, y = +y;
6128
+ switch (this._point) {
6129
+ case 0: this._point = 1; this._x3 = x, this._y3 = y; break;
6130
+ case 1: this._point = 2; this._context.moveTo(this._x4 = x, this._y4 = y); break;
6131
+ case 2: this._point = 3; this._x5 = x, this._y5 = y; break;
6132
+ default: point$2(this, x, y); break;
6133
+ }
6134
+ this._x0 = this._x1, this._x1 = this._x2, this._x2 = x;
6135
+ this._y0 = this._y1, this._y1 = this._y2, this._y2 = y;
6136
+ }
6137
+ };
6138
+
6139
+ ((function custom(tension) {
6140
+
6141
+ function cardinal(context) {
6142
+ return new CardinalClosed(context, tension);
6143
+ }
6144
+
6145
+ cardinal.tension = function(tension) {
6146
+ return custom(+tension);
6147
+ };
6148
+
6149
+ return cardinal;
6150
+ }))(0);
6151
+
6152
+ function CardinalOpen(context, tension) {
6153
+ this._context = context;
6154
+ this._k = (1 - tension) / 6;
6155
+ }
6156
+
6157
+ CardinalOpen.prototype = {
6158
+ areaStart: function() {
6159
+ this._line = 0;
6160
+ },
6161
+ areaEnd: function() {
6162
+ this._line = NaN;
6163
+ },
6164
+ lineStart: function() {
6165
+ this._x0 = this._x1 = this._x2 =
6166
+ this._y0 = this._y1 = this._y2 = NaN;
6167
+ this._point = 0;
6168
+ },
6169
+ lineEnd: function() {
6170
+ if (this._line || (this._line !== 0 && this._point === 3)) this._context.closePath();
6171
+ this._line = 1 - this._line;
6172
+ },
6173
+ point: function(x, y) {
6174
+ x = +x, y = +y;
6175
+ switch (this._point) {
6176
+ case 0: this._point = 1; break;
6177
+ case 1: this._point = 2; break;
6178
+ case 2: this._point = 3; this._line ? this._context.lineTo(this._x2, this._y2) : this._context.moveTo(this._x2, this._y2); break;
6179
+ case 3: this._point = 4; // proceed
6180
+ default: point$2(this, x, y); break;
6181
+ }
6182
+ this._x0 = this._x1, this._x1 = this._x2, this._x2 = x;
6183
+ this._y0 = this._y1, this._y1 = this._y2, this._y2 = y;
6184
+ }
6185
+ };
6186
+
6187
+ ((function custom(tension) {
6188
+
6189
+ function cardinal(context) {
6190
+ return new CardinalOpen(context, tension);
6191
+ }
6192
+
6193
+ cardinal.tension = function(tension) {
6194
+ return custom(+tension);
6195
+ };
6196
+
6197
+ return cardinal;
6198
+ }))(0);
6199
+
5893
6200
  function point$1(that, x, y) {
5894
6201
  var x1 = that._x1,
5895
6202
  y1 = that._y1,
@@ -5976,6 +6283,137 @@ var curveCatmullRom = (function custom(alpha) {
5976
6283
  return catmullRom;
5977
6284
  })(0.5);
5978
6285
 
6286
+ function CatmullRomClosed(context, alpha) {
6287
+ this._context = context;
6288
+ this._alpha = alpha;
6289
+ }
6290
+
6291
+ CatmullRomClosed.prototype = {
6292
+ areaStart: noop,
6293
+ areaEnd: noop,
6294
+ lineStart: function() {
6295
+ this._x0 = this._x1 = this._x2 = this._x3 = this._x4 = this._x5 =
6296
+ this._y0 = this._y1 = this._y2 = this._y3 = this._y4 = this._y5 = NaN;
6297
+ this._l01_a = this._l12_a = this._l23_a =
6298
+ this._l01_2a = this._l12_2a = this._l23_2a =
6299
+ this._point = 0;
6300
+ },
6301
+ lineEnd: function() {
6302
+ switch (this._point) {
6303
+ case 1: {
6304
+ this._context.moveTo(this._x3, this._y3);
6305
+ this._context.closePath();
6306
+ break;
6307
+ }
6308
+ case 2: {
6309
+ this._context.lineTo(this._x3, this._y3);
6310
+ this._context.closePath();
6311
+ break;
6312
+ }
6313
+ case 3: {
6314
+ this.point(this._x3, this._y3);
6315
+ this.point(this._x4, this._y4);
6316
+ this.point(this._x5, this._y5);
6317
+ break;
6318
+ }
6319
+ }
6320
+ },
6321
+ point: function(x, y) {
6322
+ x = +x, y = +y;
6323
+
6324
+ if (this._point) {
6325
+ var x23 = this._x2 - x,
6326
+ y23 = this._y2 - y;
6327
+ this._l23_a = Math.sqrt(this._l23_2a = Math.pow(x23 * x23 + y23 * y23, this._alpha));
6328
+ }
6329
+
6330
+ switch (this._point) {
6331
+ case 0: this._point = 1; this._x3 = x, this._y3 = y; break;
6332
+ case 1: this._point = 2; this._context.moveTo(this._x4 = x, this._y4 = y); break;
6333
+ case 2: this._point = 3; this._x5 = x, this._y5 = y; break;
6334
+ default: point$1(this, x, y); break;
6335
+ }
6336
+
6337
+ this._l01_a = this._l12_a, this._l12_a = this._l23_a;
6338
+ this._l01_2a = this._l12_2a, this._l12_2a = this._l23_2a;
6339
+ this._x0 = this._x1, this._x1 = this._x2, this._x2 = x;
6340
+ this._y0 = this._y1, this._y1 = this._y2, this._y2 = y;
6341
+ }
6342
+ };
6343
+
6344
+ ((function custom(alpha) {
6345
+
6346
+ function catmullRom(context) {
6347
+ return alpha ? new CatmullRomClosed(context, alpha) : new CardinalClosed(context, 0);
6348
+ }
6349
+
6350
+ catmullRom.alpha = function(alpha) {
6351
+ return custom(+alpha);
6352
+ };
6353
+
6354
+ return catmullRom;
6355
+ }))(0.5);
6356
+
6357
+ function CatmullRomOpen(context, alpha) {
6358
+ this._context = context;
6359
+ this._alpha = alpha;
6360
+ }
6361
+
6362
+ CatmullRomOpen.prototype = {
6363
+ areaStart: function() {
6364
+ this._line = 0;
6365
+ },
6366
+ areaEnd: function() {
6367
+ this._line = NaN;
6368
+ },
6369
+ lineStart: function() {
6370
+ this._x0 = this._x1 = this._x2 =
6371
+ this._y0 = this._y1 = this._y2 = NaN;
6372
+ this._l01_a = this._l12_a = this._l23_a =
6373
+ this._l01_2a = this._l12_2a = this._l23_2a =
6374
+ this._point = 0;
6375
+ },
6376
+ lineEnd: function() {
6377
+ if (this._line || (this._line !== 0 && this._point === 3)) this._context.closePath();
6378
+ this._line = 1 - this._line;
6379
+ },
6380
+ point: function(x, y) {
6381
+ x = +x, y = +y;
6382
+
6383
+ if (this._point) {
6384
+ var x23 = this._x2 - x,
6385
+ y23 = this._y2 - y;
6386
+ this._l23_a = Math.sqrt(this._l23_2a = Math.pow(x23 * x23 + y23 * y23, this._alpha));
6387
+ }
6388
+
6389
+ switch (this._point) {
6390
+ case 0: this._point = 1; break;
6391
+ case 1: this._point = 2; break;
6392
+ case 2: this._point = 3; this._line ? this._context.lineTo(this._x2, this._y2) : this._context.moveTo(this._x2, this._y2); break;
6393
+ case 3: this._point = 4; // proceed
6394
+ default: point$1(this, x, y); break;
6395
+ }
6396
+
6397
+ this._l01_a = this._l12_a, this._l12_a = this._l23_a;
6398
+ this._l01_2a = this._l12_2a, this._l12_2a = this._l23_2a;
6399
+ this._x0 = this._x1, this._x1 = this._x2, this._x2 = x;
6400
+ this._y0 = this._y1, this._y1 = this._y2, this._y2 = y;
6401
+ }
6402
+ };
6403
+
6404
+ ((function custom(alpha) {
6405
+
6406
+ function catmullRom(context) {
6407
+ return alpha ? new CatmullRomOpen(context, alpha) : new CardinalOpen(context, 0);
6408
+ }
6409
+
6410
+ catmullRom.alpha = function(alpha) {
6411
+ return custom(+alpha);
6412
+ };
6413
+
6414
+ return catmullRom;
6415
+ }))(0.5);
6416
+
5979
6417
  function sign(x) {
5980
6418
  return x < 0 ? -1 : 1;
5981
6419
  }