qesuite 1.0.29 → 1.0.30
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 +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +51 -16
- package/dist/index.mjs +50 -15
- package/package.json +1 -1
- package/versions/1_0_30.md +1 -0
package/dist/index.d.mts
CHANGED
|
@@ -846,7 +846,7 @@ declare function Sum(data: any[]): number;
|
|
|
846
846
|
* @customfunction
|
|
847
847
|
* @param data An array of numbers. The numbers can be supplied as number types or strings
|
|
848
848
|
*/
|
|
849
|
-
declare function
|
|
849
|
+
declare function Rang(data: any[]): number;
|
|
850
850
|
declare const UnbiasingConstant: {
|
|
851
851
|
/**
|
|
852
852
|
* Calculates the unbiasing constant based on the number N provided.
|
|
@@ -1134,4 +1134,4 @@ declare function GRRByPartChart(data: GRRData): HTMLCanvasElement;
|
|
|
1134
1134
|
declare function GRRPartxOperatorChart(data: GRRData): HTMLCanvasElement;
|
|
1135
1135
|
declare function CompileGRRObject(operators: any, parts: any, measurements: any): GRRData;
|
|
1136
1136
|
|
|
1137
|
-
export { AnovaTableTwoWay, AverageMovingRange, AxisSettings, Beta, CanvasDrawSettings, Capability, Chart, ChartSettings, CompileGRRObject, CreateBoxandWhiskerGraph, CreateCapabilityHistogram, CreateCapabilityPlot, CreateCategoricalBarGraph, CreateContinuousBarGraph, CreateScatterPlot, CreateSplitGraph, CreateStackedChart, CreateSummaryChart, CustomGridline, DataCollection, DataSet, Distributions, ERF, EngFont, FixedPointIteration, G1, G1Graphs, GRR, GRRByPartChart, GRRData, GRRGraphs, GRROperator, GRRPartxOperatorChart, GRRReplication, GageEvaluation, Gamma, GetFunctionValues, GetHistogramDataset, GoodnessOfFit, IndividualDistributionIdentification, IndividualDistributionPlots, IndividualValuePlot, LastObservationsChart, Line, Margin, MarkOutOfControl, MaximumLikelihoodParameters, Mean, Median, MovingRange, MovingRangeChart, NewtonRaphson, ObjectToArray, ParameterizedCDF, Point, QQPlot, QQPlotChart,
|
|
1137
|
+
export { AnovaTableTwoWay, AverageMovingRange, AxisSettings, Beta, CanvasDrawSettings, Capability, Chart, ChartSettings, CompileGRRObject, CreateBoxandWhiskerGraph, CreateCapabilityHistogram, CreateCapabilityPlot, CreateCategoricalBarGraph, CreateContinuousBarGraph, CreateScatterPlot, CreateSplitGraph, CreateStackedChart, CreateSummaryChart, CustomGridline, DataCollection, DataSet, Distributions, ERF, EngFont, FixedPointIteration, G1, G1Graphs, GRR, GRRByPartChart, GRRData, GRRGraphs, GRROperator, GRRPartxOperatorChart, GRRReplication, GageEvaluation, Gamma, GetFunctionValues, GetHistogramDataset, GoodnessOfFit, IndividualDistributionIdentification, IndividualDistributionPlots, IndividualValuePlot, LastObservationsChart, Line, Margin, MarkOutOfControl, MaximumLikelihoodParameters, Mean, Median, MovingRange, MovingRangeChart, NewtonRaphson, ObjectToArray, ParameterizedCDF, Point, QQPlot, QQPlotChart, Rang, RoundTO, SerializeData, Specification, StDev, Sum, UnbiasingConstant, VarianceComponents };
|
package/dist/index.d.ts
CHANGED
|
@@ -846,7 +846,7 @@ declare function Sum(data: any[]): number;
|
|
|
846
846
|
* @customfunction
|
|
847
847
|
* @param data An array of numbers. The numbers can be supplied as number types or strings
|
|
848
848
|
*/
|
|
849
|
-
declare function
|
|
849
|
+
declare function Rang(data: any[]): number;
|
|
850
850
|
declare const UnbiasingConstant: {
|
|
851
851
|
/**
|
|
852
852
|
* Calculates the unbiasing constant based on the number N provided.
|
|
@@ -1134,4 +1134,4 @@ declare function GRRByPartChart(data: GRRData): HTMLCanvasElement;
|
|
|
1134
1134
|
declare function GRRPartxOperatorChart(data: GRRData): HTMLCanvasElement;
|
|
1135
1135
|
declare function CompileGRRObject(operators: any, parts: any, measurements: any): GRRData;
|
|
1136
1136
|
|
|
1137
|
-
export { AnovaTableTwoWay, AverageMovingRange, AxisSettings, Beta, CanvasDrawSettings, Capability, Chart, ChartSettings, CompileGRRObject, CreateBoxandWhiskerGraph, CreateCapabilityHistogram, CreateCapabilityPlot, CreateCategoricalBarGraph, CreateContinuousBarGraph, CreateScatterPlot, CreateSplitGraph, CreateStackedChart, CreateSummaryChart, CustomGridline, DataCollection, DataSet, Distributions, ERF, EngFont, FixedPointIteration, G1, G1Graphs, GRR, GRRByPartChart, GRRData, GRRGraphs, GRROperator, GRRPartxOperatorChart, GRRReplication, GageEvaluation, Gamma, GetFunctionValues, GetHistogramDataset, GoodnessOfFit, IndividualDistributionIdentification, IndividualDistributionPlots, IndividualValuePlot, LastObservationsChart, Line, Margin, MarkOutOfControl, MaximumLikelihoodParameters, Mean, Median, MovingRange, MovingRangeChart, NewtonRaphson, ObjectToArray, ParameterizedCDF, Point, QQPlot, QQPlotChart,
|
|
1137
|
+
export { AnovaTableTwoWay, AverageMovingRange, AxisSettings, Beta, CanvasDrawSettings, Capability, Chart, ChartSettings, CompileGRRObject, CreateBoxandWhiskerGraph, CreateCapabilityHistogram, CreateCapabilityPlot, CreateCategoricalBarGraph, CreateContinuousBarGraph, CreateScatterPlot, CreateSplitGraph, CreateStackedChart, CreateSummaryChart, CustomGridline, DataCollection, DataSet, Distributions, ERF, EngFont, FixedPointIteration, G1, G1Graphs, GRR, GRRByPartChart, GRRData, GRRGraphs, GRROperator, GRRPartxOperatorChart, GRRReplication, GageEvaluation, Gamma, GetFunctionValues, GetHistogramDataset, GoodnessOfFit, IndividualDistributionIdentification, IndividualDistributionPlots, IndividualValuePlot, LastObservationsChart, Line, Margin, MarkOutOfControl, MaximumLikelihoodParameters, Mean, Median, MovingRange, MovingRangeChart, NewtonRaphson, ObjectToArray, ParameterizedCDF, Point, QQPlot, QQPlotChart, Rang, RoundTO, SerializeData, Specification, StDev, Sum, UnbiasingConstant, VarianceComponents };
|
package/dist/index.js
CHANGED
|
@@ -76,7 +76,7 @@ __export(QESuite_exports, {
|
|
|
76
76
|
Point: () => Point,
|
|
77
77
|
QQPlot: () => QQPlot,
|
|
78
78
|
QQPlotChart: () => QQPlotChart,
|
|
79
|
-
|
|
79
|
+
Rang: () => Rang,
|
|
80
80
|
RoundTO: () => RoundTO,
|
|
81
81
|
SerializeData: () => SerializeData,
|
|
82
82
|
Specification: () => Specification,
|
|
@@ -600,6 +600,7 @@ var Capability = {
|
|
|
600
600
|
let lastObservations = LastObservationsChart(data, 25, "Last 25 Observations");
|
|
601
601
|
let capabilityHistogram = CreateCapabilityHistogram(data, spec);
|
|
602
602
|
let capabilityPlot = CreateCapabilityPlot(data, spec);
|
|
603
|
+
console.log(Capability.Analysis(data, spec));
|
|
603
604
|
return {
|
|
604
605
|
charts: {
|
|
605
606
|
IndividualValue: individualValuePlot,
|
|
@@ -1498,7 +1499,7 @@ var Distributions = {
|
|
|
1498
1499
|
Test(data) {
|
|
1499
1500
|
let N = data.length;
|
|
1500
1501
|
let Z = [];
|
|
1501
|
-
let Y = data.sort(function(a, b) {
|
|
1502
|
+
let Y = [...data].sort(function(a, b) {
|
|
1502
1503
|
return a - b;
|
|
1503
1504
|
});
|
|
1504
1505
|
let numSum = 0;
|
|
@@ -1571,9 +1572,9 @@ var Distributions = {
|
|
|
1571
1572
|
},
|
|
1572
1573
|
KolmogorovSmirnov(data) {
|
|
1573
1574
|
let N = data.length;
|
|
1574
|
-
data.sort();
|
|
1575
|
-
let mean = Mean(
|
|
1576
|
-
let std = StDev.S(
|
|
1575
|
+
let sortedData = [...data].sort();
|
|
1576
|
+
let mean = Mean(sortedData);
|
|
1577
|
+
let std = StDev.S(sortedData);
|
|
1577
1578
|
let dMinusArray = [];
|
|
1578
1579
|
let dPlusArray = [];
|
|
1579
1580
|
for (let i = 1; i <= N; i++) {
|
|
@@ -1868,7 +1869,7 @@ var GoodnessOfFit = {
|
|
|
1868
1869
|
*/
|
|
1869
1870
|
AD(data, cdf) {
|
|
1870
1871
|
let N = data.length;
|
|
1871
|
-
let Y = data.sort(function(a, b) {
|
|
1872
|
+
let Y = [...data].sort(function(a, b) {
|
|
1872
1873
|
return a - b;
|
|
1873
1874
|
});
|
|
1874
1875
|
let S = 0;
|
|
@@ -1911,10 +1912,15 @@ var GoodnessOfFit = {
|
|
|
1911
1912
|
Test(data, cdf) {
|
|
1912
1913
|
let CDF;
|
|
1913
1914
|
if (typeof cdf === "string") {
|
|
1914
|
-
|
|
1915
|
+
if (GoodnessOfFit.Distributions[cdf]) {
|
|
1916
|
+
CDF = ParameterizedCDF(data, GoodnessOfFit.Distributions[cdf]);
|
|
1917
|
+
}
|
|
1915
1918
|
} else {
|
|
1916
1919
|
CDF = cdf;
|
|
1917
1920
|
}
|
|
1921
|
+
if (typeof CDF !== "function") {
|
|
1922
|
+
return { AD: void 0, p: void 0 };
|
|
1923
|
+
}
|
|
1918
1924
|
let AD = GoodnessOfFit.AndersonDarling.AD(data, CDF);
|
|
1919
1925
|
let p = GoodnessOfFit.AndersonDarling.p(AD, data.length);
|
|
1920
1926
|
return {
|
|
@@ -2032,8 +2038,8 @@ function IndividualDistributionPlots(data) {
|
|
|
2032
2038
|
gamma3p: QQPlotChart(data, "3-Parameter Gamma"),
|
|
2033
2039
|
largestExtremeValue: QQPlotChart(data, "Largest Extreme Value"),
|
|
2034
2040
|
logistic: QQPlotChart(data, "Logistic"),
|
|
2035
|
-
loglogistic: QQPlotChart(data, "LogLogistic"),
|
|
2036
|
-
lognormal: QQPlotChart(data, "LogNormal"),
|
|
2041
|
+
loglogistic: QQPlotChart(data, "2-Parameter LogLogistic"),
|
|
2042
|
+
lognormal: QQPlotChart(data, "2-Parameter LogNormal"),
|
|
2037
2043
|
smallestExtremeValue: QQPlotChart(data, "Smallest Extreme Value"),
|
|
2038
2044
|
weibull: QQPlotChart(data, "Weibull")
|
|
2039
2045
|
};
|
|
@@ -2044,7 +2050,7 @@ function IndividualDistributionPlots(data) {
|
|
|
2044
2050
|
}
|
|
2045
2051
|
var QQPlot = {
|
|
2046
2052
|
p(data, method = "Hazen") {
|
|
2047
|
-
let orderedData = data.sort();
|
|
2053
|
+
let orderedData = [...data].sort();
|
|
2048
2054
|
let PValues = [];
|
|
2049
2055
|
let N = orderedData.length;
|
|
2050
2056
|
for (let i = 1; i <= N; i++) {
|
|
@@ -2113,10 +2119,18 @@ function MovingRange(data, w = 2) {
|
|
|
2113
2119
|
for (let j = 0; j < w; j++) {
|
|
2114
2120
|
values.push(Number(data[h + j]));
|
|
2115
2121
|
}
|
|
2116
|
-
movingRange.push(
|
|
2122
|
+
movingRange.push(CalculateRange(values));
|
|
2117
2123
|
}
|
|
2118
2124
|
return movingRange;
|
|
2119
2125
|
}
|
|
2126
|
+
function CalculateRange(data) {
|
|
2127
|
+
let dataNumbers = data.map((d) => {
|
|
2128
|
+
return Number(d);
|
|
2129
|
+
});
|
|
2130
|
+
let max = Math.max(...dataNumbers);
|
|
2131
|
+
let min = Math.min(...dataNumbers);
|
|
2132
|
+
return max - min;
|
|
2133
|
+
}
|
|
2120
2134
|
var StDev = {
|
|
2121
2135
|
/**
|
|
2122
2136
|
* Calculates the population standard deviation of the array supplied.
|
|
@@ -2164,7 +2178,7 @@ function Sum(data) {
|
|
|
2164
2178
|
});
|
|
2165
2179
|
return sum;
|
|
2166
2180
|
}
|
|
2167
|
-
function
|
|
2181
|
+
function Rang(data) {
|
|
2168
2182
|
let dataNumbers = data.map((d) => {
|
|
2169
2183
|
return Number(d);
|
|
2170
2184
|
});
|
|
@@ -2502,13 +2516,13 @@ function SetCanvasTextProperties(ctx, font) {
|
|
|
2502
2516
|
ctx.font = `${font.font} ${font.fontSize}`;
|
|
2503
2517
|
ctx.fillStyle = font.fillColor;
|
|
2504
2518
|
}
|
|
2505
|
-
function AddInfoTable(ctx, data, x, y, width, height, title, font) {
|
|
2519
|
+
function AddInfoTable(ctx, data, x, y, width, height, title, lineHeight = 0, font) {
|
|
2506
2520
|
if (!font) {
|
|
2507
2521
|
font = new EngFont();
|
|
2508
2522
|
}
|
|
2509
2523
|
SetCanvasTextProperties(ctx, font);
|
|
2510
2524
|
ctx.beginPath();
|
|
2511
|
-
|
|
2525
|
+
lineHeight = lineHeight ? lineHeight : Number(font.fontSize.replace("px", "")) + 30;
|
|
2512
2526
|
ctx.textAlign = "center";
|
|
2513
2527
|
ctx.fillText(title, x + width / 2, y + Number(font.fontSize.replace("px", "")), width);
|
|
2514
2528
|
ctx.textAlign = "left";
|
|
@@ -3247,7 +3261,28 @@ function QQPlotChart(data, distribution = "Normal") {
|
|
|
3247
3261
|
return (x - params.location) / params.scale;
|
|
3248
3262
|
};
|
|
3249
3263
|
let middleLineChart = new Chart([], "function", "Middle Line", void 0, middleLine);
|
|
3250
|
-
|
|
3264
|
+
let chart = CreateStackedChart([middleLineChart, new Chart([dataset], "scatter")], `${distribution[0].toUpperCase()}${distribution.substring(1)} Probability Plot`, chartSettings);
|
|
3265
|
+
if (distribution.toLowerCase() === "normal" || distribution.toLowerCase().includes("boxcox")) {
|
|
3266
|
+
let AD = GoodnessOfFit.AndersonDarling.Test(data, GoodnessOfFit.Distributions.Normal);
|
|
3267
|
+
let RJ = Distributions.Normal.RyanJoiner.Test(data);
|
|
3268
|
+
let KS = Distributions.Normal.KolmogorovSmirnov(data);
|
|
3269
|
+
let JB = Distributions.Normal.JarqueBera(data);
|
|
3270
|
+
let ctx = chart.getContext("2d");
|
|
3271
|
+
if (ctx) {
|
|
3272
|
+
AddInfoTable(ctx, [{ key: "AD:", value: AD.AD }, { key: "p-value:", value: AD.p }, { key: "", value: "" }, { key: "RJ:", value: RJ.RJ }, { key: "crit.:", value: RJ.critical }, { key: "", value: "" }, { key: "KS:", value: KS.KS }, { key: "p-value:", value: KS.p }, { key: "", value: "" }, { key: "JB:", value: JB.JB }, { key: "p-value:", value: JB.p }], 1075, 150, 175, 100, "", 30);
|
|
3273
|
+
}
|
|
3274
|
+
} else {
|
|
3275
|
+
let dist = distribution.replace("-", "").replace("arameter", "").replace(/\s/g, "");
|
|
3276
|
+
if (dist.includes("2P")) {
|
|
3277
|
+
dist = dist.replace("2P", "").concat("2P");
|
|
3278
|
+
}
|
|
3279
|
+
let AD = GoodnessOfFit.AndersonDarling.Test(data, dist);
|
|
3280
|
+
let ctx = chart.getContext("2d");
|
|
3281
|
+
if (ctx && (AD.AD || AD.AD === Infinity || Number.isNaN(AD.AD)) && (AD.p || AD.p === Infinity || Number.isNaN(AD.p))) {
|
|
3282
|
+
AddInfoTable(ctx, [{ key: "AD:", value: AD.AD }, { key: "p-value:", value: AD.p }], 1075, 150, 175, 100, "", 30);
|
|
3283
|
+
}
|
|
3284
|
+
}
|
|
3285
|
+
return chart;
|
|
3251
3286
|
}
|
|
3252
3287
|
function QQDistributionModification(p, distribution) {
|
|
3253
3288
|
if (distribution.toLowerCase().includes("weibull")) {
|
|
@@ -4002,7 +4037,7 @@ function SplitObjectArrayByProp(array, prop) {
|
|
|
4002
4037
|
Point,
|
|
4003
4038
|
QQPlot,
|
|
4004
4039
|
QQPlotChart,
|
|
4005
|
-
|
|
4040
|
+
Rang,
|
|
4006
4041
|
RoundTO,
|
|
4007
4042
|
SerializeData,
|
|
4008
4043
|
Specification,
|
package/dist/index.mjs
CHANGED
|
@@ -513,6 +513,7 @@ var Capability = {
|
|
|
513
513
|
let lastObservations = LastObservationsChart(data, 25, "Last 25 Observations");
|
|
514
514
|
let capabilityHistogram = CreateCapabilityHistogram(data, spec);
|
|
515
515
|
let capabilityPlot = CreateCapabilityPlot(data, spec);
|
|
516
|
+
console.log(Capability.Analysis(data, spec));
|
|
516
517
|
return {
|
|
517
518
|
charts: {
|
|
518
519
|
IndividualValue: individualValuePlot,
|
|
@@ -1411,7 +1412,7 @@ var Distributions = {
|
|
|
1411
1412
|
Test(data) {
|
|
1412
1413
|
let N = data.length;
|
|
1413
1414
|
let Z = [];
|
|
1414
|
-
let Y = data.sort(function(a, b) {
|
|
1415
|
+
let Y = [...data].sort(function(a, b) {
|
|
1415
1416
|
return a - b;
|
|
1416
1417
|
});
|
|
1417
1418
|
let numSum = 0;
|
|
@@ -1484,9 +1485,9 @@ var Distributions = {
|
|
|
1484
1485
|
},
|
|
1485
1486
|
KolmogorovSmirnov(data) {
|
|
1486
1487
|
let N = data.length;
|
|
1487
|
-
data.sort();
|
|
1488
|
-
let mean = Mean(
|
|
1489
|
-
let std = StDev.S(
|
|
1488
|
+
let sortedData = [...data].sort();
|
|
1489
|
+
let mean = Mean(sortedData);
|
|
1490
|
+
let std = StDev.S(sortedData);
|
|
1490
1491
|
let dMinusArray = [];
|
|
1491
1492
|
let dPlusArray = [];
|
|
1492
1493
|
for (let i = 1; i <= N; i++) {
|
|
@@ -1781,7 +1782,7 @@ var GoodnessOfFit = {
|
|
|
1781
1782
|
*/
|
|
1782
1783
|
AD(data, cdf) {
|
|
1783
1784
|
let N = data.length;
|
|
1784
|
-
let Y = data.sort(function(a, b) {
|
|
1785
|
+
let Y = [...data].sort(function(a, b) {
|
|
1785
1786
|
return a - b;
|
|
1786
1787
|
});
|
|
1787
1788
|
let S = 0;
|
|
@@ -1824,10 +1825,15 @@ var GoodnessOfFit = {
|
|
|
1824
1825
|
Test(data, cdf) {
|
|
1825
1826
|
let CDF;
|
|
1826
1827
|
if (typeof cdf === "string") {
|
|
1827
|
-
|
|
1828
|
+
if (GoodnessOfFit.Distributions[cdf]) {
|
|
1829
|
+
CDF = ParameterizedCDF(data, GoodnessOfFit.Distributions[cdf]);
|
|
1830
|
+
}
|
|
1828
1831
|
} else {
|
|
1829
1832
|
CDF = cdf;
|
|
1830
1833
|
}
|
|
1834
|
+
if (typeof CDF !== "function") {
|
|
1835
|
+
return { AD: void 0, p: void 0 };
|
|
1836
|
+
}
|
|
1831
1837
|
let AD = GoodnessOfFit.AndersonDarling.AD(data, CDF);
|
|
1832
1838
|
let p = GoodnessOfFit.AndersonDarling.p(AD, data.length);
|
|
1833
1839
|
return {
|
|
@@ -1945,8 +1951,8 @@ function IndividualDistributionPlots(data) {
|
|
|
1945
1951
|
gamma3p: QQPlotChart(data, "3-Parameter Gamma"),
|
|
1946
1952
|
largestExtremeValue: QQPlotChart(data, "Largest Extreme Value"),
|
|
1947
1953
|
logistic: QQPlotChart(data, "Logistic"),
|
|
1948
|
-
loglogistic: QQPlotChart(data, "LogLogistic"),
|
|
1949
|
-
lognormal: QQPlotChart(data, "LogNormal"),
|
|
1954
|
+
loglogistic: QQPlotChart(data, "2-Parameter LogLogistic"),
|
|
1955
|
+
lognormal: QQPlotChart(data, "2-Parameter LogNormal"),
|
|
1950
1956
|
smallestExtremeValue: QQPlotChart(data, "Smallest Extreme Value"),
|
|
1951
1957
|
weibull: QQPlotChart(data, "Weibull")
|
|
1952
1958
|
};
|
|
@@ -1957,7 +1963,7 @@ function IndividualDistributionPlots(data) {
|
|
|
1957
1963
|
}
|
|
1958
1964
|
var QQPlot = {
|
|
1959
1965
|
p(data, method = "Hazen") {
|
|
1960
|
-
let orderedData = data.sort();
|
|
1966
|
+
let orderedData = [...data].sort();
|
|
1961
1967
|
let PValues = [];
|
|
1962
1968
|
let N = orderedData.length;
|
|
1963
1969
|
for (let i = 1; i <= N; i++) {
|
|
@@ -2026,10 +2032,18 @@ function MovingRange(data, w = 2) {
|
|
|
2026
2032
|
for (let j = 0; j < w; j++) {
|
|
2027
2033
|
values.push(Number(data[h + j]));
|
|
2028
2034
|
}
|
|
2029
|
-
movingRange.push(
|
|
2035
|
+
movingRange.push(CalculateRange(values));
|
|
2030
2036
|
}
|
|
2031
2037
|
return movingRange;
|
|
2032
2038
|
}
|
|
2039
|
+
function CalculateRange(data) {
|
|
2040
|
+
let dataNumbers = data.map((d) => {
|
|
2041
|
+
return Number(d);
|
|
2042
|
+
});
|
|
2043
|
+
let max = Math.max(...dataNumbers);
|
|
2044
|
+
let min = Math.min(...dataNumbers);
|
|
2045
|
+
return max - min;
|
|
2046
|
+
}
|
|
2033
2047
|
var StDev = {
|
|
2034
2048
|
/**
|
|
2035
2049
|
* Calculates the population standard deviation of the array supplied.
|
|
@@ -2077,7 +2091,7 @@ function Sum(data) {
|
|
|
2077
2091
|
});
|
|
2078
2092
|
return sum;
|
|
2079
2093
|
}
|
|
2080
|
-
function
|
|
2094
|
+
function Rang(data) {
|
|
2081
2095
|
let dataNumbers = data.map((d) => {
|
|
2082
2096
|
return Number(d);
|
|
2083
2097
|
});
|
|
@@ -2415,13 +2429,13 @@ function SetCanvasTextProperties(ctx, font) {
|
|
|
2415
2429
|
ctx.font = `${font.font} ${font.fontSize}`;
|
|
2416
2430
|
ctx.fillStyle = font.fillColor;
|
|
2417
2431
|
}
|
|
2418
|
-
function AddInfoTable(ctx, data, x, y, width, height, title, font) {
|
|
2432
|
+
function AddInfoTable(ctx, data, x, y, width, height, title, lineHeight = 0, font) {
|
|
2419
2433
|
if (!font) {
|
|
2420
2434
|
font = new EngFont();
|
|
2421
2435
|
}
|
|
2422
2436
|
SetCanvasTextProperties(ctx, font);
|
|
2423
2437
|
ctx.beginPath();
|
|
2424
|
-
|
|
2438
|
+
lineHeight = lineHeight ? lineHeight : Number(font.fontSize.replace("px", "")) + 30;
|
|
2425
2439
|
ctx.textAlign = "center";
|
|
2426
2440
|
ctx.fillText(title, x + width / 2, y + Number(font.fontSize.replace("px", "")), width);
|
|
2427
2441
|
ctx.textAlign = "left";
|
|
@@ -3160,7 +3174,28 @@ function QQPlotChart(data, distribution = "Normal") {
|
|
|
3160
3174
|
return (x - params.location) / params.scale;
|
|
3161
3175
|
};
|
|
3162
3176
|
let middleLineChart = new Chart([], "function", "Middle Line", void 0, middleLine);
|
|
3163
|
-
|
|
3177
|
+
let chart = CreateStackedChart([middleLineChart, new Chart([dataset], "scatter")], `${distribution[0].toUpperCase()}${distribution.substring(1)} Probability Plot`, chartSettings);
|
|
3178
|
+
if (distribution.toLowerCase() === "normal" || distribution.toLowerCase().includes("boxcox")) {
|
|
3179
|
+
let AD = GoodnessOfFit.AndersonDarling.Test(data, GoodnessOfFit.Distributions.Normal);
|
|
3180
|
+
let RJ = Distributions.Normal.RyanJoiner.Test(data);
|
|
3181
|
+
let KS = Distributions.Normal.KolmogorovSmirnov(data);
|
|
3182
|
+
let JB = Distributions.Normal.JarqueBera(data);
|
|
3183
|
+
let ctx = chart.getContext("2d");
|
|
3184
|
+
if (ctx) {
|
|
3185
|
+
AddInfoTable(ctx, [{ key: "AD:", value: AD.AD }, { key: "p-value:", value: AD.p }, { key: "", value: "" }, { key: "RJ:", value: RJ.RJ }, { key: "crit.:", value: RJ.critical }, { key: "", value: "" }, { key: "KS:", value: KS.KS }, { key: "p-value:", value: KS.p }, { key: "", value: "" }, { key: "JB:", value: JB.JB }, { key: "p-value:", value: JB.p }], 1075, 150, 175, 100, "", 30);
|
|
3186
|
+
}
|
|
3187
|
+
} else {
|
|
3188
|
+
let dist = distribution.replace("-", "").replace("arameter", "").replace(/\s/g, "");
|
|
3189
|
+
if (dist.includes("2P")) {
|
|
3190
|
+
dist = dist.replace("2P", "").concat("2P");
|
|
3191
|
+
}
|
|
3192
|
+
let AD = GoodnessOfFit.AndersonDarling.Test(data, dist);
|
|
3193
|
+
let ctx = chart.getContext("2d");
|
|
3194
|
+
if (ctx && (AD.AD || AD.AD === Infinity || Number.isNaN(AD.AD)) && (AD.p || AD.p === Infinity || Number.isNaN(AD.p))) {
|
|
3195
|
+
AddInfoTable(ctx, [{ key: "AD:", value: AD.AD }, { key: "p-value:", value: AD.p }], 1075, 150, 175, 100, "", 30);
|
|
3196
|
+
}
|
|
3197
|
+
}
|
|
3198
|
+
return chart;
|
|
3164
3199
|
}
|
|
3165
3200
|
function QQDistributionModification(p, distribution) {
|
|
3166
3201
|
if (distribution.toLowerCase().includes("weibull")) {
|
|
@@ -3914,7 +3949,7 @@ export {
|
|
|
3914
3949
|
Point,
|
|
3915
3950
|
QQPlot,
|
|
3916
3951
|
QQPlotChart,
|
|
3917
|
-
|
|
3952
|
+
Rang,
|
|
3918
3953
|
RoundTO,
|
|
3919
3954
|
SerializeData,
|
|
3920
3955
|
Specification,
|
package/package.json
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Build of version 1_0_29. See for details
|