@hpcc-js/chart 2.84.0 → 2.85.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 +58 -44
- package/dist/index.es6.js.map +1 -1
- package/dist/index.js +58 -44
- 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 +2 -2
- package/src/Heat.md +42 -1
- package/src/Heat.ts +5 -0
- package/src/Pie.ts +27 -6
- package/src/StatChart.ts +62 -53
- package/src/__package__.ts +2 -2
- package/src/__tests__/heat.ts +2 -1
- package/src/__tests__/index.ts +3 -2
- package/src/__tests__/pie.ts +20 -0
- package/src/__tests__/stat.ts +16 -0
- package/types/Pie.d.ts +2 -0
- package/types/Pie.d.ts.map +1 -1
- package/types/StatChart.d.ts +35 -19
- package/types/StatChart.d.ts.map +1 -1
- package/types/__package__.d.ts +2 -2
- package/types/__tests__/heat.d.ts +2 -0
- package/types/__tests__/heat.d.ts.map +1 -1
- package/types/__tests__/index.d.ts +1 -1
- package/types/__tests__/index.d.ts.map +1 -1
- package/types/__tests__/pie.d.ts +5 -0
- package/types/__tests__/pie.d.ts.map +1 -0
- package/types/__tests__/stat.d.ts +5 -0
- package/types/__tests__/stat.d.ts.map +1 -0
- package/types-3.4/Pie.d.ts +2 -0
- package/types-3.4/StatChart.d.ts +54 -19
- package/types-3.4/__package__.d.ts +2 -2
- package/types-3.4/__tests__/heat.d.ts +2 -0
- package/types-3.4/__tests__/index.d.ts +1 -1
- package/types-3.4/__tests__/pie.d.ts +5 -0
- package/types-3.4/__tests__/stat.d.ts +5 -0
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.
|
|
9
|
-
var BUILD_VERSION = "2.106.
|
|
8
|
+
var PKG_VERSION = "2.85.0";
|
|
9
|
+
var BUILD_VERSION = "2.106.4";
|
|
10
10
|
|
|
11
11
|
/******************************************************************************
|
|
12
12
|
Copyright (c) Microsoft Corporation.
|
|
@@ -9043,6 +9043,8 @@
|
|
|
9043
9043
|
var css_248z$6 = ".chart_Pie path,.chart_Pie>g>text{cursor:pointer}.chart_Pie .arc path{stroke:#fff;stroke-width:.75px}.chart_Pie .arc.selected path{stroke:red;stroke-width:1.5px}.chart_Pie polyline{stroke:#000;stroke-width:2px;fill:none;opacity:.3}";
|
|
9044
9044
|
styleInject(css_248z$6);
|
|
9045
9045
|
|
|
9046
|
+
var sortAscending = function (a, b) { return a[1] - b[1] > 0 ? 1 : -1; };
|
|
9047
|
+
var sortDescending = function (a, b) { return a[1] - b[1] > 0 ? -1 : 1; };
|
|
9046
9048
|
var Pie = /** @class */ (function (_super) {
|
|
9047
9049
|
__extends(Pie, _super);
|
|
9048
9050
|
function Pie() {
|
|
@@ -9189,9 +9191,15 @@
|
|
|
9189
9191
|
.padRadius(outerRadius)
|
|
9190
9192
|
.outerRadius(outerRadius);
|
|
9191
9193
|
this._quadIdxArr = [[], [], [], []];
|
|
9192
|
-
var data = __spreadArray([], __read(this.data()), false)
|
|
9193
|
-
|
|
9194
|
-
|
|
9194
|
+
var data = __spreadArray([], __read(this.data()), false);
|
|
9195
|
+
switch (this.sortDataByValue()) {
|
|
9196
|
+
case "ascending":
|
|
9197
|
+
data.sort(sortAscending);
|
|
9198
|
+
break;
|
|
9199
|
+
case "descending":
|
|
9200
|
+
data.sort(sortDescending);
|
|
9201
|
+
break;
|
|
9202
|
+
}
|
|
9195
9203
|
var arc = this._slices.selectAll(".arc").data(this.d3Pie(data), function (d) { return d.data[0]; });
|
|
9196
9204
|
this._labelPositions = [];
|
|
9197
9205
|
// Enter ---
|
|
@@ -9393,13 +9401,20 @@
|
|
|
9393
9401
|
};
|
|
9394
9402
|
Pie.prototype.updateD3Pie = function () {
|
|
9395
9403
|
var startAngle = util.normalizeRadians(util.degreesToRadians(this.startAngle()));
|
|
9404
|
+
switch (this.sortDataByValue()) {
|
|
9405
|
+
case "ascending":
|
|
9406
|
+
this.d3Pie.sort(sortAscending);
|
|
9407
|
+
break;
|
|
9408
|
+
case "descending":
|
|
9409
|
+
this.d3Pie.sort(sortDescending);
|
|
9410
|
+
break;
|
|
9411
|
+
default:
|
|
9412
|
+
this.d3Pie.sort(null);
|
|
9413
|
+
}
|
|
9396
9414
|
this.d3Pie
|
|
9397
9415
|
.padAngle(0.0025)
|
|
9398
9416
|
.startAngle(startAngle)
|
|
9399
9417
|
.endAngle(2 * Math.PI + startAngle)
|
|
9400
|
-
.sort(function (b, a) {
|
|
9401
|
-
return a[1] < b[1] ? -1 : a[1] > b[1] ? 1 : 0;
|
|
9402
|
-
})
|
|
9403
9418
|
.value(function (d) {
|
|
9404
9419
|
return d[1];
|
|
9405
9420
|
});
|
|
@@ -9428,6 +9443,7 @@
|
|
|
9428
9443
|
Pie.prototype.publish("minOuterRadius", 20, "number", "Minimum outer radius (pixels)");
|
|
9429
9444
|
Pie.prototype.publish("startAngle", 0, "number", "Starting angle of the first (and largest) wedge (degrees)");
|
|
9430
9445
|
Pie.prototype.publish("labelHeight", 12, "number", "Font size of labels (pixels)", null, { disable: function (w) { return !w.showLabels(); } });
|
|
9446
|
+
Pie.prototype.publish("sortDataByValue", "descending", "set", "Sort data by value", ["none", "ascending", "descending"]);
|
|
9431
9447
|
|
|
9432
9448
|
var HalfPie = /** @class */ (function (_super) {
|
|
9433
9449
|
__extends(HalfPie, _super);
|
|
@@ -9623,6 +9639,12 @@
|
|
|
9623
9639
|
// draw a grayscale heatmap by putting a blurred ellipse at each data point
|
|
9624
9640
|
for (var i = 0, len = this._data.length, p = void 0; i < len; i++) {
|
|
9625
9641
|
p = this._data[i];
|
|
9642
|
+
if (p[2] < 0) {
|
|
9643
|
+
p[2] = 0;
|
|
9644
|
+
}
|
|
9645
|
+
else if (p[2] > this._max) {
|
|
9646
|
+
p[2] = this._max;
|
|
9647
|
+
}
|
|
9626
9648
|
ctx.globalAlpha = Math.max(p[2] / this._max, minOpacity === undefined ? 0.05 : minOpacity);
|
|
9627
9649
|
ctx.drawImage(this._ellipse, p[0] - this._r, p[1] - this._r);
|
|
9628
9650
|
}
|
|
@@ -10647,7 +10669,7 @@
|
|
|
10647
10669
|
var StatChart = /** @class */ (function (_super) {
|
|
10648
10670
|
__extends(StatChart, _super);
|
|
10649
10671
|
function StatChart() {
|
|
10650
|
-
var _this = _super.
|
|
10672
|
+
var _this = _super.call(this) || this;
|
|
10651
10673
|
_this._bellCurve = new Scatter()
|
|
10652
10674
|
.columns(["", "Std. Dev."])
|
|
10653
10675
|
.paletteID("Quartile")
|
|
@@ -10671,6 +10693,8 @@
|
|
|
10671
10693
|
.valueFontSize(0)
|
|
10672
10694
|
.lineColor(rainbow(90, 0, 100))
|
|
10673
10695
|
.innerRectColor(rainbow(10, 0, 100));
|
|
10696
|
+
_this
|
|
10697
|
+
.columns(["Min", "25%", "50%", "75%", "Max", "Mean", "Std. Dev."]);
|
|
10674
10698
|
return _this;
|
|
10675
10699
|
}
|
|
10676
10700
|
StatChart.prototype.stdDev = function (degrees) {
|
|
@@ -10680,7 +10704,7 @@
|
|
|
10680
10704
|
return this._tickFormatter(this.stdDev(degrees));
|
|
10681
10705
|
};
|
|
10682
10706
|
StatChart.prototype.quartile = function (q) {
|
|
10683
|
-
return this.
|
|
10707
|
+
return this.quartiles()[q];
|
|
10684
10708
|
};
|
|
10685
10709
|
StatChart.prototype.formatQ = function (q) {
|
|
10686
10710
|
return this._tickFormatter(this.quartile(q));
|
|
@@ -10696,31 +10720,19 @@
|
|
|
10696
10720
|
return [this.quartile(0), this.quartile(4)];
|
|
10697
10721
|
}
|
|
10698
10722
|
};
|
|
10699
|
-
StatChart.prototype.
|
|
10700
|
-
|
|
10701
|
-
return this._mean;
|
|
10702
|
-
this._mean = _;
|
|
10703
|
-
if (this.data()[0]) {
|
|
10704
|
-
this.data()[0][5] = _;
|
|
10705
|
-
}
|
|
10706
|
-
return this;
|
|
10723
|
+
StatChart.prototype.min = function () {
|
|
10724
|
+
return this.quartile(0);
|
|
10707
10725
|
};
|
|
10708
|
-
StatChart.prototype.
|
|
10709
|
-
|
|
10710
|
-
return this._standardDeviation;
|
|
10711
|
-
this._standardDeviation = _;
|
|
10712
|
-
if (this.data()[0]) {
|
|
10713
|
-
this.data()[0][6] = _;
|
|
10714
|
-
}
|
|
10715
|
-
return this;
|
|
10726
|
+
StatChart.prototype.max = function () {
|
|
10727
|
+
return this.quartile(4);
|
|
10716
10728
|
};
|
|
10717
|
-
StatChart.prototype.
|
|
10729
|
+
StatChart.prototype.data = function (_) {
|
|
10718
10730
|
if (!arguments.length)
|
|
10719
|
-
return this.
|
|
10720
|
-
|
|
10721
|
-
|
|
10722
|
-
|
|
10723
|
-
|
|
10731
|
+
return [__spreadArray(__spreadArray([], __read(this.quartiles()), false), [this.mean(), this.standardDeviation()], false)];
|
|
10732
|
+
var row = _[0];
|
|
10733
|
+
this.quartiles([row[0], row[1], row[2], row[3], row[4]]);
|
|
10734
|
+
this.mean(row[5]);
|
|
10735
|
+
this.standardDeviation(row[6]);
|
|
10724
10736
|
return this;
|
|
10725
10737
|
};
|
|
10726
10738
|
StatChart.prototype.enter = function (domNode, element) {
|
|
@@ -10728,16 +10740,17 @@
|
|
|
10728
10740
|
_super.prototype.enter.call(this, domNode, element);
|
|
10729
10741
|
this._bellCurve.target(element.append("div").node());
|
|
10730
10742
|
this._candle.target(element.append("div").node());
|
|
10731
|
-
this.
|
|
10743
|
+
this._selectElement = element.append("div")
|
|
10732
10744
|
.style("position", "absolute")
|
|
10733
10745
|
.style("top", "0px")
|
|
10734
10746
|
.style("right", "0px").append("select")
|
|
10735
10747
|
.on("change", function () {
|
|
10736
|
-
_this.
|
|
10748
|
+
_this.view(_this._selectElement.node().value);
|
|
10749
|
+
_this.lazyRender();
|
|
10737
10750
|
});
|
|
10738
|
-
this.
|
|
10739
|
-
this.
|
|
10740
|
-
this.
|
|
10751
|
+
this._selectElement.append("option").attr("value", "min_max").text("Min / Max");
|
|
10752
|
+
this._selectElement.append("option").attr("value", "25_75").text("25% / 75%");
|
|
10753
|
+
this._selectElement.append("option").attr("value", "normal").text("Normal");
|
|
10741
10754
|
};
|
|
10742
10755
|
StatChart.prototype.bellTicks = function (mode) {
|
|
10743
10756
|
var ticks;
|
|
@@ -10772,13 +10785,13 @@
|
|
|
10772
10785
|
{ label: this.formatQ(4), value: this.quartile(4) }
|
|
10773
10786
|
];
|
|
10774
10787
|
}
|
|
10775
|
-
var _a = __read(this.domain(this.
|
|
10788
|
+
var _a = __read(this.domain(this._selectElement.node().value), 2), domainLow = _a[0], domainHigh = _a[1];
|
|
10776
10789
|
return ticks
|
|
10777
10790
|
.filter(function (sd) { return sd.value >= domainLow && sd.value <= domainHigh; })
|
|
10778
10791
|
.map(function (sd) { return ({ label: sd.label, value: sd.value.toString() }); });
|
|
10779
10792
|
};
|
|
10780
10793
|
StatChart.prototype.updateScatter = function () {
|
|
10781
|
-
var mode = this.
|
|
10794
|
+
var mode = this._selectElement.node().value;
|
|
10782
10795
|
var _a = __read(this.domain(mode), 2), domainLow = _a[0], domainHigh = _a[1];
|
|
10783
10796
|
var padding = (domainHigh - domainLow) * (this.domainPadding() / 100);
|
|
10784
10797
|
this._bellCurve
|
|
@@ -10813,19 +10826,20 @@
|
|
|
10813
10826
|
StatChart.prototype.update = function (domNode, element) {
|
|
10814
10827
|
_super.prototype.update.call(this, domNode, element);
|
|
10815
10828
|
this._tickFormatter = myFormatter(this.tickFormat());
|
|
10816
|
-
|
|
10817
|
-
this.quartiles(this.data()[0].slice(0, 5));
|
|
10818
|
-
this.mean(this.data()[0][5]);
|
|
10819
|
-
this.standardDeviation(this.data()[0][6]);
|
|
10820
|
-
}
|
|
10829
|
+
this._selectElement.node().value = this.view();
|
|
10821
10830
|
this.updateScatter();
|
|
10822
10831
|
this.updateCandle();
|
|
10823
10832
|
};
|
|
10824
10833
|
return StatChart;
|
|
10825
10834
|
}(common.HTMLWidget));
|
|
10835
|
+
StatChart.prototype._class += " chart_Stat";
|
|
10836
|
+
StatChart.prototype.publish("view", "min_max", "set", "View", ["min_max", "25_75", "normal"]);
|
|
10826
10837
|
StatChart.prototype.publish("tickFormat", ".2e", "string", "X-Axis Tick Format");
|
|
10827
10838
|
StatChart.prototype.publish("candleHeight", 20, "number", "Height of candle widget (pixels)");
|
|
10828
10839
|
StatChart.prototype.publish("domainPadding", 10, "number", "Domain value padding");
|
|
10840
|
+
StatChart.prototype.publish("mean", .5, "number", "Mean");
|
|
10841
|
+
StatChart.prototype.publish("standardDeviation", .125, "number", "Standard Deviation (σ)");
|
|
10842
|
+
StatChart.prototype.publish("quartiles", [0, .25, .5, .75, 1], "object", "Quartiles (Min, 25%, 50%, 75%, Max)");
|
|
10829
10843
|
|
|
10830
10844
|
var Step = /** @class */ (function (_super) {
|
|
10831
10845
|
__extends(Step, _super);
|