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