@hpcc-js/chart 2.83.4 → 2.84.0
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 +107 -37
- package/dist/index.es6.js.map +1 -1
- package/dist/index.js +107 -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 +7 -6
- package/src/Heat.ts +6 -1
- package/src/__package__.ts +2 -2
- package/src/__tests__/heat.ts +70 -0
- package/src/__tests__/index.ts +2 -0
- package/src/__tests__/test3.ts +69 -0
- package/types/Heat.d.ts +3 -0
- package/types/Heat.d.ts.map +1 -1
- package/types/__package__.d.ts +2 -2
- package/types/__package__.d.ts.map +1 -1
- package/types/__tests__/heat.d.ts +8 -0
- package/types/__tests__/heat.d.ts.map +1 -0
- package/types/__tests__/index.d.ts +2 -0
- package/types/__tests__/index.d.ts.map +1 -0
- package/types/__tests__/test3.d.ts +9 -0
- package/types/__tests__/test3.d.ts.map +1 -0
- package/types-3.4/Heat.d.ts +3 -0
- package/types-3.4/__package__.d.ts +2 -2
- package/types-3.4/__tests__/heat.d.ts +8 -0
- package/types-3.4/__tests__/index.d.ts +2 -0
- package/types-3.4/__tests__/test3.d.ts +9 -0
package/dist/index.es6.js
CHANGED
|
@@ -3,8 +3,8 @@ import { publish, select, scaleTime, timeParse, timeFormat, scaleLog, format, sc
|
|
|
3
3
|
import { normalizeRadians, degreesToRadians } from '@hpcc-js/util';
|
|
4
4
|
|
|
5
5
|
var PKG_NAME = "@hpcc-js/chart";
|
|
6
|
-
var PKG_VERSION = "2.
|
|
7
|
-
var BUILD_VERSION = "2.
|
|
6
|
+
var PKG_VERSION = "2.84.0";
|
|
7
|
+
var BUILD_VERSION = "2.106.0";
|
|
8
8
|
|
|
9
9
|
/******************************************************************************
|
|
10
10
|
Copyright (c) Microsoft Corporation.
|
|
@@ -48,6 +48,35 @@ function __metadata(metadataKey, metadataValue) {
|
|
|
48
48
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
+
function __values(o) {
|
|
52
|
+
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
53
|
+
if (m) return m.call(o);
|
|
54
|
+
if (o && typeof o.length === "number") return {
|
|
55
|
+
next: function () {
|
|
56
|
+
if (o && i >= o.length) o = void 0;
|
|
57
|
+
return { value: o && o[i++], done: !o };
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function __read(o, n) {
|
|
64
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
65
|
+
if (!m) return o;
|
|
66
|
+
var i = m.call(o), r, ar = [], e;
|
|
67
|
+
try {
|
|
68
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
69
|
+
}
|
|
70
|
+
catch (error) { e = { error: error }; }
|
|
71
|
+
finally {
|
|
72
|
+
try {
|
|
73
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
74
|
+
}
|
|
75
|
+
finally { if (e) throw e.error; }
|
|
76
|
+
}
|
|
77
|
+
return ar;
|
|
78
|
+
}
|
|
79
|
+
|
|
51
80
|
function __spreadArray(to, from, pack) {
|
|
52
81
|
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
53
82
|
if (ar || !(i in from)) {
|
|
@@ -2431,12 +2460,22 @@ var XYAxis = /** @class */ (function (_super) {
|
|
|
2431
2460
|
})
|
|
2432
2461
|
.merge(focusChart)
|
|
2433
2462
|
.each(function () {
|
|
2463
|
+
var e_1, _a;
|
|
2434
2464
|
context.copyPropsTo(context.focusChart, ["layers"]);
|
|
2435
2465
|
var layerIdx = 0;
|
|
2436
|
-
|
|
2437
|
-
var
|
|
2438
|
-
|
|
2439
|
-
|
|
2466
|
+
try {
|
|
2467
|
+
for (var _b = __values(context.layers()), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
2468
|
+
var layer = _c.value;
|
|
2469
|
+
layer.copyPropsTo(context.focusChart.layers()[layerIdx]);
|
|
2470
|
+
layerIdx++;
|
|
2471
|
+
}
|
|
2472
|
+
}
|
|
2473
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
2474
|
+
finally {
|
|
2475
|
+
try {
|
|
2476
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
2477
|
+
}
|
|
2478
|
+
finally { if (e_1) throw e_1.error; }
|
|
2440
2479
|
}
|
|
2441
2480
|
context.focusChart
|
|
2442
2481
|
.xAxisFocus(false)
|
|
@@ -2487,7 +2526,7 @@ var XYAxis = /** @class */ (function (_super) {
|
|
|
2487
2526
|
if (!retVal.length) {
|
|
2488
2527
|
return masterColumns;
|
|
2489
2528
|
}
|
|
2490
|
-
return __spreadArray([masterColumns[0]], retVal,
|
|
2529
|
+
return __spreadArray([masterColumns[0]], __read(retVal), false);
|
|
2491
2530
|
};
|
|
2492
2531
|
XYAxis.prototype.layerColumnIndices = function (host) {
|
|
2493
2532
|
var masterColumns = host.columns();
|
|
@@ -2516,24 +2555,44 @@ var XYAxis = /** @class */ (function (_super) {
|
|
|
2516
2555
|
XYAxis.prototype.layerExit = function (host, element, duration) {
|
|
2517
2556
|
};
|
|
2518
2557
|
XYAxis.prototype.chartsEnter = function (host, element, duration) {
|
|
2558
|
+
var e_2, _a;
|
|
2519
2559
|
if (duration === void 0) { duration = 250; }
|
|
2520
2560
|
this.layerEnter(this, element, duration);
|
|
2521
|
-
|
|
2522
|
-
var
|
|
2523
|
-
|
|
2524
|
-
|
|
2525
|
-
|
|
2526
|
-
|
|
2527
|
-
|
|
2561
|
+
try {
|
|
2562
|
+
for (var _b = __values(this.layers()), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
2563
|
+
var w = _c.value;
|
|
2564
|
+
w["__xyAxisElement"] = element.append("g")
|
|
2565
|
+
.attr("class", w.class());
|
|
2566
|
+
w
|
|
2567
|
+
.target(w["__xyAxisElement"].node())
|
|
2568
|
+
.layerEnter(this, element, duration);
|
|
2569
|
+
}
|
|
2570
|
+
}
|
|
2571
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
2572
|
+
finally {
|
|
2573
|
+
try {
|
|
2574
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
2575
|
+
}
|
|
2576
|
+
finally { if (e_2) throw e_2.error; }
|
|
2528
2577
|
}
|
|
2529
2578
|
};
|
|
2530
2579
|
XYAxis.prototype.chartsUpdate = function (width, height, duration) {
|
|
2580
|
+
var e_3, _a;
|
|
2531
2581
|
this.layerUpdate(this, this.svgData, duration);
|
|
2532
|
-
|
|
2533
|
-
var
|
|
2534
|
-
|
|
2535
|
-
|
|
2536
|
-
|
|
2582
|
+
try {
|
|
2583
|
+
for (var _b = __values(this.layers()), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
2584
|
+
var w = _c.value;
|
|
2585
|
+
w
|
|
2586
|
+
.resize({ width: width, height: height })
|
|
2587
|
+
.layerUpdate(this, w["__xyAxisElement"], duration);
|
|
2588
|
+
}
|
|
2589
|
+
}
|
|
2590
|
+
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
2591
|
+
finally {
|
|
2592
|
+
try {
|
|
2593
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
2594
|
+
}
|
|
2595
|
+
finally { if (e_3) throw e_3.error; }
|
|
2537
2596
|
}
|
|
2538
2597
|
};
|
|
2539
2598
|
XYAxis.prototype.exit = function (domNode, element) {
|
|
@@ -3336,7 +3395,7 @@ var Column = /** @class */ (function (_super) {
|
|
|
3336
3395
|
columnGRect.exit().transition().duration(duration)
|
|
3337
3396
|
.style("opacity", 0)
|
|
3338
3397
|
.remove();
|
|
3339
|
-
var value4pos = host.yAxisStacked() ? domainSums[dataRowIdx] : Math.max.apply(Math, dataRow.filter(function (_, idx) { return idx > 0 && idx < columnLength; }));
|
|
3398
|
+
var value4pos = host.yAxisStacked() ? domainSums[dataRowIdx] : Math.max.apply(Math, __spreadArray([], __read(dataRow.filter(function (_, idx) { return idx > 0 && idx < columnLength; })), false));
|
|
3340
3399
|
var stackedTotalText = element.selectAll(".stackedTotalText").data(context.showDomainTotal() ? [domainSums[dataRowIdx]] : []);
|
|
3341
3400
|
var stackedTotalTextEnter = stackedTotalText.enter().append("g")
|
|
3342
3401
|
.attr("class", "stackedTotalText")
|
|
@@ -3390,6 +3449,7 @@ var Column = /** @class */ (function (_super) {
|
|
|
3390
3449
|
.remove();
|
|
3391
3450
|
};
|
|
3392
3451
|
Column.prototype.calcInnerText = function (offset, innerText, valueText) {
|
|
3452
|
+
var e_1, _a;
|
|
3393
3453
|
var fontFamily = this.innerTextFontFamily_exists() ? this.innerTextFontFamily() : "Verdana";
|
|
3394
3454
|
var fontSize = this.innerTextFontSize();
|
|
3395
3455
|
var valueFontFamily = this.valueFontFamily_exists() ? this.valueFontFamily() : "Verdana";
|
|
@@ -3416,15 +3476,24 @@ var Column = /** @class */ (function (_super) {
|
|
|
3416
3476
|
else if (fullWidth2 < offset) {
|
|
3417
3477
|
var excessWidth = offset - fullWidth2;
|
|
3418
3478
|
var _text = "";
|
|
3419
|
-
|
|
3420
|
-
var
|
|
3421
|
-
|
|
3422
|
-
|
|
3423
|
-
|
|
3479
|
+
try {
|
|
3480
|
+
for (var innerText_1 = __values(innerText), innerText_1_1 = innerText_1.next(); !innerText_1_1.done; innerText_1_1 = innerText_1.next()) {
|
|
3481
|
+
var letter = innerText_1_1.value;
|
|
3482
|
+
if (this.textSize(_text + letter, fontFamily, fontSize).width > excessWidth) {
|
|
3483
|
+
innerText = _text + "...";
|
|
3484
|
+
break;
|
|
3485
|
+
}
|
|
3486
|
+
else {
|
|
3487
|
+
_text += letter;
|
|
3488
|
+
}
|
|
3424
3489
|
}
|
|
3425
|
-
|
|
3426
|
-
|
|
3490
|
+
}
|
|
3491
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
3492
|
+
finally {
|
|
3493
|
+
try {
|
|
3494
|
+
if (innerText_1_1 && !innerText_1_1.done && (_a = innerText_1.return)) _a.call(innerText_1);
|
|
3427
3495
|
}
|
|
3496
|
+
finally { if (e_1) throw e_1.error; }
|
|
3428
3497
|
}
|
|
3429
3498
|
category = 2;
|
|
3430
3499
|
}
|
|
@@ -8806,7 +8875,7 @@ var Gauge = /** @class */ (function (_super) {
|
|
|
8806
8875
|
this._usageArc = element.append("path").datum({ startAngle: value2Angle(0), endAngle: value2Angle(0) })
|
|
8807
8876
|
.style("fill", "green")
|
|
8808
8877
|
.on("mousemove", function (d) {
|
|
8809
|
-
var _a = _this._d3Arc.centroid(d), x = _a[0], y = _a[1];
|
|
8878
|
+
var _a = __read(_this._d3Arc.centroid(d), 2), x = _a[0], y = _a[1];
|
|
8810
8879
|
_this.tip({ x: x, y: y, label: _this.valueDescription() });
|
|
8811
8880
|
})
|
|
8812
8881
|
.on("mouseout", function (d) {
|
|
@@ -8817,7 +8886,7 @@ var Gauge = /** @class */ (function (_super) {
|
|
|
8817
8886
|
this._meanArc = element.append("path").datum({ startAngle: value2Angle(0), endAngle: value2Angle(0) })
|
|
8818
8887
|
.style("fill", "black")
|
|
8819
8888
|
.on("mousemove", function (d) {
|
|
8820
|
-
var _a = _this._d3Arc.centroid(d), x = _a[0], y = _a[1];
|
|
8889
|
+
var _a = __read(_this._d3Arc.centroid(d), 2), x = _a[0], y = _a[1];
|
|
8821
8890
|
_this.tip({ x: x, y: y, label: _this.tickValueDescription() });
|
|
8822
8891
|
})
|
|
8823
8892
|
.on("mouseout", function (d) {
|
|
@@ -8831,7 +8900,7 @@ var Gauge = /** @class */ (function (_super) {
|
|
|
8831
8900
|
.style("stroke", "black")
|
|
8832
8901
|
.attr("d", "M 0 0 l -3 -3 l 6 0 z")
|
|
8833
8902
|
.on("mousemove", function (d) {
|
|
8834
|
-
var _a = context._d3Arc.centroid(context._meanArc.datum()), x = _a[0], y = _a[1];
|
|
8903
|
+
var _a = __read(context._d3Arc.centroid(context._meanArc.datum()), 2), x = _a[0], y = _a[1];
|
|
8835
8904
|
context.tip({ x: x, y: y, label: context.tickValueDescription() });
|
|
8836
8905
|
})
|
|
8837
8906
|
.on("mouseout", function (d) {
|
|
@@ -9118,7 +9187,7 @@ var Pie = /** @class */ (function (_super) {
|
|
|
9118
9187
|
.padRadius(outerRadius)
|
|
9119
9188
|
.outerRadius(outerRadius);
|
|
9120
9189
|
this._quadIdxArr = [[], [], [], []];
|
|
9121
|
-
var data = __spreadArray([], this.data(),
|
|
9190
|
+
var data = __spreadArray([], __read(this.data()), false).sort(function (a, b) {
|
|
9122
9191
|
return a[1] - b[1] > 0 ? -1 : 1;
|
|
9123
9192
|
});
|
|
9124
9193
|
var arc = this._slices.selectAll(".arc").data(this.d3Pie(data), function (d) { return d.data[0]; });
|
|
@@ -9212,7 +9281,7 @@ var Pie = /** @class */ (function (_super) {
|
|
|
9212
9281
|
.attr("points", function (d, i) {
|
|
9213
9282
|
var pos = context.d3LabelArc.centroid(d);
|
|
9214
9283
|
var pos1 = context.d3Arc.centroid(d);
|
|
9215
|
-
var pos2 = __spreadArray([], pos,
|
|
9284
|
+
var pos2 = __spreadArray([], __read(pos), false);
|
|
9216
9285
|
pos[0] = labelRadius * (context.isLeftSide(midAngle(d)) ? 1 : -1);
|
|
9217
9286
|
pos[1] = context._labelPositions[i].top;
|
|
9218
9287
|
return [pos1, pos2, pos];
|
|
@@ -9429,7 +9498,7 @@ var Heat = /** @class */ (function (_super) {
|
|
|
9429
9498
|
var data = host.orientation() === "horizontal" ?
|
|
9430
9499
|
this.data().map(function (r) { return [host.dataPos(r[0]), host.valuePos(r[1]), r[2]]; }) :
|
|
9431
9500
|
this.data().map(function (r) { return [host.valuePos(r[1]), host.dataPos(r[0]), r[2]]; });
|
|
9432
|
-
var maxWeight = max$1(data, function (r) { return r[2]; });
|
|
9501
|
+
var maxWeight = this.maxWeight_exists() ? this.maxWeight() : max$1(data, function (r) { return r[2]; });
|
|
9433
9502
|
if (this.paletteID() !== "default") {
|
|
9434
9503
|
var gradient = {};
|
|
9435
9504
|
var count = 8;
|
|
@@ -9463,6 +9532,7 @@ Heat.prototype.publish("radiusX", 25, "number", "Point X radius (25 by default)"
|
|
|
9463
9532
|
Heat.prototype.publish("radiusY", 25, "number", "Point Y radius (25 by default)");
|
|
9464
9533
|
Heat.prototype.publish("radiusAsPercent", false, "boolean", "Calculate RadiusX + RadiusY as % of size");
|
|
9465
9534
|
Heat.prototype.publish("blur", 15, "number", "Point blur radius (15 by default)");
|
|
9535
|
+
Heat.prototype.publish("maxWeight", undefined, "number", "Clamp max weight to value (optional), omitting uses max data point", undefined, { optional: true });
|
|
9466
9536
|
Heat.prototype.publish("minOpacity", 0.05, "number", "Minimum point opacity (0.05 by default)");
|
|
9467
9537
|
// The following code is a modified version of
|
|
9468
9538
|
// - https://github.com/mourner/simpleheat
|
|
@@ -10441,7 +10511,7 @@ var RadialBar = /** @class */ (function (_super) {
|
|
|
10441
10511
|
var _this = this;
|
|
10442
10512
|
_super.prototype.update.call(this, domNode, element);
|
|
10443
10513
|
var context = this;
|
|
10444
|
-
var maxValue = Math.max.apply(Math, __spreadArray([this.valueDomainHigh_exists() ? this.valueDomainHigh() : 0], this.data().map(function (d) { return d[1]; }), false));
|
|
10514
|
+
var maxValue = Math.max.apply(Math, __spreadArray([this.valueDomainHigh_exists() ? this.valueDomainHigh() : 0], __read(this.data().map(function (d) { return d[1]; })), false));
|
|
10445
10515
|
this._valueScale
|
|
10446
10516
|
.domain([0, maxValue])
|
|
10447
10517
|
.range([0, this.radians(this.valueMaxAngle())]);
|
|
@@ -10575,7 +10645,7 @@ function myFormatter(format$1) {
|
|
|
10575
10645
|
var StatChart = /** @class */ (function (_super) {
|
|
10576
10646
|
__extends(StatChart, _super);
|
|
10577
10647
|
function StatChart() {
|
|
10578
|
-
var _this = _super
|
|
10648
|
+
var _this = _super.apply(this, __spreadArray([], __read(arguments), false)) || this;
|
|
10579
10649
|
_this._bellCurve = new Scatter()
|
|
10580
10650
|
.columns(["", "Std. Dev."])
|
|
10581
10651
|
.paletteID("Quartile")
|
|
@@ -10700,14 +10770,14 @@ var StatChart = /** @class */ (function (_super) {
|
|
|
10700
10770
|
{ label: this.formatQ(4), value: this.quartile(4) }
|
|
10701
10771
|
];
|
|
10702
10772
|
}
|
|
10703
|
-
var _a = this.domain(this._selectMode.node().value), domainLow = _a[0], domainHigh = _a[1];
|
|
10773
|
+
var _a = __read(this.domain(this._selectMode.node().value), 2), domainLow = _a[0], domainHigh = _a[1];
|
|
10704
10774
|
return ticks
|
|
10705
10775
|
.filter(function (sd) { return sd.value >= domainLow && sd.value <= domainHigh; })
|
|
10706
10776
|
.map(function (sd) { return ({ label: sd.label, value: sd.value.toString() }); });
|
|
10707
10777
|
};
|
|
10708
10778
|
StatChart.prototype.updateScatter = function () {
|
|
10709
10779
|
var mode = this._selectMode.node().value;
|
|
10710
|
-
var _a = this.domain(mode), domainLow = _a[0], domainHigh = _a[1];
|
|
10780
|
+
var _a = __read(this.domain(mode), 2), domainLow = _a[0], domainHigh = _a[1];
|
|
10711
10781
|
var padding = (domainHigh - domainLow) * (this.domainPadding() / 100);
|
|
10712
10782
|
this._bellCurve
|
|
10713
10783
|
.xAxisDomainLow(domainLow - padding)
|