@hpcc-js/chart 2.84.1 → 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.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.1";
9
- var BUILD_VERSION = "2.106.1";
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).sort(function (a, b) {
9193
- return a[1] - b[1] > 0 ? -1 : 1;
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);