qesuite 1.0.21 → 1.0.23
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.d.mts +17 -2
- package/dist/index.d.ts +17 -2
- package/dist/index.js +31 -10
- package/dist/index.mjs +31 -10
- package/index.ts +81 -47
- package/package.json +1 -1
- package/versions/1_0_22.md +2 -0
- package/versions/1_0_23.md +1 -0
package/dist/index.d.mts
CHANGED
|
@@ -967,7 +967,13 @@ declare function AnovaTableTwoWay(data: GRRData, interaction: boolean): any;
|
|
|
967
967
|
* @param tolerance The total tolerance spread = (USL - LSL)
|
|
968
968
|
* @param referenceValue The value used to evaluate bias. Generally historical mean or mean from other measurement equipment.
|
|
969
969
|
*/
|
|
970
|
-
declare function G1(data: any, tolerance: number, referenceValue
|
|
970
|
+
declare function G1(data: any, tolerance: number, referenceValue?: number): {
|
|
971
|
+
Cg: number;
|
|
972
|
+
Cgk?: undefined;
|
|
973
|
+
bias?: undefined;
|
|
974
|
+
t?: undefined;
|
|
975
|
+
p?: undefined;
|
|
976
|
+
} | {
|
|
971
977
|
Cg: number;
|
|
972
978
|
Cgk: number;
|
|
973
979
|
bias: number;
|
|
@@ -1050,7 +1056,16 @@ declare function VarianceComponents(ANOVA: any, data: GRRData): {
|
|
|
1050
1056
|
Contribution: number;
|
|
1051
1057
|
};
|
|
1052
1058
|
};
|
|
1053
|
-
declare function G1Graphs(data: any, tolerance: number, referenceValue
|
|
1059
|
+
declare function G1Graphs(data: any, tolerance: number, referenceValue?: number): {
|
|
1060
|
+
charts: {
|
|
1061
|
+
RunChart: HTMLCanvasElement;
|
|
1062
|
+
};
|
|
1063
|
+
Cg: number;
|
|
1064
|
+
Cgk?: undefined;
|
|
1065
|
+
bias?: undefined;
|
|
1066
|
+
t?: undefined;
|
|
1067
|
+
p?: undefined;
|
|
1068
|
+
} | {
|
|
1054
1069
|
charts: {
|
|
1055
1070
|
RunChart: HTMLCanvasElement;
|
|
1056
1071
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -967,7 +967,13 @@ declare function AnovaTableTwoWay(data: GRRData, interaction: boolean): any;
|
|
|
967
967
|
* @param tolerance The total tolerance spread = (USL - LSL)
|
|
968
968
|
* @param referenceValue The value used to evaluate bias. Generally historical mean or mean from other measurement equipment.
|
|
969
969
|
*/
|
|
970
|
-
declare function G1(data: any, tolerance: number, referenceValue
|
|
970
|
+
declare function G1(data: any, tolerance: number, referenceValue?: number): {
|
|
971
|
+
Cg: number;
|
|
972
|
+
Cgk?: undefined;
|
|
973
|
+
bias?: undefined;
|
|
974
|
+
t?: undefined;
|
|
975
|
+
p?: undefined;
|
|
976
|
+
} | {
|
|
971
977
|
Cg: number;
|
|
972
978
|
Cgk: number;
|
|
973
979
|
bias: number;
|
|
@@ -1050,7 +1056,16 @@ declare function VarianceComponents(ANOVA: any, data: GRRData): {
|
|
|
1050
1056
|
Contribution: number;
|
|
1051
1057
|
};
|
|
1052
1058
|
};
|
|
1053
|
-
declare function G1Graphs(data: any, tolerance: number, referenceValue
|
|
1059
|
+
declare function G1Graphs(data: any, tolerance: number, referenceValue?: number): {
|
|
1060
|
+
charts: {
|
|
1061
|
+
RunChart: HTMLCanvasElement;
|
|
1062
|
+
};
|
|
1063
|
+
Cg: number;
|
|
1064
|
+
Cgk?: undefined;
|
|
1065
|
+
bias?: undefined;
|
|
1066
|
+
t?: undefined;
|
|
1067
|
+
p?: undefined;
|
|
1068
|
+
} | {
|
|
1054
1069
|
charts: {
|
|
1055
1070
|
RunChart: HTMLCanvasElement;
|
|
1056
1071
|
};
|
package/dist/index.js
CHANGED
|
@@ -2718,7 +2718,7 @@ function PlotPoint(ctx, value, dataSetDisplay, chartSettings) {
|
|
|
2718
2718
|
};
|
|
2719
2719
|
let x = ConvertToCanvasPt(value.x, chartSettings.axis.x.min, chartSettings.axis.x.max, chartSettings.width - chartSettings.margins.left - chartSettings.margins.right - padding.left - padding.right, chartSettings.axis.x);
|
|
2720
2720
|
let y = ConvertToCanvasPt(value.y, chartSettings.axis.y.max, chartSettings.axis.y.min, chartSettings.height - chartSettings.margins.top - chartSettings.margins.bottom - padding.top - padding.bottom, chartSettings.axis.y);
|
|
2721
|
-
if (y >= 0 && y <= chartSettings.height - chartSettings.margins.bottom && x >= 0 && x <= chartSettings.width - chartSettings.margins.right) {
|
|
2721
|
+
if (y >= 0 && y <= chartSettings.height - chartSettings.margins.bottom - chartSettings.margins.top && x >= 0 && x <= chartSettings.width - chartSettings.margins.right - chartSettings.margins.left) {
|
|
2722
2722
|
DrawPolygon(ctx, shape, x + chartSettings.margins.left + padding.left, y + chartSettings.margins.top + padding.top, shapeRadius);
|
|
2723
2723
|
}
|
|
2724
2724
|
ctx.fill();
|
|
@@ -2762,15 +2762,28 @@ function PlotLine(ctx, dataSet, chartSettings) {
|
|
|
2762
2762
|
top: ((_f = chartSettings.axis.y.padding) == null ? void 0 : _f.top) ? (_g = chartSettings.axis.y.padding) == null ? void 0 : _g.top : 0,
|
|
2763
2763
|
bottom: ((_h = chartSettings.axis.y.padding) == null ? void 0 : _h.bottom) ? (_i = chartSettings.axis.y.padding) == null ? void 0 : _i.bottom : 0
|
|
2764
2764
|
};
|
|
2765
|
+
let newPath = true;
|
|
2765
2766
|
if (((_j = dataSet.line) == null ? void 0 : _j.type) === "straight") {
|
|
2766
|
-
|
|
2767
|
-
|
|
2768
|
-
|
|
2769
|
-
|
|
2770
|
-
|
|
2771
|
-
|
|
2772
|
-
if (
|
|
2773
|
-
|
|
2767
|
+
dataSet.values.forEach((value, i) => {
|
|
2768
|
+
let x = ConvertToCanvasPt(value.x, chartSettings.axis.x.min, chartSettings.axis.x.max, chartSettings.width - chartSettings.margins.left - chartSettings.margins.right - padding.left - padding.right, chartSettings.axis.x);
|
|
2769
|
+
let y = ConvertToCanvasPt(value.y, chartSettings.axis.y.max, chartSettings.axis.y.min, chartSettings.height - chartSettings.margins.top - chartSettings.margins.bottom - padding.top - padding.bottom, chartSettings.axis.y);
|
|
2770
|
+
if (y < 0) {
|
|
2771
|
+
y = 0;
|
|
2772
|
+
}
|
|
2773
|
+
if (y > chartSettings.height - chartSettings.margins.bottom - chartSettings.margins.top) {
|
|
2774
|
+
y = chartSettings.height - chartSettings.margins.bottom - chartSettings.margins.top;
|
|
2775
|
+
}
|
|
2776
|
+
if (x < 0) {
|
|
2777
|
+
x = 0;
|
|
2778
|
+
}
|
|
2779
|
+
if (x > chartSettings.width - chartSettings.margins.right - chartSettings.margins.left) {
|
|
2780
|
+
x = chartSettings.width - chartSettings.margins.right - chartSettings.margins.left;
|
|
2781
|
+
}
|
|
2782
|
+
if (newPath) {
|
|
2783
|
+
ctx.moveTo(x + chartSettings.margins.left + padding.left, y + chartSettings.margins.top + padding.top);
|
|
2784
|
+
newPath = false;
|
|
2785
|
+
} else {
|
|
2786
|
+
ctx.lineTo(x + chartSettings.margins.left + padding.left, y + chartSettings.margins.top + padding.top);
|
|
2774
2787
|
}
|
|
2775
2788
|
});
|
|
2776
2789
|
}
|
|
@@ -3387,10 +3400,15 @@ function AnovaTableTwoWay(data, interaction) {
|
|
|
3387
3400
|
function G1(data, tolerance, referenceValue) {
|
|
3388
3401
|
let K = 20;
|
|
3389
3402
|
let L = 6;
|
|
3390
|
-
let Xm = referenceValue;
|
|
3391
3403
|
let XbarG = Mean(data);
|
|
3392
3404
|
let s = StDev.S(data);
|
|
3393
3405
|
let Cg = K / 100 * tolerance / (L * s);
|
|
3406
|
+
if (!referenceValue) {
|
|
3407
|
+
return {
|
|
3408
|
+
Cg
|
|
3409
|
+
};
|
|
3410
|
+
}
|
|
3411
|
+
let Xm = referenceValue;
|
|
3394
3412
|
let Cgk = (K / 200 * tolerance - Math.abs(XbarG - Xm)) / (L / 2 * s);
|
|
3395
3413
|
let Bias = XbarG - referenceValue;
|
|
3396
3414
|
let T = Math.sqrt(data.length) * Math.abs(Bias) / s;
|
|
@@ -3587,6 +3605,9 @@ function VarianceComponents(ANOVA, data) {
|
|
|
3587
3605
|
}
|
|
3588
3606
|
function G1Graphs(data, tolerance, referenceValue) {
|
|
3589
3607
|
let g1Results = G1(data, tolerance, referenceValue);
|
|
3608
|
+
if (!referenceValue) {
|
|
3609
|
+
referenceValue = Mean(data);
|
|
3610
|
+
}
|
|
3590
3611
|
let dataset = new DataSet(data.map((d, i) => {
|
|
3591
3612
|
return new Point(i + 1, d);
|
|
3592
3613
|
}));
|
package/dist/index.mjs
CHANGED
|
@@ -2631,7 +2631,7 @@ function PlotPoint(ctx, value, dataSetDisplay, chartSettings) {
|
|
|
2631
2631
|
};
|
|
2632
2632
|
let x = ConvertToCanvasPt(value.x, chartSettings.axis.x.min, chartSettings.axis.x.max, chartSettings.width - chartSettings.margins.left - chartSettings.margins.right - padding.left - padding.right, chartSettings.axis.x);
|
|
2633
2633
|
let y = ConvertToCanvasPt(value.y, chartSettings.axis.y.max, chartSettings.axis.y.min, chartSettings.height - chartSettings.margins.top - chartSettings.margins.bottom - padding.top - padding.bottom, chartSettings.axis.y);
|
|
2634
|
-
if (y >= 0 && y <= chartSettings.height - chartSettings.margins.bottom && x >= 0 && x <= chartSettings.width - chartSettings.margins.right) {
|
|
2634
|
+
if (y >= 0 && y <= chartSettings.height - chartSettings.margins.bottom - chartSettings.margins.top && x >= 0 && x <= chartSettings.width - chartSettings.margins.right - chartSettings.margins.left) {
|
|
2635
2635
|
DrawPolygon(ctx, shape, x + chartSettings.margins.left + padding.left, y + chartSettings.margins.top + padding.top, shapeRadius);
|
|
2636
2636
|
}
|
|
2637
2637
|
ctx.fill();
|
|
@@ -2675,15 +2675,28 @@ function PlotLine(ctx, dataSet, chartSettings) {
|
|
|
2675
2675
|
top: ((_f = chartSettings.axis.y.padding) == null ? void 0 : _f.top) ? (_g = chartSettings.axis.y.padding) == null ? void 0 : _g.top : 0,
|
|
2676
2676
|
bottom: ((_h = chartSettings.axis.y.padding) == null ? void 0 : _h.bottom) ? (_i = chartSettings.axis.y.padding) == null ? void 0 : _i.bottom : 0
|
|
2677
2677
|
};
|
|
2678
|
+
let newPath = true;
|
|
2678
2679
|
if (((_j = dataSet.line) == null ? void 0 : _j.type) === "straight") {
|
|
2679
|
-
|
|
2680
|
-
|
|
2681
|
-
|
|
2682
|
-
|
|
2683
|
-
|
|
2684
|
-
|
|
2685
|
-
if (
|
|
2686
|
-
|
|
2680
|
+
dataSet.values.forEach((value, i) => {
|
|
2681
|
+
let x = ConvertToCanvasPt(value.x, chartSettings.axis.x.min, chartSettings.axis.x.max, chartSettings.width - chartSettings.margins.left - chartSettings.margins.right - padding.left - padding.right, chartSettings.axis.x);
|
|
2682
|
+
let y = ConvertToCanvasPt(value.y, chartSettings.axis.y.max, chartSettings.axis.y.min, chartSettings.height - chartSettings.margins.top - chartSettings.margins.bottom - padding.top - padding.bottom, chartSettings.axis.y);
|
|
2683
|
+
if (y < 0) {
|
|
2684
|
+
y = 0;
|
|
2685
|
+
}
|
|
2686
|
+
if (y > chartSettings.height - chartSettings.margins.bottom - chartSettings.margins.top) {
|
|
2687
|
+
y = chartSettings.height - chartSettings.margins.bottom - chartSettings.margins.top;
|
|
2688
|
+
}
|
|
2689
|
+
if (x < 0) {
|
|
2690
|
+
x = 0;
|
|
2691
|
+
}
|
|
2692
|
+
if (x > chartSettings.width - chartSettings.margins.right - chartSettings.margins.left) {
|
|
2693
|
+
x = chartSettings.width - chartSettings.margins.right - chartSettings.margins.left;
|
|
2694
|
+
}
|
|
2695
|
+
if (newPath) {
|
|
2696
|
+
ctx.moveTo(x + chartSettings.margins.left + padding.left, y + chartSettings.margins.top + padding.top);
|
|
2697
|
+
newPath = false;
|
|
2698
|
+
} else {
|
|
2699
|
+
ctx.lineTo(x + chartSettings.margins.left + padding.left, y + chartSettings.margins.top + padding.top);
|
|
2687
2700
|
}
|
|
2688
2701
|
});
|
|
2689
2702
|
}
|
|
@@ -3300,10 +3313,15 @@ function AnovaTableTwoWay(data, interaction) {
|
|
|
3300
3313
|
function G1(data, tolerance, referenceValue) {
|
|
3301
3314
|
let K = 20;
|
|
3302
3315
|
let L = 6;
|
|
3303
|
-
let Xm = referenceValue;
|
|
3304
3316
|
let XbarG = Mean(data);
|
|
3305
3317
|
let s = StDev.S(data);
|
|
3306
3318
|
let Cg = K / 100 * tolerance / (L * s);
|
|
3319
|
+
if (!referenceValue) {
|
|
3320
|
+
return {
|
|
3321
|
+
Cg
|
|
3322
|
+
};
|
|
3323
|
+
}
|
|
3324
|
+
let Xm = referenceValue;
|
|
3307
3325
|
let Cgk = (K / 200 * tolerance - Math.abs(XbarG - Xm)) / (L / 2 * s);
|
|
3308
3326
|
let Bias = XbarG - referenceValue;
|
|
3309
3327
|
let T = Math.sqrt(data.length) * Math.abs(Bias) / s;
|
|
@@ -3500,6 +3518,9 @@ function VarianceComponents(ANOVA, data) {
|
|
|
3500
3518
|
}
|
|
3501
3519
|
function G1Graphs(data, tolerance, referenceValue) {
|
|
3502
3520
|
let g1Results = G1(data, tolerance, referenceValue);
|
|
3521
|
+
if (!referenceValue) {
|
|
3522
|
+
referenceValue = Mean(data);
|
|
3523
|
+
}
|
|
3503
3524
|
let dataset = new DataSet(data.map((d, i) => {
|
|
3504
3525
|
return new Point(i + 1, d);
|
|
3505
3526
|
}));
|
package/index.ts
CHANGED
|
@@ -4,15 +4,16 @@
|
|
|
4
4
|
|
|
5
5
|
// Specification Classes
|
|
6
6
|
export class Specification{
|
|
7
|
-
constructor(spec: any, USL: number = NaN, LSL: number = NaN, tolerance: number = NaN,
|
|
7
|
+
constructor(spec: any, USL: number = NaN, LSL: number = NaN, tolerance: number = NaN, tol_plus: number = NaN, tol_minus: number = NaN, units: string = ''){
|
|
8
8
|
if(typeof spec === "object"){
|
|
9
9
|
this.nominal = spec?.spec;
|
|
10
10
|
this.USL = spec?.USL;
|
|
11
11
|
this.LSL = spec?.LSL;
|
|
12
12
|
this.tolerance = spec?.tolerance;
|
|
13
|
-
this.
|
|
14
|
-
this.
|
|
13
|
+
this.tol_plus = spec?.tol_plus;
|
|
14
|
+
this.tol_minus = spec?.tol_minus;
|
|
15
15
|
this.units = spec?.units;
|
|
16
|
+
this.full_tolerance = spec?.full_tolerance ?? spec?.tolerance * 2 ?? spec?.tol_plus + spec?.tol_minus
|
|
16
17
|
}
|
|
17
18
|
if(Number.isNaN(Number(spec))){
|
|
18
19
|
let parsed = this.ParseSpec(spec);
|
|
@@ -20,17 +21,19 @@ export class Specification{
|
|
|
20
21
|
this.USL = parsed.USL;
|
|
21
22
|
this.LSL = parsed.LSL;
|
|
22
23
|
this.tolerance = parsed.tolerance ?? NaN;
|
|
23
|
-
this.
|
|
24
|
-
this.
|
|
24
|
+
this.tol_plus = parsed.tol_plus ?? NaN;
|
|
25
|
+
this.tol_minus = parsed.tol_minus ?? NaN;
|
|
25
26
|
this.units = parsed.units ?? '';
|
|
27
|
+
this.full_tolerance = parsed?.tolerance * 2 ?? parsed?.tol_plus + parsed?.tol_minus
|
|
26
28
|
}else{
|
|
27
29
|
this.nominal = spec;
|
|
28
30
|
this.USL = USL;
|
|
29
31
|
this.LSL = LSL;
|
|
30
32
|
this.tolerance = tolerance;
|
|
31
|
-
this.
|
|
32
|
-
this.
|
|
33
|
+
this.tol_plus = tol_plus;
|
|
34
|
+
this.tol_minus = tol_minus;
|
|
33
35
|
this.units = units;
|
|
36
|
+
this.full_tolerance = tolerance * 2 ?? tol_plus + tol_minus;
|
|
34
37
|
}
|
|
35
38
|
|
|
36
39
|
}
|
|
@@ -40,8 +43,9 @@ export class Specification{
|
|
|
40
43
|
LSL: number;
|
|
41
44
|
units: string;
|
|
42
45
|
tolerance: number;
|
|
43
|
-
|
|
44
|
-
|
|
46
|
+
tol_plus: number;
|
|
47
|
+
tol_minus: number;
|
|
48
|
+
full_tolerance: number;
|
|
45
49
|
|
|
46
50
|
// methods
|
|
47
51
|
ParseSpec(spec: string) {
|
|
@@ -51,8 +55,8 @@ export class Specification{
|
|
|
51
55
|
let nominal;
|
|
52
56
|
let USL;
|
|
53
57
|
let LSL;
|
|
54
|
-
let
|
|
55
|
-
let
|
|
58
|
+
let tol_plus;
|
|
59
|
+
let tol_minus;
|
|
56
60
|
let tol;
|
|
57
61
|
let units;
|
|
58
62
|
|
|
@@ -61,45 +65,45 @@ export class Specification{
|
|
|
61
65
|
let after = this.SplitUnits(string.substring(string.indexOf("±") + 1));
|
|
62
66
|
tol = Number(after[0]);
|
|
63
67
|
units = after[1];
|
|
64
|
-
|
|
65
|
-
|
|
68
|
+
tol_plus = Number(tol);
|
|
69
|
+
tol_minus = Number(tol);
|
|
66
70
|
}
|
|
67
71
|
if (string.indexOf("+") !== -1) {
|
|
68
|
-
|
|
69
|
-
nominal = Number(this.SplitUnits(string
|
|
70
|
-
|
|
72
|
+
tol_plus = Number(this.SplitUnits(string.substring(string.indexOf("+") + 1))[0]);
|
|
73
|
+
nominal = Number(this.SplitUnits(string)[0]);
|
|
71
74
|
}
|
|
72
75
|
if (string.indexOf("-") !== -1) {
|
|
73
|
-
|
|
76
|
+
tol_minus = Number(this.SplitUnits(string.substring(string.indexOf("-") + 1))[0]);
|
|
77
|
+
nominal = Number(this.SplitUnits(string)[0]);
|
|
74
78
|
}
|
|
75
79
|
if (string.indexOf("+-") !== -1 || string.indexOf("+/-") !== -1) {
|
|
76
80
|
nominal = Number(string.substring(0, string.indexOf("+")));
|
|
77
81
|
let after = this.SplitUnits(string.substring(string.indexOf("-") + 1));
|
|
78
82
|
tol = Number(after[0]);
|
|
79
83
|
units = after[1];
|
|
80
|
-
|
|
81
|
-
|
|
84
|
+
tol_plus = Number(tol);
|
|
85
|
+
tol_minus = Number(tol);
|
|
82
86
|
}
|
|
83
87
|
if (string.indexOf("-+") !== -1 || string.indexOf("-/+") !== -1) {
|
|
84
88
|
nominal = Number(string.substring(0, string.indexOf("-")));
|
|
85
89
|
let after = this.SplitUnits(string.substring(string.indexOf("+") + 1));
|
|
86
90
|
tol = Number(after[0]);
|
|
87
91
|
units = after[1];
|
|
88
|
-
|
|
89
|
-
|
|
92
|
+
tol_plus = Number(tol);
|
|
93
|
+
tol_minus = Number(tol);
|
|
90
94
|
}
|
|
91
95
|
|
|
92
|
-
if(nominal &&
|
|
93
|
-
USL = nominal +
|
|
96
|
+
if(nominal && tol_plus && tol_minus){
|
|
97
|
+
USL = nominal + tol_plus;
|
|
94
98
|
// Round USL
|
|
95
|
-
let digits = String(
|
|
99
|
+
let digits = String(tol_plus).split(".");
|
|
96
100
|
|
|
97
101
|
USL = Number(USL).toFixed(digits[1].length);
|
|
98
102
|
|
|
99
103
|
|
|
100
|
-
LSL = nominal -
|
|
104
|
+
LSL = nominal - tol_minus;
|
|
101
105
|
// Round LSL
|
|
102
|
-
digits = String(
|
|
106
|
+
digits = String(tol_minus).split(".");
|
|
103
107
|
|
|
104
108
|
LSL = Number(LSL).toFixed(digits[1].length);
|
|
105
109
|
}
|
|
@@ -118,8 +122,8 @@ export class Specification{
|
|
|
118
122
|
USL: USL ?? NaN,
|
|
119
123
|
LSL: LSL ?? NaN,
|
|
120
124
|
units: units,
|
|
121
|
-
|
|
122
|
-
|
|
125
|
+
tol_plus: tol_plus ?? NaN,
|
|
126
|
+
tol_minus: tol_minus ?? NaN
|
|
123
127
|
}
|
|
124
128
|
}
|
|
125
129
|
}
|
|
@@ -144,7 +148,7 @@ export class Specification{
|
|
|
144
148
|
}
|
|
145
149
|
|
|
146
150
|
toString(){
|
|
147
|
-
return `${this.nominal} ${(this.tolerance ? '± ' + this.tolerance : '+' + this.
|
|
151
|
+
return `${this.nominal} ${(this.tolerance ? '± ' + this.tolerance : '+' + this.tol_plus + '/-' + this.tol_minus)}`
|
|
148
152
|
}
|
|
149
153
|
}
|
|
150
154
|
|
|
@@ -3049,7 +3053,7 @@ function PlotPoint(ctx: any, value: Point, dataSetDisplay: CanvasDrawSettings, c
|
|
|
3049
3053
|
|
|
3050
3054
|
let x = ConvertToCanvasPt(value.x, chartSettings.axis.x.min, chartSettings.axis.x.max, chartSettings.width - chartSettings.margins.left - chartSettings.margins.right - padding.left - padding.right, chartSettings.axis.x);
|
|
3051
3055
|
let y = ConvertToCanvasPt(value.y, chartSettings.axis.y.max, chartSettings.axis.y.min, chartSettings.height - chartSettings.margins.top - chartSettings.margins.bottom - padding.top - padding.bottom, chartSettings.axis.y);
|
|
3052
|
-
if(y >= 0 && y <= chartSettings.height - chartSettings.margins.bottom && x >= 0 && x <= chartSettings.width - chartSettings.margins.right){
|
|
3056
|
+
if(y >= 0 && y <= chartSettings.height - chartSettings.margins.bottom - chartSettings.margins.top && x >= 0 && x <= chartSettings.width - chartSettings.margins.right - chartSettings.margins.left){
|
|
3053
3057
|
DrawPolygon(ctx, shape, x + chartSettings.margins.left + padding.left, y + chartSettings.margins.top + padding.top, shapeRadius);
|
|
3054
3058
|
}
|
|
3055
3059
|
ctx.fill();
|
|
@@ -3097,16 +3101,30 @@ function PlotLine(ctx: any, dataSet: DataSet, chartSettings: ChartSettings){
|
|
|
3097
3101
|
bottom: (chartSettings.axis.y.padding?.bottom ? chartSettings.axis.y.padding?.bottom : 0)
|
|
3098
3102
|
}
|
|
3099
3103
|
|
|
3104
|
+
let newPath = true;
|
|
3105
|
+
|
|
3100
3106
|
if(dataSet.line?.type === 'straight'){
|
|
3101
|
-
|
|
3102
|
-
let y = ConvertToCanvasPt(dataSet.values[0].y, chartSettings.axis.y.max, chartSettings.axis.y.min, chartSettings.height - chartSettings.margins.top - chartSettings.margins.bottom - padding.top - padding.bottom, chartSettings.axis.y);
|
|
3103
|
-
|
|
3104
|
-
ctx.moveTo(x + chartSettings.margins.left + padding.left, y + chartSettings.margins.top + padding.top)
|
|
3105
|
-
dataSet.values.forEach(value => {
|
|
3107
|
+
dataSet.values.forEach((value,i) => {
|
|
3106
3108
|
let x = ConvertToCanvasPt(value.x, chartSettings.axis.x.min, chartSettings.axis.x.max, chartSettings.width - chartSettings.margins.left - chartSettings.margins.right - padding.left - padding.right, chartSettings.axis.x);
|
|
3107
3109
|
let y = ConvertToCanvasPt(value.y, chartSettings.axis.y.max, chartSettings.axis.y.min, chartSettings.height - chartSettings.margins.top - chartSettings.margins.bottom - padding.top - padding.bottom, chartSettings.axis.y);
|
|
3108
|
-
|
|
3109
|
-
|
|
3110
|
+
|
|
3111
|
+
if(y < 0){
|
|
3112
|
+
y = 0
|
|
3113
|
+
}
|
|
3114
|
+
if(y > chartSettings.height - chartSettings.margins.bottom - chartSettings.margins.top){
|
|
3115
|
+
y = chartSettings.height - chartSettings.margins.bottom - chartSettings.margins.top;
|
|
3116
|
+
}
|
|
3117
|
+
if(x < 0){
|
|
3118
|
+
x = 0;
|
|
3119
|
+
}
|
|
3120
|
+
if(x > chartSettings.width - chartSettings.margins.right - chartSettings.margins.left){
|
|
3121
|
+
x = chartSettings.width - chartSettings.margins.right - chartSettings.margins.left
|
|
3122
|
+
}
|
|
3123
|
+
if(newPath){
|
|
3124
|
+
ctx.moveTo(x + chartSettings.margins.left + padding.left, y + chartSettings.margins.top + padding.top);
|
|
3125
|
+
newPath = false;
|
|
3126
|
+
}else{
|
|
3127
|
+
ctx.lineTo(x + chartSettings.margins.left + padding.left, y + chartSettings.margins.top + padding.top);
|
|
3110
3128
|
}
|
|
3111
3129
|
})
|
|
3112
3130
|
}
|
|
@@ -3943,26 +3961,37 @@ export function AnovaTableTwoWay(data: GRRData, interaction: boolean){
|
|
|
3943
3961
|
* @param tolerance The total tolerance spread = (USL - LSL)
|
|
3944
3962
|
* @param referenceValue The value used to evaluate bias. Generally historical mean or mean from other measurement equipment.
|
|
3945
3963
|
*/
|
|
3946
|
-
export function G1(data: any, tolerance:
|
|
3964
|
+
export function G1(data: any, tolerance: any, referenceValue?: number){
|
|
3965
|
+
if(typeof tolerance === "string"){
|
|
3966
|
+
tolerance = new Specification(tolerance).full_tolerance;
|
|
3967
|
+
}
|
|
3947
3968
|
let K = 20 // % of tolerance; DEFAULT: 20
|
|
3948
3969
|
let L = 6 // # Standard Deviations represent process spread; DEFAULT: 6
|
|
3949
3970
|
|
|
3950
|
-
let Xm = referenceValue;
|
|
3951
|
-
|
|
3952
3971
|
let XbarG = Mean(data);
|
|
3953
3972
|
let s = StDev.S(data);
|
|
3954
3973
|
|
|
3955
3974
|
let Cg = ((K/100)*tolerance)/(L*s);
|
|
3975
|
+
if(!referenceValue){
|
|
3976
|
+
return {
|
|
3977
|
+
Cg: Cg
|
|
3978
|
+
}
|
|
3979
|
+
}
|
|
3980
|
+
|
|
3981
|
+
let Xm = referenceValue;
|
|
3956
3982
|
let Cgk = ((K/200)*tolerance - Math.abs(XbarG - Xm))/((L/2)*s);
|
|
3957
3983
|
let Bias = XbarG - referenceValue;
|
|
3958
3984
|
let T = Math.sqrt(data.length)*Math.abs(Bias)/s
|
|
3959
3985
|
let P = Distributions.T.RightTail(T, data.length - 1)
|
|
3960
3986
|
return {
|
|
3961
|
-
|
|
3962
|
-
|
|
3963
|
-
|
|
3964
|
-
|
|
3965
|
-
|
|
3987
|
+
Cg: Cg,
|
|
3988
|
+
Cgk: Cgk,
|
|
3989
|
+
SV: s*6,
|
|
3990
|
+
bias: Bias,
|
|
3991
|
+
t: T,
|
|
3992
|
+
p: P,
|
|
3993
|
+
Var_Rpt: K/Cg,
|
|
3994
|
+
Var_RptBias: K/Cgk
|
|
3966
3995
|
}
|
|
3967
3996
|
}
|
|
3968
3997
|
|
|
@@ -4187,9 +4216,14 @@ export function VarianceComponents(ANOVA: any, data: GRRData){
|
|
|
4187
4216
|
}
|
|
4188
4217
|
|
|
4189
4218
|
|
|
4190
|
-
export function G1Graphs(data: any, tolerance:
|
|
4191
|
-
|
|
4219
|
+
export function G1Graphs(data: any, tolerance: any, referenceValue: number, name: string = "Results"){
|
|
4220
|
+
if(typeof tolerance === "string" && name === "Results"){
|
|
4221
|
+
name = tolerance
|
|
4222
|
+
tolerance = new Specification(tolerance).full_tolerance;
|
|
4223
|
+
};
|
|
4192
4224
|
|
|
4225
|
+
let g1Results = G1(data, tolerance, referenceValue);
|
|
4226
|
+
if(!referenceValue){referenceValue = Mean(data)}
|
|
4193
4227
|
// Create Data Set
|
|
4194
4228
|
let dataset = new DataSet(data.map((d: any, i: number) => {return new Point(i + 1, d)}))
|
|
4195
4229
|
dataset.line.type = 'straight';
|
package/package.json
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Added export for SV, %Var(Repeatability), & %Var(Repeatability&Bias) for G1()
|