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