@hpcc-js/chart 2.84.1 → 2.86.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 +25 -9
- package/dist/index.es6.js.map +1 -1
- package/dist/index.js +25 -9
- 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 +7 -7
- package/src/Pie.ts +27 -6
- package/src/__package__.ts +2 -2
- package/src/__tests__/index.ts +1 -1
- package/src/__tests__/pie.ts +20 -0
- package/types/Pie.d.ts +2 -0
- package/types/Pie.d.ts.map +1 -1
- package/types/__package__.d.ts +2 -2
- 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-3.4/Pie.d.ts +2 -0
- package/types-3.4/__package__.d.ts +2 -2
- package/types-3.4/__tests__/index.d.ts +1 -1
- package/types-3.4/__tests__/pie.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.
|
|
6
|
+
var PKG_VERSION = "2.86.0";
|
|
7
|
+
var BUILD_VERSION = "2.107.0";
|
|
8
8
|
|
|
9
9
|
/******************************************************************************
|
|
10
10
|
Copyright (c) Microsoft Corporation.
|
|
@@ -20,7 +20,7 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
|
20
20
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
21
21
|
PERFORMANCE OF THIS SOFTWARE.
|
|
22
22
|
***************************************************************************** */
|
|
23
|
-
/* global Reflect, Promise, SuppressedError, Symbol */
|
|
23
|
+
/* global Reflect, Promise, SuppressedError, Symbol, Iterator */
|
|
24
24
|
|
|
25
25
|
var extendStatics = function(d, b) {
|
|
26
26
|
extendStatics = Object.setPrototypeOf ||
|
|
@@ -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);
|