@hpcc-js/chart 2.84.0 → 2.84.1

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.84.0";
9
- var BUILD_VERSION = "2.106.0";
8
+ var PKG_VERSION = "2.84.1";
9
+ var BUILD_VERSION = "2.106.1";
10
10
 
11
11
  /******************************************************************************
12
12
  Copyright (c) Microsoft Corporation.
@@ -9623,6 +9623,12 @@
9623
9623
  // draw a grayscale heatmap by putting a blurred ellipse at each data point
9624
9624
  for (var i = 0, len = this._data.length, p = void 0; i < len; i++) {
9625
9625
  p = this._data[i];
9626
+ if (p[2] < 0) {
9627
+ p[2] = 0;
9628
+ }
9629
+ else if (p[2] > this._max) {
9630
+ p[2] = this._max;
9631
+ }
9626
9632
  ctx.globalAlpha = Math.max(p[2] / this._max, minOpacity === undefined ? 0.05 : minOpacity);
9627
9633
  ctx.drawImage(this._ellipse, p[0] - this._r, p[1] - this._r);
9628
9634
  }
@@ -10647,7 +10653,7 @@
10647
10653
  var StatChart = /** @class */ (function (_super) {
10648
10654
  __extends(StatChart, _super);
10649
10655
  function StatChart() {
10650
- var _this = _super.apply(this, __spreadArray([], __read(arguments), false)) || this;
10656
+ var _this = _super.call(this) || this;
10651
10657
  _this._bellCurve = new Scatter()
10652
10658
  .columns(["", "Std. Dev."])
10653
10659
  .paletteID("Quartile")
@@ -10671,6 +10677,8 @@
10671
10677
  .valueFontSize(0)
10672
10678
  .lineColor(rainbow(90, 0, 100))
10673
10679
  .innerRectColor(rainbow(10, 0, 100));
10680
+ _this
10681
+ .columns(["Min", "25%", "50%", "75%", "Max", "Mean", "Std. Dev."]);
10674
10682
  return _this;
10675
10683
  }
10676
10684
  StatChart.prototype.stdDev = function (degrees) {
@@ -10680,7 +10688,7 @@
10680
10688
  return this._tickFormatter(this.stdDev(degrees));
10681
10689
  };
10682
10690
  StatChart.prototype.quartile = function (q) {
10683
- return this.data()[0][q];
10691
+ return this.quartiles()[q];
10684
10692
  };
10685
10693
  StatChart.prototype.formatQ = function (q) {
10686
10694
  return this._tickFormatter(this.quartile(q));
@@ -10696,31 +10704,19 @@
10696
10704
  return [this.quartile(0), this.quartile(4)];
10697
10705
  }
10698
10706
  };
10699
- StatChart.prototype.mean = function (_) {
10700
- if (!arguments.length)
10701
- return this._mean;
10702
- this._mean = _;
10703
- if (this.data()[0]) {
10704
- this.data()[0][5] = _;
10705
- }
10706
- return this;
10707
+ StatChart.prototype.min = function () {
10708
+ return this.quartile(0);
10707
10709
  };
10708
- StatChart.prototype.standardDeviation = function (_) {
10709
- if (!arguments.length)
10710
- return this._standardDeviation;
10711
- this._standardDeviation = _;
10712
- if (this.data()[0]) {
10713
- this.data()[0][6] = _;
10714
- }
10715
- return this;
10710
+ StatChart.prototype.max = function () {
10711
+ return this.quartile(4);
10716
10712
  };
10717
- StatChart.prototype.quartiles = function (_) {
10713
+ StatChart.prototype.data = function (_) {
10718
10714
  if (!arguments.length)
10719
- return this._quartiles;
10720
- this._quartiles = _;
10721
- if (this.data()[0]) {
10722
- this.data()[0] = _.concat(this.data()[0].slice(-2));
10723
- }
10715
+ return [__spreadArray(__spreadArray([], __read(this.quartiles()), false), [this.mean(), this.standardDeviation()], false)];
10716
+ var row = _[0];
10717
+ this.quartiles([row[0], row[1], row[2], row[3], row[4]]);
10718
+ this.mean(row[5]);
10719
+ this.standardDeviation(row[6]);
10724
10720
  return this;
10725
10721
  };
10726
10722
  StatChart.prototype.enter = function (domNode, element) {
@@ -10728,16 +10724,17 @@
10728
10724
  _super.prototype.enter.call(this, domNode, element);
10729
10725
  this._bellCurve.target(element.append("div").node());
10730
10726
  this._candle.target(element.append("div").node());
10731
- this._selectMode = element.append("div")
10727
+ this._selectElement = element.append("div")
10732
10728
  .style("position", "absolute")
10733
10729
  .style("top", "0px")
10734
10730
  .style("right", "0px").append("select")
10735
10731
  .on("change", function () {
10736
- _this.render();
10732
+ _this.view(_this._selectElement.node().value);
10733
+ _this.lazyRender();
10737
10734
  });
10738
- this._selectMode.append("option").attr("value", "min_max").text("Min / Max");
10739
- this._selectMode.append("option").attr("value", "25_75").text("25% / 75%");
10740
- this._selectMode.append("option").attr("value", "normal").text("Normal");
10735
+ this._selectElement.append("option").attr("value", "min_max").text("Min / Max");
10736
+ this._selectElement.append("option").attr("value", "25_75").text("25% / 75%");
10737
+ this._selectElement.append("option").attr("value", "normal").text("Normal");
10741
10738
  };
10742
10739
  StatChart.prototype.bellTicks = function (mode) {
10743
10740
  var ticks;
@@ -10772,13 +10769,13 @@
10772
10769
  { label: this.formatQ(4), value: this.quartile(4) }
10773
10770
  ];
10774
10771
  }
10775
- var _a = __read(this.domain(this._selectMode.node().value), 2), domainLow = _a[0], domainHigh = _a[1];
10772
+ var _a = __read(this.domain(this._selectElement.node().value), 2), domainLow = _a[0], domainHigh = _a[1];
10776
10773
  return ticks
10777
10774
  .filter(function (sd) { return sd.value >= domainLow && sd.value <= domainHigh; })
10778
10775
  .map(function (sd) { return ({ label: sd.label, value: sd.value.toString() }); });
10779
10776
  };
10780
10777
  StatChart.prototype.updateScatter = function () {
10781
- var mode = this._selectMode.node().value;
10778
+ var mode = this._selectElement.node().value;
10782
10779
  var _a = __read(this.domain(mode), 2), domainLow = _a[0], domainHigh = _a[1];
10783
10780
  var padding = (domainHigh - domainLow) * (this.domainPadding() / 100);
10784
10781
  this._bellCurve
@@ -10813,19 +10810,20 @@
10813
10810
  StatChart.prototype.update = function (domNode, element) {
10814
10811
  _super.prototype.update.call(this, domNode, element);
10815
10812
  this._tickFormatter = myFormatter(this.tickFormat());
10816
- if (this.data()[0] && this.data()[0].length === 7) {
10817
- this.quartiles(this.data()[0].slice(0, 5));
10818
- this.mean(this.data()[0][5]);
10819
- this.standardDeviation(this.data()[0][6]);
10820
- }
10813
+ this._selectElement.node().value = this.view();
10821
10814
  this.updateScatter();
10822
10815
  this.updateCandle();
10823
10816
  };
10824
10817
  return StatChart;
10825
10818
  }(common.HTMLWidget));
10819
+ StatChart.prototype._class += " chart_Stat";
10820
+ StatChart.prototype.publish("view", "min_max", "set", "View", ["min_max", "25_75", "normal"]);
10826
10821
  StatChart.prototype.publish("tickFormat", ".2e", "string", "X-Axis Tick Format");
10827
10822
  StatChart.prototype.publish("candleHeight", 20, "number", "Height of candle widget (pixels)");
10828
10823
  StatChart.prototype.publish("domainPadding", 10, "number", "Domain value padding");
10824
+ StatChart.prototype.publish("mean", .5, "number", "Mean");
10825
+ StatChart.prototype.publish("standardDeviation", .125, "number", "Standard Deviation (σ)");
10826
+ StatChart.prototype.publish("quartiles", [0, .25, .5, .75, 1], "object", "Quartiles (Min, 25%, 50%, 75%, Max)");
10829
10827
 
10830
10828
  var Step = /** @class */ (function (_super) {
10831
10829
  __extends(Step, _super);