@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.js CHANGED
@@ -5,8 +5,8 @@
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.83.4";
9
- var BUILD_VERSION = "2.105.12";
8
+ var PKG_VERSION = "2.84.0";
9
+ var BUILD_VERSION = "2.106.0";
10
10
 
11
11
  /******************************************************************************
12
12
  Copyright (c) Microsoft Corporation.
@@ -50,6 +50,35 @@
50
50
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
51
51
  }
52
52
 
53
+ function __values(o) {
54
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
55
+ if (m) return m.call(o);
56
+ if (o && typeof o.length === "number") return {
57
+ next: function () {
58
+ if (o && i >= o.length) o = void 0;
59
+ return { value: o && o[i++], done: !o };
60
+ }
61
+ };
62
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
63
+ }
64
+
65
+ function __read(o, n) {
66
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
67
+ if (!m) return o;
68
+ var i = m.call(o), r, ar = [], e;
69
+ try {
70
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
71
+ }
72
+ catch (error) { e = { error: error }; }
73
+ finally {
74
+ try {
75
+ if (r && !r.done && (m = i["return"])) m.call(i);
76
+ }
77
+ finally { if (e) throw e.error; }
78
+ }
79
+ return ar;
80
+ }
81
+
53
82
  function __spreadArray(to, from, pack) {
54
83
  if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
55
84
  if (ar || !(i in from)) {
@@ -2433,12 +2462,22 @@
2433
2462
  })
2434
2463
  .merge(focusChart)
2435
2464
  .each(function () {
2465
+ var e_1, _a;
2436
2466
  context.copyPropsTo(context.focusChart, ["layers"]);
2437
2467
  var layerIdx = 0;
2438
- for (var _i = 0, _a = context.layers(); _i < _a.length; _i++) {
2439
- var layer = _a[_i];
2440
- layer.copyPropsTo(context.focusChart.layers()[layerIdx]);
2441
- layerIdx++;
2468
+ try {
2469
+ for (var _b = __values(context.layers()), _c = _b.next(); !_c.done; _c = _b.next()) {
2470
+ var layer = _c.value;
2471
+ layer.copyPropsTo(context.focusChart.layers()[layerIdx]);
2472
+ layerIdx++;
2473
+ }
2474
+ }
2475
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
2476
+ finally {
2477
+ try {
2478
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
2479
+ }
2480
+ finally { if (e_1) throw e_1.error; }
2442
2481
  }
2443
2482
  context.focusChart
2444
2483
  .xAxisFocus(false)
@@ -2489,7 +2528,7 @@
2489
2528
  if (!retVal.length) {
2490
2529
  return masterColumns;
2491
2530
  }
2492
- return __spreadArray([masterColumns[0]], retVal, true);
2531
+ return __spreadArray([masterColumns[0]], __read(retVal), false);
2493
2532
  };
2494
2533
  XYAxis.prototype.layerColumnIndices = function (host) {
2495
2534
  var masterColumns = host.columns();
@@ -2518,24 +2557,44 @@
2518
2557
  XYAxis.prototype.layerExit = function (host, element, duration) {
2519
2558
  };
2520
2559
  XYAxis.prototype.chartsEnter = function (host, element, duration) {
2560
+ var e_2, _a;
2521
2561
  if (duration === void 0) { duration = 250; }
2522
2562
  this.layerEnter(this, element, duration);
2523
- for (var _i = 0, _a = this.layers(); _i < _a.length; _i++) {
2524
- var w = _a[_i];
2525
- w["__xyAxisElement"] = element.append("g")
2526
- .attr("class", w.class());
2527
- w
2528
- .target(w["__xyAxisElement"].node())
2529
- .layerEnter(this, element, duration);
2563
+ try {
2564
+ for (var _b = __values(this.layers()), _c = _b.next(); !_c.done; _c = _b.next()) {
2565
+ var w = _c.value;
2566
+ w["__xyAxisElement"] = element.append("g")
2567
+ .attr("class", w.class());
2568
+ w
2569
+ .target(w["__xyAxisElement"].node())
2570
+ .layerEnter(this, element, duration);
2571
+ }
2572
+ }
2573
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
2574
+ finally {
2575
+ try {
2576
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
2577
+ }
2578
+ finally { if (e_2) throw e_2.error; }
2530
2579
  }
2531
2580
  };
2532
2581
  XYAxis.prototype.chartsUpdate = function (width, height, duration) {
2582
+ var e_3, _a;
2533
2583
  this.layerUpdate(this, this.svgData, duration);
2534
- for (var _i = 0, _a = this.layers(); _i < _a.length; _i++) {
2535
- var w = _a[_i];
2536
- w
2537
- .resize({ width: width, height: height })
2538
- .layerUpdate(this, w["__xyAxisElement"], duration);
2584
+ try {
2585
+ for (var _b = __values(this.layers()), _c = _b.next(); !_c.done; _c = _b.next()) {
2586
+ var w = _c.value;
2587
+ w
2588
+ .resize({ width: width, height: height })
2589
+ .layerUpdate(this, w["__xyAxisElement"], duration);
2590
+ }
2591
+ }
2592
+ catch (e_3_1) { e_3 = { error: e_3_1 }; }
2593
+ finally {
2594
+ try {
2595
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
2596
+ }
2597
+ finally { if (e_3) throw e_3.error; }
2539
2598
  }
2540
2599
  };
2541
2600
  XYAxis.prototype.exit = function (domNode, element) {
@@ -3338,7 +3397,7 @@
3338
3397
  columnGRect.exit().transition().duration(duration)
3339
3398
  .style("opacity", 0)
3340
3399
  .remove();
3341
- var value4pos = host.yAxisStacked() ? domainSums[dataRowIdx] : Math.max.apply(Math, dataRow.filter(function (_, idx) { return idx > 0 && idx < columnLength; }));
3400
+ var value4pos = host.yAxisStacked() ? domainSums[dataRowIdx] : Math.max.apply(Math, __spreadArray([], __read(dataRow.filter(function (_, idx) { return idx > 0 && idx < columnLength; })), false));
3342
3401
  var stackedTotalText = element.selectAll(".stackedTotalText").data(context.showDomainTotal() ? [domainSums[dataRowIdx]] : []);
3343
3402
  var stackedTotalTextEnter = stackedTotalText.enter().append("g")
3344
3403
  .attr("class", "stackedTotalText")
@@ -3392,6 +3451,7 @@
3392
3451
  .remove();
3393
3452
  };
3394
3453
  Column.prototype.calcInnerText = function (offset, innerText, valueText) {
3454
+ var e_1, _a;
3395
3455
  var fontFamily = this.innerTextFontFamily_exists() ? this.innerTextFontFamily() : "Verdana";
3396
3456
  var fontSize = this.innerTextFontSize();
3397
3457
  var valueFontFamily = this.valueFontFamily_exists() ? this.valueFontFamily() : "Verdana";
@@ -3418,15 +3478,24 @@
3418
3478
  else if (fullWidth2 < offset) {
3419
3479
  var excessWidth = offset - fullWidth2;
3420
3480
  var _text = "";
3421
- for (var _i = 0, innerText_1 = innerText; _i < innerText_1.length; _i++) {
3422
- var letter = innerText_1[_i];
3423
- if (this.textSize(_text + letter, fontFamily, fontSize).width > excessWidth) {
3424
- innerText = _text + "...";
3425
- break;
3481
+ try {
3482
+ for (var innerText_1 = __values(innerText), innerText_1_1 = innerText_1.next(); !innerText_1_1.done; innerText_1_1 = innerText_1.next()) {
3483
+ var letter = innerText_1_1.value;
3484
+ if (this.textSize(_text + letter, fontFamily, fontSize).width > excessWidth) {
3485
+ innerText = _text + "...";
3486
+ break;
3487
+ }
3488
+ else {
3489
+ _text += letter;
3490
+ }
3426
3491
  }
3427
- else {
3428
- _text += letter;
3492
+ }
3493
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
3494
+ finally {
3495
+ try {
3496
+ if (innerText_1_1 && !innerText_1_1.done && (_a = innerText_1.return)) _a.call(innerText_1);
3429
3497
  }
3498
+ finally { if (e_1) throw e_1.error; }
3430
3499
  }
3431
3500
  category = 2;
3432
3501
  }
@@ -8808,7 +8877,7 @@
8808
8877
  this._usageArc = element.append("path").datum({ startAngle: value2Angle(0), endAngle: value2Angle(0) })
8809
8878
  .style("fill", "green")
8810
8879
  .on("mousemove", function (d) {
8811
- var _a = _this._d3Arc.centroid(d), x = _a[0], y = _a[1];
8880
+ var _a = __read(_this._d3Arc.centroid(d), 2), x = _a[0], y = _a[1];
8812
8881
  _this.tip({ x: x, y: y, label: _this.valueDescription() });
8813
8882
  })
8814
8883
  .on("mouseout", function (d) {
@@ -8819,7 +8888,7 @@
8819
8888
  this._meanArc = element.append("path").datum({ startAngle: value2Angle(0), endAngle: value2Angle(0) })
8820
8889
  .style("fill", "black")
8821
8890
  .on("mousemove", function (d) {
8822
- var _a = _this._d3Arc.centroid(d), x = _a[0], y = _a[1];
8891
+ var _a = __read(_this._d3Arc.centroid(d), 2), x = _a[0], y = _a[1];
8823
8892
  _this.tip({ x: x, y: y, label: _this.tickValueDescription() });
8824
8893
  })
8825
8894
  .on("mouseout", function (d) {
@@ -8833,7 +8902,7 @@
8833
8902
  .style("stroke", "black")
8834
8903
  .attr("d", "M 0 0 l -3 -3 l 6 0 z")
8835
8904
  .on("mousemove", function (d) {
8836
- var _a = context._d3Arc.centroid(context._meanArc.datum()), x = _a[0], y = _a[1];
8905
+ var _a = __read(context._d3Arc.centroid(context._meanArc.datum()), 2), x = _a[0], y = _a[1];
8837
8906
  context.tip({ x: x, y: y, label: context.tickValueDescription() });
8838
8907
  })
8839
8908
  .on("mouseout", function (d) {
@@ -9120,7 +9189,7 @@
9120
9189
  .padRadius(outerRadius)
9121
9190
  .outerRadius(outerRadius);
9122
9191
  this._quadIdxArr = [[], [], [], []];
9123
- var data = __spreadArray([], this.data(), true).sort(function (a, b) {
9192
+ var data = __spreadArray([], __read(this.data()), false).sort(function (a, b) {
9124
9193
  return a[1] - b[1] > 0 ? -1 : 1;
9125
9194
  });
9126
9195
  var arc = this._slices.selectAll(".arc").data(this.d3Pie(data), function (d) { return d.data[0]; });
@@ -9214,7 +9283,7 @@
9214
9283
  .attr("points", function (d, i) {
9215
9284
  var pos = context.d3LabelArc.centroid(d);
9216
9285
  var pos1 = context.d3Arc.centroid(d);
9217
- var pos2 = __spreadArray([], pos, true);
9286
+ var pos2 = __spreadArray([], __read(pos), false);
9218
9287
  pos[0] = labelRadius * (context.isLeftSide(midAngle(d)) ? 1 : -1);
9219
9288
  pos[1] = context._labelPositions[i].top;
9220
9289
  return [pos1, pos2, pos];
@@ -9431,7 +9500,7 @@
9431
9500
  var data = host.orientation() === "horizontal" ?
9432
9501
  this.data().map(function (r) { return [host.dataPos(r[0]), host.valuePos(r[1]), r[2]]; }) :
9433
9502
  this.data().map(function (r) { return [host.valuePos(r[1]), host.dataPos(r[0]), r[2]]; });
9434
- var maxWeight = common.max(data, function (r) { return r[2]; });
9503
+ var maxWeight = this.maxWeight_exists() ? this.maxWeight() : common.max(data, function (r) { return r[2]; });
9435
9504
  if (this.paletteID() !== "default") {
9436
9505
  var gradient = {};
9437
9506
  var count = 8;
@@ -9465,6 +9534,7 @@
9465
9534
  Heat.prototype.publish("radiusY", 25, "number", "Point Y radius (25 by default)");
9466
9535
  Heat.prototype.publish("radiusAsPercent", false, "boolean", "Calculate RadiusX + RadiusY as % of size");
9467
9536
  Heat.prototype.publish("blur", 15, "number", "Point blur radius (15 by default)");
9537
+ Heat.prototype.publish("maxWeight", undefined, "number", "Clamp max weight to value (optional), omitting uses max data point", undefined, { optional: true });
9468
9538
  Heat.prototype.publish("minOpacity", 0.05, "number", "Minimum point opacity (0.05 by default)");
9469
9539
  // The following code is a modified version of
9470
9540
  // - https://github.com/mourner/simpleheat
@@ -10443,7 +10513,7 @@
10443
10513
  var _this = this;
10444
10514
  _super.prototype.update.call(this, domNode, element);
10445
10515
  var context = this;
10446
- var maxValue = Math.max.apply(Math, __spreadArray([this.valueDomainHigh_exists() ? this.valueDomainHigh() : 0], this.data().map(function (d) { return d[1]; }), false));
10516
+ var maxValue = Math.max.apply(Math, __spreadArray([this.valueDomainHigh_exists() ? this.valueDomainHigh() : 0], __read(this.data().map(function (d) { return d[1]; })), false));
10447
10517
  this._valueScale
10448
10518
  .domain([0, maxValue])
10449
10519
  .range([0, this.radians(this.valueMaxAngle())]);
@@ -10577,7 +10647,7 @@
10577
10647
  var StatChart = /** @class */ (function (_super) {
10578
10648
  __extends(StatChart, _super);
10579
10649
  function StatChart() {
10580
- var _this = _super !== null && _super.apply(this, arguments) || this;
10650
+ var _this = _super.apply(this, __spreadArray([], __read(arguments), false)) || this;
10581
10651
  _this._bellCurve = new Scatter()
10582
10652
  .columns(["", "Std. Dev."])
10583
10653
  .paletteID("Quartile")
@@ -10702,14 +10772,14 @@
10702
10772
  { label: this.formatQ(4), value: this.quartile(4) }
10703
10773
  ];
10704
10774
  }
10705
- var _a = this.domain(this._selectMode.node().value), domainLow = _a[0], domainHigh = _a[1];
10775
+ var _a = __read(this.domain(this._selectMode.node().value), 2), domainLow = _a[0], domainHigh = _a[1];
10706
10776
  return ticks
10707
10777
  .filter(function (sd) { return sd.value >= domainLow && sd.value <= domainHigh; })
10708
10778
  .map(function (sd) { return ({ label: sd.label, value: sd.value.toString() }); });
10709
10779
  };
10710
10780
  StatChart.prototype.updateScatter = function () {
10711
10781
  var mode = this._selectMode.node().value;
10712
- var _a = this.domain(mode), domainLow = _a[0], domainHigh = _a[1];
10782
+ var _a = __read(this.domain(mode), 2), domainLow = _a[0], domainHigh = _a[1];
10713
10783
  var padding = (domainHigh - domainLow) * (this.domainPadding() / 100);
10714
10784
  this._bellCurve
10715
10785
  .xAxisDomainLow(domainLow - padding)