@hpcc-js/chart 2.83.3 → 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.3";
9
- var BUILD_VERSION = "2.105.9";
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
  }
@@ -5215,8 +5284,6 @@
5215
5284
  areaPoint(x00$2, y00$2);
5216
5285
  }
5217
5286
 
5218
- var pathArea = areaStream;
5219
-
5220
5287
  var x0$2 = Infinity,
5221
5288
  y0$2 = x0$2,
5222
5289
  x1 = -x0$2,
@@ -5242,8 +5309,6 @@
5242
5309
  if (y > y1) y1 = y;
5243
5310
  }
5244
5311
 
5245
- var boundsStream$1 = boundsStream;
5246
-
5247
5312
  // TODO Enforce positive area for exterior, negative area for interior?
5248
5313
 
5249
5314
  var X0 = 0,
@@ -5341,8 +5406,6 @@
5341
5406
  centroidPoint(x0$1 = x, y0$1 = y);
5342
5407
  }
5343
5408
 
5344
- var pathCentroid = centroidStream;
5345
-
5346
5409
  function PathContext(context) {
5347
5410
  this._context = context;
5348
5411
  }
@@ -5426,8 +5489,6 @@
5426
5489
  x0 = x, y0 = y;
5427
5490
  }
5428
5491
 
5429
- var pathMeasure = lengthStream;
5430
-
5431
5492
  function PathString() {
5432
5493
  this._string = [];
5433
5494
  }
@@ -5502,23 +5563,23 @@
5502
5563
  }
5503
5564
 
5504
5565
  path.area = function(object) {
5505
- geoStream(object, projectionStream(pathArea));
5506
- return pathArea.result();
5566
+ geoStream(object, projectionStream(areaStream));
5567
+ return areaStream.result();
5507
5568
  };
5508
5569
 
5509
5570
  path.measure = function(object) {
5510
- geoStream(object, projectionStream(pathMeasure));
5511
- return pathMeasure.result();
5571
+ geoStream(object, projectionStream(lengthStream));
5572
+ return lengthStream.result();
5512
5573
  };
5513
5574
 
5514
5575
  path.bounds = function(object) {
5515
- geoStream(object, projectionStream(boundsStream$1));
5516
- return boundsStream$1.result();
5576
+ geoStream(object, projectionStream(boundsStream));
5577
+ return boundsStream.result();
5517
5578
  };
5518
5579
 
5519
5580
  path.centroid = function(object) {
5520
- geoStream(object, projectionStream(pathCentroid));
5521
- return pathCentroid.result();
5581
+ geoStream(object, projectionStream(centroidStream));
5582
+ return centroidStream.result();
5522
5583
  };
5523
5584
 
5524
5585
  path.projection = function(_) {
@@ -8816,7 +8877,7 @@
8816
8877
  this._usageArc = element.append("path").datum({ startAngle: value2Angle(0), endAngle: value2Angle(0) })
8817
8878
  .style("fill", "green")
8818
8879
  .on("mousemove", function (d) {
8819
- 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];
8820
8881
  _this.tip({ x: x, y: y, label: _this.valueDescription() });
8821
8882
  })
8822
8883
  .on("mouseout", function (d) {
@@ -8827,7 +8888,7 @@
8827
8888
  this._meanArc = element.append("path").datum({ startAngle: value2Angle(0), endAngle: value2Angle(0) })
8828
8889
  .style("fill", "black")
8829
8890
  .on("mousemove", function (d) {
8830
- 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];
8831
8892
  _this.tip({ x: x, y: y, label: _this.tickValueDescription() });
8832
8893
  })
8833
8894
  .on("mouseout", function (d) {
@@ -8841,7 +8902,7 @@
8841
8902
  .style("stroke", "black")
8842
8903
  .attr("d", "M 0 0 l -3 -3 l 6 0 z")
8843
8904
  .on("mousemove", function (d) {
8844
- 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];
8845
8906
  context.tip({ x: x, y: y, label: context.tickValueDescription() });
8846
8907
  })
8847
8908
  .on("mouseout", function (d) {
@@ -9128,7 +9189,7 @@
9128
9189
  .padRadius(outerRadius)
9129
9190
  .outerRadius(outerRadius);
9130
9191
  this._quadIdxArr = [[], [], [], []];
9131
- var data = __spreadArray([], this.data(), true).sort(function (a, b) {
9192
+ var data = __spreadArray([], __read(this.data()), false).sort(function (a, b) {
9132
9193
  return a[1] - b[1] > 0 ? -1 : 1;
9133
9194
  });
9134
9195
  var arc = this._slices.selectAll(".arc").data(this.d3Pie(data), function (d) { return d.data[0]; });
@@ -9222,7 +9283,7 @@
9222
9283
  .attr("points", function (d, i) {
9223
9284
  var pos = context.d3LabelArc.centroid(d);
9224
9285
  var pos1 = context.d3Arc.centroid(d);
9225
- var pos2 = __spreadArray([], pos, true);
9286
+ var pos2 = __spreadArray([], __read(pos), false);
9226
9287
  pos[0] = labelRadius * (context.isLeftSide(midAngle(d)) ? 1 : -1);
9227
9288
  pos[1] = context._labelPositions[i].top;
9228
9289
  return [pos1, pos2, pos];
@@ -9439,7 +9500,7 @@
9439
9500
  var data = host.orientation() === "horizontal" ?
9440
9501
  this.data().map(function (r) { return [host.dataPos(r[0]), host.valuePos(r[1]), r[2]]; }) :
9441
9502
  this.data().map(function (r) { return [host.valuePos(r[1]), host.dataPos(r[0]), r[2]]; });
9442
- 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]; });
9443
9504
  if (this.paletteID() !== "default") {
9444
9505
  var gradient = {};
9445
9506
  var count = 8;
@@ -9473,6 +9534,7 @@
9473
9534
  Heat.prototype.publish("radiusY", 25, "number", "Point Y radius (25 by default)");
9474
9535
  Heat.prototype.publish("radiusAsPercent", false, "boolean", "Calculate RadiusX + RadiusY as % of size");
9475
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 });
9476
9538
  Heat.prototype.publish("minOpacity", 0.05, "number", "Minimum point opacity (0.05 by default)");
9477
9539
  // The following code is a modified version of
9478
9540
  // - https://github.com/mourner/simpleheat
@@ -10451,7 +10513,7 @@
10451
10513
  var _this = this;
10452
10514
  _super.prototype.update.call(this, domNode, element);
10453
10515
  var context = this;
10454
- 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));
10455
10517
  this._valueScale
10456
10518
  .domain([0, maxValue])
10457
10519
  .range([0, this.radians(this.valueMaxAngle())]);
@@ -10585,7 +10647,7 @@
10585
10647
  var StatChart = /** @class */ (function (_super) {
10586
10648
  __extends(StatChart, _super);
10587
10649
  function StatChart() {
10588
- var _this = _super !== null && _super.apply(this, arguments) || this;
10650
+ var _this = _super.apply(this, __spreadArray([], __read(arguments), false)) || this;
10589
10651
  _this._bellCurve = new Scatter()
10590
10652
  .columns(["", "Std. Dev."])
10591
10653
  .paletteID("Quartile")
@@ -10710,14 +10772,14 @@
10710
10772
  { label: this.formatQ(4), value: this.quartile(4) }
10711
10773
  ];
10712
10774
  }
10713
- 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];
10714
10776
  return ticks
10715
10777
  .filter(function (sd) { return sd.value >= domainLow && sd.value <= domainHigh; })
10716
10778
  .map(function (sd) { return ({ label: sd.label, value: sd.value.toString() }); });
10717
10779
  };
10718
10780
  StatChart.prototype.updateScatter = function () {
10719
10781
  var mode = this._selectMode.node().value;
10720
- 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];
10721
10783
  var padding = (domainHigh - domainLow) * (this.domainPadding() / 100);
10722
10784
  this._bellCurve
10723
10785
  .xAxisDomainLow(domainLow - padding)
@@ -11128,6 +11190,7 @@
11128
11190
  };
11129
11191
 
11130
11192
  // Word cloud layout by Jason Davies, https://www.jasondavies.com/wordcloud/
11193
+ // Algorithm due to Jonathan Feinberg, http://static.mrfeinberg.com/bv_ch03.pdf
11131
11194
  var cloudRadians = Math.PI / 180;
11132
11195
  var cw = 1 << 11 >> 5;
11133
11196
  var ch = 1 << 11;
@@ -11710,7 +11773,5 @@
11710
11773
  exports.WordCloud = WordCloud;
11711
11774
  exports.XYAxis = XYAxis;
11712
11775
 
11713
- Object.defineProperty(exports, '__esModule', { value: true });
11714
-
11715
11776
  }));
11716
11777
  //# sourceMappingURL=index.js.map