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