@hpcc-js/chart 2.84.0 → 2.84.1
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 +36 -38
- package/dist/index.es6.js.map +1 -1
- package/dist/index.js +36 -38
- 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/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__/stat.ts +16 -0
- 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__/stat.d.ts +5 -0
- package/types/__tests__/stat.d.ts.map +1 -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__/stat.d.ts +5 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hpcc-js/chart",
|
|
3
|
-
"version": "2.84.
|
|
3
|
+
"version": "2.84.1",
|
|
4
4
|
"description": "hpcc-js - Viz Chart",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.es6",
|
|
@@ -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": "ac825f8d94e3b16ecb4cf74fa92bba3ea7a84ae4"
|
|
83
83
|
}
|
package/src/Heat.md
CHANGED
|
@@ -1 +1,42 @@
|
|
|
1
|
-
# Heat
|
|
1
|
+
# Heat
|
|
2
|
+
|
|
3
|
+
<!--meta
|
|
4
|
+
|
|
5
|
+
-->
|
|
6
|
+
|
|
7
|
+
The Heat Chart is a heatmap chart that displays data in a grid of coloured points. The color of each points is blurred and emphasised based on its neighbours. The chart is useful for visualizing data in a matrix format.
|
|
8
|
+
|
|
9
|
+
<ClientOnly>
|
|
10
|
+
<hpcc-vitepress style="width:100%;height:600px">
|
|
11
|
+
<div id="placeholder" style="height:400px">
|
|
12
|
+
</div>
|
|
13
|
+
<script type="module">
|
|
14
|
+
import { Heat } from "@hpcc-js/chart";
|
|
15
|
+
|
|
16
|
+
new Heat()
|
|
17
|
+
.target("placeholder")
|
|
18
|
+
.columns(["Day", "Hour", "weight"])
|
|
19
|
+
.orientation("vertical")
|
|
20
|
+
// .paletteID("RdYlBu")
|
|
21
|
+
// .reversePalette(true)
|
|
22
|
+
.xAxisType("ordinal")
|
|
23
|
+
.yAxisType("time")
|
|
24
|
+
.yAxisTypeTimePattern("%H")
|
|
25
|
+
.yAxisTickFormat("%H %p")
|
|
26
|
+
.yAxisTitle("Hour")
|
|
27
|
+
.radius(45)
|
|
28
|
+
.blur(25)
|
|
29
|
+
.minOpacity(.05)
|
|
30
|
+
.data([["Sat", 0, 0.18998719125426], ["Sat", 1, 0.21651075448881343], ["Sat", 2, 0.29360917730014136], ["Sat", 3, 0.1651116355055364], ["Sat", 4, 0.11885237728786953], ["Sat", 5, 0.09315256213264339], ["Sat", 6, 0.19081093933358728], ["Sat", 7, 0.26505462252549605], ["Sat", 8, 0.31304625721290896], ["Sat", 9, 0.18326323889972618], ["Sat", 10, 0.5427922043058862], ["Sat", 11, 0.33890867440986455], ["Sat", 12, 0.22287115322174472], ["Sat", 13, 0.2587162108611005], ["Sat", 14, 0.28441551468915144], ["Sat", 15, 0.19982154681583783], ["Sat", 16, 0.2930569439508717], ["Sat", 17, 0.47723750380299584], ["Sat", 18, 0.22207706211858186], ["Sat", 19, 0.33558402511639085], ["Sat", 20, 0.3690611266071652], ["Sat", 21, 0.5573599155287506], ["Sat", 22, 0.6831520252391093], ["Sat", 23, 0.5778902129422021], ["Fri", 0, 0.22511997013849297], ["Fri", 1, 0.12872968433216836], ["Fri", 2, 0.14983215685472429], ["Fri", 3, 0.2927501476457219], ["Fri", 4, 0.10428671137370601], ["Fri", 5, 0.15568583035698308], ["Fri", 6, 0.24599132277783603], ["Fri", 7, 0.2731898378837191], ["Fri", 8, 0.44567225462048016], ["Fri", 9, 0.20923559143936044], ["Fri", 10, 0.37126545805966676], ["Fri", 11, 0.25775900638903304], ["Fri", 12, 0.3814741051135274], ["Fri", 13, 0.34006938709768136], ["Fri", 14, 0.27593924410503684], ["Fri", 15, 0.4419477474759613], ["Fri", 16, 0.38965124930012096], ["Fri", 17, 0.3172503892478122], ["Fri", 18, 0.46400589048905894], ["Fri", 19, 0.2558543126612278], ["Fri", 20, 0.3590657029853837], ["Fri", 21, 0.15632447799886998], ["Fri", 22, 0.26420326277870526], ["Fri", 23, 0.297398622995917], ["Thur", 0, 0.18232751016901919], ["Thur", 1, 0.10522908735769126], ["Thur", 2, 0.2871142995201194], ["Thur", 3, 0.13264031456847822], ["Thur", 4, 0.18082727623683653], ["Thur", 5, 0.09944495435126643], ["Thur", 6, 0.11995531000488316], ["Thur", 7, 0.32298185555518627], ["Thur", 8, 0.2721533776994879], ["Thur", 9, 0.27001193948954205], ["Thur", 10, 0.4749544279655059], ["Thur", 11, 0.2692331882016368], ["Thur", 12, 0.4508438176709558], ["Thur", 13, 0.4492663733353105], ["Thur", 14, 0.3835056079807946], ["Thur", 15, 0.3464395010469424], ["Thur", 16, 0.34637609647721146], ["Thur", 17, 0.28212732557990894], ["Thur", 18, 0.19046579349029374], ["Thur", 19, 0.3223897386862471], ["Thur", 20, 0.2504833320124048], ["Thur", 21, 0.28639128289431637], ["Thur", 22, 0.4919882701545998], ["Thur", 23, 0.11120547938200998], ["Wed", 0, 0.26539414376986187], ["Wed", 1, 0.1915083896006279], ["Wed", 2, 0.1144094554621247], ["Wed", 3, 0.1915083896006279], ["Wed", 4, 0.1915083896006279], ["Wed", 5, 0.06301033647884767], ["Wed", 6, 0.18917162440973667], ["Wed", 7, 0.2034494131242346], ["Wed", 8, 0.355351933711545], ["Wed", 9, 0.3451218109163239], ["Wed", 10, 0.3226346644031917], ["Wed", 11, 0.20270338677554525], ["Wed", 12, 0.12560445263704206], ["Wed", 13, 0.2519610675488765], ["Wed", 14, 0.30086133062670817], ["Wed", 15, 0.24946221164343108], ["Wed", 16, 0.31534569552000696], ["Wed", 17, 0.4939159736052912], ["Wed", 18, 0.31544642697353115], ["Wed", 19, 0.24156016147712192], ["Wed", 20, 0.27236557847721654], ["Wed", 21, 0.3740930973387977], ["Wed", 22, 0.1085307269282787], ["Wed", 23, 0.13101787344141086], ["Tue", 0, 0.38368457249213195], ["Tue", 1, 0.11328658098527632], ["Tue", 2, 0.14541071077033996], ["Tue", 3, 0.06827291576651778], ["Tue", 4, 0.17107115373307188], ["Tue", 5, 0.11538864700272793], ["Tue", 6, 0.11217648968780919], ["Tue", 7, 0.13902321169712045], ["Tue", 8, 0.3094408893002232], ["Tue", 9, 0.40688502041473745], ["Tue", 10, 0.36313484464602097], ["Tue", 11, 0.4601351437724185], ["Tue", 12, 0.4095924978076847], ["Tue", 13, 0.22557709663316622], ["Tue", 14, 0.3283753345997203], ["Tue", 15, 0.2706332020074705], ["Tue", 16, 0.24600410595721722], ["Tue", 17, 0.5543993311840548], ["Tue", 18, 0.2738964920399142], ["Tue", 19, 0.2781803911141563], ["Tue", 20, 0.17569661936038083], ["Tue", 21, 0.48912841726342815], ["Tue", 22, 0.38632966796969875], ["Tue", 23, 0.18644420525695468], ["Mon", 0, 0.6359227793699938], ["Mon", 1, 0.5221023728137567], ["Mon", 2, 0.37279943958541595], ["Mon", 3, 0.34710013575736504], ["Mon", 4, 0.28285085353288725], ["Mon", 5, 0.25751868261666566], ["Mon", 6, 0.28428921687686476], ["Mon", 7, 0.17089474585761072], ["Mon", 8, 0.36545166807707746], ["Mon", 9, 0.21043056304791902], ["Mon", 10, 0.3696194958825379], ["Mon", 11, 0.3105586505053191], ["Mon", 12, 0.4402250862225449], ["Mon", 13, 0.2582289160630875], ["Mon", 14, 0.2996172716093256], ["Mon", 15, 0.32338989464103557], ["Mon", 16, 0.3249376820005164], ["Mon", 17, 0.22535620329345835], ["Mon", 18, 0.2782090254359703], ["Mon", 19, 0.14818108140584293], ["Mon", 20, 0.32807825351090025], ["Mon", 21, 0.5908569587793598], ["Mon", 22, 0.5080470114204925], ["Mon", 23, 0.2530276960364474], ["Sun", 0, 0.6469792068804184], ["Sun", 1, 0.4528553787783882], ["Sun", 2, 0.540662526620971], ["Sun", 3, 0.48754995027343223], ["Sun", 4, 0.2125643313502361], ["Sun", 5, 0.1999907961108455], ["Sun", 6, 0.19768419922329403], ["Sun", 7, 0.1666001089126883], ["Sun", 8, 0.39061458969829144], ["Sun", 9, 0.3091105719450119], ["Sun", 10, 0.3605096909282889], ["Sun", 11, 0.23504738724596624], ["Sun", 12, 0.2493108587995572], ["Sun", 13, 0.27608139305975626], ["Sun", 14, 0.301086314583818], ["Sun", 15, 0.4038845525503721], ["Sun", 16, 0.46976394580954595], ["Sun", 17, 0.5597125318620746], ["Sun", 18, 0.3975047233847814], ["Sun", 19, 0.19067492630497088], ["Sun", 20, 0.348541567064394], ["Sun", 21, 0.7699334507681412], ["Sun", 22, 0.606812411955852], ["Sun", 23, 1]])
|
|
31
|
+
.render()
|
|
32
|
+
;
|
|
33
|
+
</script>
|
|
34
|
+
</hpcc-vitepress>
|
|
35
|
+
</ClientOnly>
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
## Published Properties
|
|
40
|
+
```@hpcc-js/chart:Heat
|
|
41
|
+
|
|
42
|
+
```
|
package/src/Heat.ts
CHANGED
|
@@ -242,6 +242,11 @@ simpleheat.prototype = {
|
|
|
242
242
|
// draw a grayscale heatmap by putting a blurred ellipse at each data point
|
|
243
243
|
for (let i = 0, len = this._data.length, p; i < len; i++) {
|
|
244
244
|
p = this._data[i];
|
|
245
|
+
if (p[2] < 0) {
|
|
246
|
+
p[2] = 0;
|
|
247
|
+
} else if (p[2] > this._max) {
|
|
248
|
+
p[2] = this._max;
|
|
249
|
+
}
|
|
245
250
|
ctx.globalAlpha = Math.max(p[2] / this._max, minOpacity === undefined ? 0.05 : minOpacity);
|
|
246
251
|
ctx.drawImage(this._ellipse, p[0] - this._r, p[1] - this._r);
|
|
247
252
|
}
|
package/src/StatChart.ts
CHANGED
|
@@ -9,7 +9,7 @@ palette("MinMax");
|
|
|
9
9
|
palette("25%");
|
|
10
10
|
palette("50%");
|
|
11
11
|
|
|
12
|
-
type
|
|
12
|
+
type View = "min_max" | "25_75" | "normal";
|
|
13
13
|
type Tick = { label: string, value: number };
|
|
14
14
|
type Ticks = Tick[];
|
|
15
15
|
type AxisTick = { label: string, value: string };
|
|
@@ -24,15 +24,16 @@ function myFormatter(format: string): (num: number) => string {
|
|
|
24
24
|
};
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
+
export type StatChartView = "min_max" | "25_75" | "normal";
|
|
28
|
+
export type Quartiles = [number, number, number, number, number];
|
|
29
|
+
export type Data = [[number, number, number, number, number, number, number]];
|
|
30
|
+
|
|
27
31
|
export class StatChart extends HTMLWidget {
|
|
28
32
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
private _quartiles: number[];
|
|
32
|
-
private _selectMode: any;
|
|
33
|
-
private _tickFormatter: (_: number) => string;
|
|
33
|
+
protected _selectElement: any;
|
|
34
|
+
protected _tickFormatter: (_: number) => string;
|
|
34
35
|
|
|
35
|
-
|
|
36
|
+
protected _bellCurve: Scatter = new Scatter()
|
|
36
37
|
.columns(["", "Std. Dev."])
|
|
37
38
|
.paletteID("Quartile")
|
|
38
39
|
.interpolate_default("basis")
|
|
@@ -46,7 +47,7 @@ export class StatChart extends HTMLWidget {
|
|
|
46
47
|
.yAxisGuideLines(false) as Scatter
|
|
47
48
|
;
|
|
48
49
|
|
|
49
|
-
|
|
50
|
+
protected _candle = new QuartileCandlestick()
|
|
50
51
|
.columns(["Min", "25%", "50%", "75%", "Max"])
|
|
51
52
|
.edgePadding(0)
|
|
52
53
|
.roundedCorners(1)
|
|
@@ -59,23 +60,30 @@ export class StatChart extends HTMLWidget {
|
|
|
59
60
|
.innerRectColor(rainbow(10, 0, 100))
|
|
60
61
|
;
|
|
61
62
|
|
|
62
|
-
|
|
63
|
+
constructor() {
|
|
64
|
+
super();
|
|
65
|
+
this
|
|
66
|
+
.columns(["Min", "25%", "50%", "75%", "Max", "Mean", "Std. Dev."])
|
|
67
|
+
;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
protected stdDev(degrees: number): number {
|
|
63
71
|
return this.mean() + degrees * this.standardDeviation();
|
|
64
72
|
}
|
|
65
73
|
|
|
66
|
-
|
|
74
|
+
protected formatStdDev(degrees: number): string {
|
|
67
75
|
return this._tickFormatter(this.stdDev(degrees));
|
|
68
76
|
}
|
|
69
77
|
|
|
70
|
-
|
|
71
|
-
return this.
|
|
78
|
+
protected quartile(q: 0 | 1 | 2 | 3 | 4): number {
|
|
79
|
+
return this.quartiles()[q];
|
|
72
80
|
}
|
|
73
81
|
|
|
74
|
-
|
|
82
|
+
protected formatQ(q: 0 | 1 | 2 | 3 | 4): string {
|
|
75
83
|
return this._tickFormatter(this.quartile(q));
|
|
76
84
|
}
|
|
77
85
|
|
|
78
|
-
|
|
86
|
+
protected domain(mode: View): [number, number] {
|
|
79
87
|
switch (mode) {
|
|
80
88
|
case "25_75":
|
|
81
89
|
return [this.quartile(1), this.quartile(3)];
|
|
@@ -87,36 +95,22 @@ export class StatChart extends HTMLWidget {
|
|
|
87
95
|
}
|
|
88
96
|
}
|
|
89
97
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
mean(_?: number): this | number {
|
|
93
|
-
if (!arguments.length) return this._mean;
|
|
94
|
-
this._mean = _;
|
|
95
|
-
if (this.data()[0]) {
|
|
96
|
-
this.data()[0][5] = _;
|
|
97
|
-
}
|
|
98
|
-
return this;
|
|
98
|
+
protected min(): number {
|
|
99
|
+
return this.quartile(0);
|
|
99
100
|
}
|
|
100
101
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
standardDeviation(_?: number): this | number {
|
|
104
|
-
if (!arguments.length) return this._standardDeviation;
|
|
105
|
-
this._standardDeviation = _;
|
|
106
|
-
if (this.data()[0]) {
|
|
107
|
-
this.data()[0][6] = _;
|
|
108
|
-
}
|
|
109
|
-
return this;
|
|
102
|
+
protected max(): number {
|
|
103
|
+
return this.quartile(4);
|
|
110
104
|
}
|
|
111
105
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
if (!arguments.length) return this.
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
106
|
+
data(): Data;
|
|
107
|
+
data(_: Data): this;
|
|
108
|
+
data(_?: Data): Data | this {
|
|
109
|
+
if (!arguments.length) return [[...this.quartiles(), this.mean(), this.standardDeviation()]];
|
|
110
|
+
const row = _[0];
|
|
111
|
+
this.quartiles([row[0], row[1], row[2], row[3], row[4]]);
|
|
112
|
+
this.mean(row[5]);
|
|
113
|
+
this.standardDeviation(row[6]);
|
|
120
114
|
return this;
|
|
121
115
|
}
|
|
122
116
|
|
|
@@ -127,20 +121,21 @@ export class StatChart extends HTMLWidget {
|
|
|
127
121
|
|
|
128
122
|
this._candle.target(element.append("div").node());
|
|
129
123
|
|
|
130
|
-
this.
|
|
124
|
+
this._selectElement = element.append("div")
|
|
131
125
|
.style("position", "absolute")
|
|
132
126
|
.style("top", "0px")
|
|
133
127
|
.style("right", "0px").append("select")
|
|
134
128
|
.on("change", () => {
|
|
135
|
-
this.
|
|
129
|
+
this.view(this._selectElement.node().value);
|
|
130
|
+
this.lazyRender();
|
|
136
131
|
})
|
|
137
132
|
;
|
|
138
|
-
this.
|
|
139
|
-
this.
|
|
140
|
-
this.
|
|
133
|
+
this._selectElement.append("option").attr("value", "min_max").text("Min / Max");
|
|
134
|
+
this._selectElement.append("option").attr("value", "25_75").text("25% / 75%");
|
|
135
|
+
this._selectElement.append("option").attr("value", "normal").text("Normal");
|
|
141
136
|
}
|
|
142
137
|
|
|
143
|
-
|
|
138
|
+
protected bellTicks(mode: View): AxisTicks {
|
|
144
139
|
let ticks: Ticks;
|
|
145
140
|
switch (mode) {
|
|
146
141
|
case "25_75":
|
|
@@ -174,7 +169,7 @@ export class StatChart extends HTMLWidget {
|
|
|
174
169
|
];
|
|
175
170
|
}
|
|
176
171
|
|
|
177
|
-
const [domainLow, domainHigh] = this.domain(this.
|
|
172
|
+
const [domainLow, domainHigh] = this.domain(this._selectElement.node().value);
|
|
178
173
|
return ticks
|
|
179
174
|
.filter(sd => sd.value >= domainLow && sd.value <= domainHigh)
|
|
180
175
|
.map(sd => ({ label: sd.label, value: sd.value.toString() }))
|
|
@@ -182,7 +177,7 @@ export class StatChart extends HTMLWidget {
|
|
|
182
177
|
}
|
|
183
178
|
|
|
184
179
|
updateScatter() {
|
|
185
|
-
const mode = this.
|
|
180
|
+
const mode = this._selectElement.node().value;
|
|
186
181
|
const [domainLow, domainHigh] = this.domain(mode);
|
|
187
182
|
const padding = (domainHigh - domainLow) * (this.domainPadding() / 100);
|
|
188
183
|
|
|
@@ -222,23 +217,37 @@ export class StatChart extends HTMLWidget {
|
|
|
222
217
|
update(domNode, element) {
|
|
223
218
|
super.update(domNode, element);
|
|
224
219
|
this._tickFormatter = myFormatter(this.tickFormat());
|
|
225
|
-
|
|
226
|
-
this.quartiles(this.data()[0].slice(0, 5));
|
|
227
|
-
this.mean(this.data()[0][5]);
|
|
228
|
-
this.standardDeviation(this.data()[0][6]);
|
|
229
|
-
}
|
|
220
|
+
this._selectElement.node().value = this.view();
|
|
230
221
|
this.updateScatter();
|
|
231
222
|
this.updateCandle();
|
|
232
223
|
}
|
|
233
224
|
}
|
|
225
|
+
StatChart.prototype._class += " chart_Stat";
|
|
226
|
+
|
|
234
227
|
export interface StatChart {
|
|
228
|
+
view(): StatChartView;
|
|
229
|
+
view(_: StatChartView): this;
|
|
230
|
+
|
|
235
231
|
tickFormat(): string;
|
|
236
232
|
tickFormat(_: string): this;
|
|
237
233
|
candleHeight(): number;
|
|
238
234
|
candleHeight(_: number): this;
|
|
239
235
|
domainPadding(): number;
|
|
240
236
|
domainPadding(_: number): this;
|
|
237
|
+
|
|
238
|
+
mean(): number;
|
|
239
|
+
mean(_: number): this;
|
|
240
|
+
standardDeviation(): number;
|
|
241
|
+
standardDeviation(_: number): this;
|
|
242
|
+
quartiles(): Quartiles;
|
|
243
|
+
quartiles(_: Quartiles): this;
|
|
241
244
|
}
|
|
245
|
+
StatChart.prototype.publish("view", "min_max", "set", "View", ["min_max", "25_75", "normal"]);
|
|
246
|
+
|
|
242
247
|
StatChart.prototype.publish("tickFormat", ".2e", "string", "X-Axis Tick Format");
|
|
243
248
|
StatChart.prototype.publish("candleHeight", 20, "number", "Height of candle widget (pixels)");
|
|
244
249
|
StatChart.prototype.publish("domainPadding", 10, "number", "Domain value padding");
|
|
250
|
+
|
|
251
|
+
StatChart.prototype.publish("mean", .5, "number", "Mean");
|
|
252
|
+
StatChart.prototype.publish("standardDeviation", .125, "number", "Standard Deviation (σ)");
|
|
253
|
+
StatChart.prototype.publish("quartiles", [0, .25, .5, .75, 1], "object", "Quartiles (Min, 25%, 50%, 75%, Max)");
|
package/src/__package__.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export const PKG_NAME = "@hpcc-js/chart";
|
|
2
|
-
export const PKG_VERSION = "2.84.
|
|
3
|
-
export const BUILD_VERSION = "2.106.
|
|
2
|
+
export const PKG_VERSION = "2.84.1";
|
|
3
|
+
export const BUILD_VERSION = "2.106.1";
|
package/src/__tests__/heat.ts
CHANGED
|
@@ -28,7 +28,8 @@ export class Test extends Heat {
|
|
|
28
28
|
|
|
29
29
|
// Calculate the standard deviation of the weight column ---
|
|
30
30
|
const extractWeight = df.map(row => row[2]);
|
|
31
|
-
const distribution = df.scalar(df.distribution())(extractWeight(data));
|
|
31
|
+
export const distribution = df.scalar(df.distribution())(extractWeight(data));
|
|
32
|
+
export const quartiles = df.scalar(df.quartile())(extractWeight(data));
|
|
32
33
|
|
|
33
34
|
// Convert the weight column to standard deviations ---
|
|
34
35
|
const toStdDevs = df.map(r => {
|
package/src/__tests__/index.ts
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
export {
|
|
2
|
-
// export { Test3 as Test } from "./test3";
|
|
1
|
+
export { Test } from "./stat";
|
|
2
|
+
// export { Test3 as Test } from "./test3";
|
|
3
|
+
// export { StdDevTest as Test } from "./heat";
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { StatChart } from "../StatChart";
|
|
2
|
+
import { distribution, quartiles } from "./heat";
|
|
3
|
+
|
|
4
|
+
export class Test extends StatChart {
|
|
5
|
+
|
|
6
|
+
constructor() {
|
|
7
|
+
super();
|
|
8
|
+
this
|
|
9
|
+
.view("normal")
|
|
10
|
+
.quartiles(quartiles)
|
|
11
|
+
.mean(distribution.mean)
|
|
12
|
+
.standardDeviation(distribution.standardDeviation)
|
|
13
|
+
.lazyRender()
|
|
14
|
+
;
|
|
15
|
+
}
|
|
16
|
+
}
|
package/types/StatChart.d.ts
CHANGED
|
@@ -1,35 +1,51 @@
|
|
|
1
1
|
import { HTMLWidget } from "@hpcc-js/common";
|
|
2
|
+
import { QuartileCandlestick } from "./QuartileCandlestick";
|
|
3
|
+
import { Scatter } from "./Scatter";
|
|
4
|
+
type View = "min_max" | "25_75" | "normal";
|
|
5
|
+
type AxisTick = {
|
|
6
|
+
label: string;
|
|
7
|
+
value: string;
|
|
8
|
+
};
|
|
9
|
+
type AxisTicks = AxisTick[];
|
|
10
|
+
export type StatChartView = "min_max" | "25_75" | "normal";
|
|
11
|
+
export type Quartiles = [number, number, number, number, number];
|
|
12
|
+
export type Data = [[number, number, number, number, number, number, number]];
|
|
2
13
|
export declare class StatChart extends HTMLWidget {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
standardDeviation(): number;
|
|
18
|
-
standardDeviation(_: number): this;
|
|
19
|
-
quartiles(): number[];
|
|
20
|
-
quartiles(_: number[]): this;
|
|
14
|
+
protected _selectElement: any;
|
|
15
|
+
protected _tickFormatter: (_: number) => string;
|
|
16
|
+
protected _bellCurve: Scatter;
|
|
17
|
+
protected _candle: QuartileCandlestick;
|
|
18
|
+
constructor();
|
|
19
|
+
protected stdDev(degrees: number): number;
|
|
20
|
+
protected formatStdDev(degrees: number): string;
|
|
21
|
+
protected quartile(q: 0 | 1 | 2 | 3 | 4): number;
|
|
22
|
+
protected formatQ(q: 0 | 1 | 2 | 3 | 4): string;
|
|
23
|
+
protected domain(mode: View): [number, number];
|
|
24
|
+
protected min(): number;
|
|
25
|
+
protected max(): number;
|
|
26
|
+
data(): Data;
|
|
27
|
+
data(_: Data): this;
|
|
21
28
|
enter(domNode: any, element: any): void;
|
|
22
|
-
|
|
29
|
+
protected bellTicks(mode: View): AxisTicks;
|
|
23
30
|
updateScatter(): void;
|
|
24
31
|
updateCandle(): void;
|
|
25
32
|
update(domNode: any, element: any): void;
|
|
26
33
|
}
|
|
27
34
|
export interface StatChart {
|
|
35
|
+
view(): StatChartView;
|
|
36
|
+
view(_: StatChartView): this;
|
|
28
37
|
tickFormat(): string;
|
|
29
38
|
tickFormat(_: string): this;
|
|
30
39
|
candleHeight(): number;
|
|
31
40
|
candleHeight(_: number): this;
|
|
32
41
|
domainPadding(): number;
|
|
33
42
|
domainPadding(_: number): this;
|
|
43
|
+
mean(): number;
|
|
44
|
+
mean(_: number): this;
|
|
45
|
+
standardDeviation(): number;
|
|
46
|
+
standardDeviation(_: number): this;
|
|
47
|
+
quartiles(): Quartiles;
|
|
48
|
+
quartiles(_: Quartiles): this;
|
|
34
49
|
}
|
|
50
|
+
export {};
|
|
35
51
|
//# sourceMappingURL=StatChart.d.ts.map
|
package/types/StatChart.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StatChart.d.ts","sourceRoot":"","sources":["../src/StatChart.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,UAAU,EAAW,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"StatChart.d.ts","sourceRoot":"","sources":["../src/StatChart.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,UAAU,EAAW,MAAM,iBAAiB,CAAC;AAC1E,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AASpC,KAAK,IAAI,GAAG,SAAS,GAAG,OAAO,GAAG,QAAQ,CAAC;AAG3C,KAAK,QAAQ,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AACjD,KAAK,SAAS,GAAG,QAAQ,EAAE,CAAC;AAW5B,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,OAAO,GAAG,QAAQ,CAAC;AAC3D,MAAM,MAAM,SAAS,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AACjE,MAAM,MAAM,IAAI,GAAG,CAAC,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;AAE9E,qBAAa,SAAU,SAAQ,UAAU;IAErC,SAAS,CAAC,cAAc,EAAE,GAAG,CAAC;IAC9B,SAAS,CAAC,cAAc,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,MAAM,CAAC;IAEhD,SAAS,CAAC,UAAU,EAAE,OAAO,CAYxB;IAEL,SAAS,CAAC,OAAO,sBAWZ;;IASL,SAAS,CAAC,MAAM,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM;IAIzC,SAAS,CAAC,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM;IAI/C,SAAS,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,MAAM;IAIhD,SAAS,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,MAAM;IAI/C,SAAS,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC;IAY9C,SAAS,CAAC,GAAG,IAAI,MAAM;IAIvB,SAAS,CAAC,GAAG,IAAI,MAAM;IAIvB,IAAI,IAAI,IAAI;IACZ,IAAI,CAAC,CAAC,EAAE,IAAI,GAAG,IAAI;IAUnB,KAAK,CAAC,OAAO,KAAA,EAAE,OAAO,KAAA;IAqBtB,SAAS,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,GAAG,SAAS;IAyC1C,aAAa;IAyBb,YAAY;IAaZ,MAAM,CAAC,OAAO,KAAA,EAAE,OAAO,KAAA;CAO1B;AAGD,MAAM,WAAW,SAAS;IACtB,IAAI,IAAI,aAAa,CAAC;IACtB,IAAI,CAAC,CAAC,EAAE,aAAa,GAAG,IAAI,CAAC;IAE7B,UAAU,IAAI,MAAM,CAAC;IACrB,UAAU,CAAC,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,YAAY,IAAI,MAAM,CAAC;IACvB,YAAY,CAAC,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,aAAa,IAAI,MAAM,CAAC;IACxB,aAAa,CAAC,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAE/B,IAAI,IAAI,MAAM,CAAC;IACf,IAAI,CAAC,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,iBAAiB,IAAI,MAAM,CAAC;IAC5B,iBAAiB,CAAC,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACnC,SAAS,IAAI,SAAS,CAAC;IACvB,SAAS,CAAC,CAAC,EAAE,SAAS,GAAG,IAAI,CAAC;CACjC"}
|
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.84.
|
|
3
|
-
export declare const BUILD_VERSION = "2.106.
|
|
2
|
+
export declare const PKG_VERSION = "2.84.1";
|
|
3
|
+
export declare const BUILD_VERSION = "2.106.1";
|
|
4
4
|
//# sourceMappingURL=__package__.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"heat.d.ts","sourceRoot":"","sources":["../../src/__tests__/heat.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAQ/B,qBAAa,IAAK,SAAQ,IAAI;;CAkB7B;
|
|
1
|
+
{"version":3,"file":"heat.d.ts","sourceRoot":"","sources":["../../src/__tests__/heat.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAQ/B,qBAAa,IAAK,SAAQ,IAAI;;CAkB7B;AAID,eAAO,MAAM,YAAY,KAAoD,CAAC;AAC9E,eAAO,MAAM,SAAS,KAAgD,CAAC;AAmBvE,qBAAa,UAAW,SAAQ,IAAI;;CAoBnC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { Test } from "./stat";
|
|
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,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/__tests__/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stat.d.ts","sourceRoot":"","sources":["../../src/__tests__/stat.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAGzC,qBAAa,IAAK,SAAQ,SAAS;;CAYlC"}
|
package/types-3.4/StatChart.d.ts
CHANGED
|
@@ -1,35 +1,70 @@
|
|
|
1
1
|
import { HTMLWidget } from "@hpcc-js/common";
|
|
2
|
+
import { QuartileCandlestick } from "./QuartileCandlestick";
|
|
3
|
+
import { Scatter } from "./Scatter";
|
|
4
|
+
type View = "min_max" | "25_75" | "normal";
|
|
5
|
+
type AxisTick = {
|
|
6
|
+
label: string;
|
|
7
|
+
value: string;
|
|
8
|
+
};
|
|
9
|
+
type AxisTicks = AxisTick[];
|
|
10
|
+
export type StatChartView = "min_max" | "25_75" | "normal";
|
|
11
|
+
export type Quartiles = [
|
|
12
|
+
number,
|
|
13
|
+
number,
|
|
14
|
+
number,
|
|
15
|
+
number,
|
|
16
|
+
number
|
|
17
|
+
];
|
|
18
|
+
export type Data = [
|
|
19
|
+
[
|
|
20
|
+
number,
|
|
21
|
+
number,
|
|
22
|
+
number,
|
|
23
|
+
number,
|
|
24
|
+
number,
|
|
25
|
+
number,
|
|
26
|
+
number
|
|
27
|
+
]
|
|
28
|
+
];
|
|
2
29
|
export declare class StatChart extends HTMLWidget {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
quartiles(_: number[]): this;
|
|
30
|
+
protected _selectElement: any;
|
|
31
|
+
protected _tickFormatter: (_: number) => string;
|
|
32
|
+
protected _bellCurve: Scatter;
|
|
33
|
+
protected _candle: QuartileCandlestick;
|
|
34
|
+
constructor();
|
|
35
|
+
protected stdDev(degrees: number): number;
|
|
36
|
+
protected formatStdDev(degrees: number): string;
|
|
37
|
+
protected quartile(q: 0 | 1 | 2 | 3 | 4): number;
|
|
38
|
+
protected formatQ(q: 0 | 1 | 2 | 3 | 4): string;
|
|
39
|
+
protected domain(mode: View): [
|
|
40
|
+
number,
|
|
41
|
+
number
|
|
42
|
+
];
|
|
43
|
+
protected min(): number;
|
|
44
|
+
protected max(): number;
|
|
45
|
+
data(): Data;
|
|
46
|
+
data(_: Data): this;
|
|
21
47
|
enter(domNode: any, element: any): void;
|
|
22
|
-
|
|
48
|
+
protected bellTicks(mode: View): AxisTicks;
|
|
23
49
|
updateScatter(): void;
|
|
24
50
|
updateCandle(): void;
|
|
25
51
|
update(domNode: any, element: any): void;
|
|
26
52
|
}
|
|
27
53
|
export interface StatChart {
|
|
54
|
+
view(): StatChartView;
|
|
55
|
+
view(_: StatChartView): this;
|
|
28
56
|
tickFormat(): string;
|
|
29
57
|
tickFormat(_: string): this;
|
|
30
58
|
candleHeight(): number;
|
|
31
59
|
candleHeight(_: number): this;
|
|
32
60
|
domainPadding(): number;
|
|
33
61
|
domainPadding(_: number): this;
|
|
62
|
+
mean(): number;
|
|
63
|
+
mean(_: number): this;
|
|
64
|
+
standardDeviation(): number;
|
|
65
|
+
standardDeviation(_: number): this;
|
|
66
|
+
quartiles(): Quartiles;
|
|
67
|
+
quartiles(_: Quartiles): this;
|
|
34
68
|
}
|
|
69
|
+
export {};
|
|
35
70
|
//# sourceMappingURL=StatChart.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export declare const PKG_NAME = "@hpcc-js/chart";
|
|
2
|
-
export declare const PKG_VERSION = "2.84.
|
|
3
|
-
export declare const BUILD_VERSION = "2.106.
|
|
2
|
+
export declare const PKG_VERSION = "2.84.1";
|
|
3
|
+
export declare const BUILD_VERSION = "2.106.1";
|
|
4
4
|
//# sourceMappingURL=__package__.d.ts.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { Test } from "./stat";
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|