@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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hpcc-js/chart",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.86.0",
|
|
4
4
|
"description": "hpcc-js - Viz Chart",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.es6",
|
|
@@ -38,13 +38,13 @@
|
|
|
38
38
|
"update": "npx --yes npm-check-updates -u -t minor"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@hpcc-js/api": "^2.
|
|
42
|
-
"@hpcc-js/common": "^2.
|
|
43
|
-
"@hpcc-js/util": "^2.
|
|
41
|
+
"@hpcc-js/api": "^2.14.0",
|
|
42
|
+
"@hpcc-js/common": "^2.73.0",
|
|
43
|
+
"@hpcc-js/util": "^2.53.0"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@hpcc-js/bundle": "^2.12.0",
|
|
47
|
-
"@hpcc-js/dataflow": "^9.
|
|
47
|
+
"@hpcc-js/dataflow": "^9.1.0",
|
|
48
48
|
"@types/d3-shape": "1.3.12",
|
|
49
49
|
"@types/d3-transition": "1.3.5",
|
|
50
50
|
"d3-array": "^1",
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
"d3-transition": "^1",
|
|
67
67
|
"d3-zoom": "^1",
|
|
68
68
|
"d3v4-bullet": "1.0.7",
|
|
69
|
-
"tslib": "2.
|
|
69
|
+
"tslib": "2.7.0"
|
|
70
70
|
},
|
|
71
71
|
"repository": {
|
|
72
72
|
"type": "git",
|
|
@@ -79,5 +79,5 @@
|
|
|
79
79
|
"url": "https://github.com/hpcc-systems/Visualization/issues"
|
|
80
80
|
},
|
|
81
81
|
"homepage": "https://github.com/hpcc-systems/Visualization",
|
|
82
|
-
"gitHead": "
|
|
82
|
+
"gitHead": "fbbef050700b0e9d76ef99714856383d95155149"
|
|
83
83
|
}
|
package/src/Pie.ts
CHANGED
|
@@ -8,6 +8,9 @@ import { arc as d3Arc, pie as d3Pie } from "d3-shape";
|
|
|
8
8
|
|
|
9
9
|
import "../src/Pie.css";
|
|
10
10
|
|
|
11
|
+
const sortAscending = (a, b) => a[1] - b[1] > 0 ? 1 : -1;
|
|
12
|
+
const sortDescending = (a, b) => a[1] - b[1] > 0 ? -1 : 1;
|
|
13
|
+
|
|
11
14
|
export class Pie extends SVGWidget {
|
|
12
15
|
static __inputs: InputField[] = [{
|
|
13
16
|
id: "label",
|
|
@@ -186,9 +189,15 @@ export class Pie extends SVGWidget {
|
|
|
186
189
|
;
|
|
187
190
|
|
|
188
191
|
this._quadIdxArr = [[], [], [], []];
|
|
189
|
-
const data = [...this.data()]
|
|
190
|
-
|
|
191
|
-
|
|
192
|
+
const data = [...this.data()];
|
|
193
|
+
switch (this.sortDataByValue()) {
|
|
194
|
+
case "ascending":
|
|
195
|
+
data.sort(sortAscending);
|
|
196
|
+
break;
|
|
197
|
+
case "descending":
|
|
198
|
+
data.sort(sortDescending);
|
|
199
|
+
break;
|
|
200
|
+
}
|
|
192
201
|
const arc = this._slices.selectAll(".arc").data(this.d3Pie(data), d => d.data[0]);
|
|
193
202
|
|
|
194
203
|
this._labelPositions = [];
|
|
@@ -407,13 +416,22 @@ export class Pie extends SVGWidget {
|
|
|
407
416
|
|
|
408
417
|
updateD3Pie() {
|
|
409
418
|
const startAngle = normalizeRadians(degreesToRadians(this.startAngle()));
|
|
419
|
+
|
|
420
|
+
switch (this.sortDataByValue()) {
|
|
421
|
+
case "ascending":
|
|
422
|
+
this.d3Pie.sort(sortAscending);
|
|
423
|
+
break;
|
|
424
|
+
case "descending":
|
|
425
|
+
this.d3Pie.sort(sortDescending);
|
|
426
|
+
break;
|
|
427
|
+
default:
|
|
428
|
+
this.d3Pie.sort(null);
|
|
429
|
+
}
|
|
430
|
+
|
|
410
431
|
this.d3Pie
|
|
411
432
|
.padAngle(0.0025)
|
|
412
433
|
.startAngle(startAngle)
|
|
413
434
|
.endAngle(2 * Math.PI + startAngle)
|
|
414
|
-
.sort(function (b, a) {
|
|
415
|
-
return a[1] < b[1] ? -1 : a[1] > b[1] ? 1 : 0;
|
|
416
|
-
})
|
|
417
435
|
.value(function (d) {
|
|
418
436
|
return d[1];
|
|
419
437
|
})
|
|
@@ -468,6 +486,8 @@ export interface Pie {
|
|
|
468
486
|
seriesPercentageFormat(_: string): this;
|
|
469
487
|
showLabels(): boolean;
|
|
470
488
|
showLabels(_: boolean): this;
|
|
489
|
+
sortDataByValue(): "none" | "ascending" | "descending";
|
|
490
|
+
sortDataByValue(_: "none" | "ascending" | "descending"): this;
|
|
471
491
|
}
|
|
472
492
|
Pie.prototype.publish("showLabels", true, "boolean", "If true, wedge labels will display");
|
|
473
493
|
Pie.prototype.publish("showSeriesValue", false, "boolean", "Append data series value next to label", null, { disable: w => !w.showLabels() });
|
|
@@ -480,3 +500,4 @@ Pie.prototype.publish("innerRadius", 0, "number", "Sets inner pie hole radius as
|
|
|
480
500
|
Pie.prototype.publish("minOuterRadius", 20, "number", "Minimum outer radius (pixels)");
|
|
481
501
|
Pie.prototype.publish("startAngle", 0, "number", "Starting angle of the first (and largest) wedge (degrees)");
|
|
482
502
|
Pie.prototype.publish("labelHeight", 12, "number", "Font size of labels (pixels)", null, { disable: w => !w.showLabels() });
|
|
503
|
+
Pie.prototype.publish("sortDataByValue", "descending", "set", "Sort data by value", ["none", "ascending", "descending"]);
|
package/src/__package__.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export const PKG_NAME = "@hpcc-js/chart";
|
|
2
|
-
export const PKG_VERSION = "2.
|
|
3
|
-
export const BUILD_VERSION = "2.
|
|
2
|
+
export const PKG_VERSION = "2.86.0";
|
|
3
|
+
export const BUILD_VERSION = "2.107.0";
|
package/src/__tests__/index.ts
CHANGED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Pie } from "../Pie";
|
|
2
|
+
|
|
3
|
+
export class Test extends Pie {
|
|
4
|
+
|
|
5
|
+
constructor() {
|
|
6
|
+
super();
|
|
7
|
+
this
|
|
8
|
+
.columns(["Subject", "Result"])
|
|
9
|
+
.data([
|
|
10
|
+
["English", 45],
|
|
11
|
+
["Irish", 28],
|
|
12
|
+
["Math", 98],
|
|
13
|
+
["Geography", 48],
|
|
14
|
+
["Science", 82]
|
|
15
|
+
])
|
|
16
|
+
.sortDataByValue("none")
|
|
17
|
+
.lazyRender()
|
|
18
|
+
;
|
|
19
|
+
}
|
|
20
|
+
}
|
package/types/Pie.d.ts
CHANGED
|
@@ -89,5 +89,7 @@ export interface Pie {
|
|
|
89
89
|
seriesPercentageFormat(_: string): this;
|
|
90
90
|
showLabels(): boolean;
|
|
91
91
|
showLabels(_: boolean): this;
|
|
92
|
+
sortDataByValue(): "none" | "ascending" | "descending";
|
|
93
|
+
sortDataByValue(_: "none" | "ascending" | "descending"): this;
|
|
92
94
|
}
|
|
93
95
|
//# sourceMappingURL=Pie.d.ts.map
|
package/types/Pie.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Pie.d.ts","sourceRoot":"","sources":["../src/Pie.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAOjE,OAAO,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"Pie.d.ts","sourceRoot":"","sources":["../src/Pie.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAOjE,OAAO,gBAAgB,CAAC;AAKxB,qBAAa,GAAI,SAAQ,SAAS;IAC9B,MAAM,CAAC,QAAQ,EAAE,UAAU,EAAE,CAM1B;IAEH,SAAS,CAAC,WAAW,EAAE,MAAM,CAAC;IAE9B,KAAK,MAAC;IACN,KAAK,MAAC;IACN,UAAU,MAAC;IACX,OAAO,CAAC,eAAe,CAAC;IACxB,OAAO,CAAC,sBAAsB,CAAC;IAC/B,OAAO,CAAC,gBAAgB,CAAS;IACjC,OAAO,CAAC,WAAW,CAAC;IACpB,OAAO,CAAC,YAAY,CAAK;IACzB,OAAO,CAAC,eAAe,CAAK;IAC5B,OAAO,CAAC,qBAAqB,CAAC;IAC9B,OAAO,CAAC,0BAA0B,CAAC;;IAiBnC,YAAY,CAAC,MAAM,KAAA,EAAE,MAAM,KAAA;;;;IAI3B,eAAe;IAIf,eAAe;IAgBf,yBAAyB;IAYzB,cAAc,IAAI,MAAM;IAMxB,YAAY,CAAC,CAAC,KAAA,EAAE,QAAQ,CAAC,KAAA;IAyBzB,SAAS,IAAI,GAAG,EAAE;IAClB,SAAS,CAAC,CAAC,EAAE,GAAG,EAAE,GAAG,IAAI;IAczB,aAAa,CAAC,CAAC,EAAE,MAAM;IAOvB,OAAO,MAAC;IACR,OAAO,MAAC;IACR,KAAK,CAAC,QAAQ,KAAA,EAAE,OAAO,KAAA;IA2BvB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AAE,MAAM,GAAG,WAAW,GAAG,YAAY,GAAG,IAAI,CAAC;CACjE"}
|
package/types/__package__.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export declare const PKG_NAME = "@hpcc-js/chart";
|
|
2
|
-
export declare const PKG_VERSION = "2.
|
|
3
|
-
export declare const BUILD_VERSION = "2.
|
|
2
|
+
export declare const PKG_VERSION = "2.86.0";
|
|
3
|
+
export declare const BUILD_VERSION = "2.107.0";
|
|
4
4
|
//# sourceMappingURL=__package__.d.ts.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { Test } from "./
|
|
1
|
+
export { Test } from "./pie";
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/__tests__/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/__tests__/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pie.d.ts","sourceRoot":"","sources":["../../src/__tests__/pie.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAC;AAE7B,qBAAa,IAAK,SAAQ,GAAG;;CAiB5B"}
|
package/types-3.4/Pie.d.ts
CHANGED
|
@@ -89,5 +89,7 @@ export interface Pie {
|
|
|
89
89
|
seriesPercentageFormat(_: string): this;
|
|
90
90
|
showLabels(): boolean;
|
|
91
91
|
showLabels(_: boolean): this;
|
|
92
|
+
sortDataByValue(): "none" | "ascending" | "descending";
|
|
93
|
+
sortDataByValue(_: "none" | "ascending" | "descending"): this;
|
|
92
94
|
}
|
|
93
95
|
//# sourceMappingURL=Pie.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export declare const PKG_NAME = "@hpcc-js/chart";
|
|
2
|
-
export declare const PKG_VERSION = "2.
|
|
3
|
-
export declare const BUILD_VERSION = "2.
|
|
2
|
+
export declare const PKG_VERSION = "2.86.0";
|
|
3
|
+
export declare const BUILD_VERSION = "2.107.0";
|
|
4
4
|
//# sourceMappingURL=__package__.d.ts.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { Test } from "./
|
|
1
|
+
export { Test } from "./pie";
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|