Show errors in FunctionChart
This commit is contained in:
parent
f63c775cb6
commit
382733e6f3
|
@ -216,41 +216,57 @@ export const FunctionChart: React.FC<{
|
||||||
) : (
|
) : (
|
||||||
<></>
|
<></>
|
||||||
);
|
);
|
||||||
let data = _rangeByCount(diagramStart, diagramStop, diagramCount)
|
let data1 = _rangeByCount(diagramStart, diagramStop, diagramCount);
|
||||||
|
let valueData = data1
|
||||||
.map((x) => {
|
.map((x) => {
|
||||||
let result = distPlusFn(x);
|
let result = distPlusFn(x);
|
||||||
if (result.tag === "Ok") {
|
if (result.tag === "Ok") {
|
||||||
let percentiles = getPercentiles(percentileArray, result.value);
|
return { x: x, value: result.value };
|
||||||
return {
|
} else return null;
|
||||||
x: x,
|
})
|
||||||
p1: percentiles[0],
|
.filter((x) => x !== null)
|
||||||
p5: percentiles[1],
|
.map(({ x, value }) => {
|
||||||
p10: percentiles[2],
|
let percentiles = getPercentiles(percentileArray, value);
|
||||||
p20: percentiles[3],
|
return {
|
||||||
p30: percentiles[4],
|
x: x,
|
||||||
p40: percentiles[5],
|
p1: percentiles[0],
|
||||||
p50: percentiles[6],
|
p5: percentiles[1],
|
||||||
p60: percentiles[7],
|
p10: percentiles[2],
|
||||||
p70: percentiles[8],
|
p20: percentiles[3],
|
||||||
p80: percentiles[9],
|
p30: percentiles[4],
|
||||||
p90: percentiles[10],
|
p40: percentiles[5],
|
||||||
p95: percentiles[11],
|
p50: percentiles[6],
|
||||||
p99: percentiles[12],
|
p60: percentiles[7],
|
||||||
};
|
p70: percentiles[8],
|
||||||
} else {
|
p80: percentiles[9],
|
||||||
console.log("Error", x, result);
|
p90: percentiles[10],
|
||||||
return null;
|
p95: percentiles[11],
|
||||||
}
|
p99: percentiles[12],
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
let errorData = data1
|
||||||
|
.map((x) => {
|
||||||
|
let result = distPlusFn(x);
|
||||||
|
if (result.tag === "Error") {
|
||||||
|
return { x: x, error: result.value };
|
||||||
|
} else return null;
|
||||||
})
|
})
|
||||||
.filter((x) => x !== null);
|
.filter((x) => x !== null);
|
||||||
|
let error2 = _.groupBy(errorData, (x) => x.error);
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<SquigglePercentilesChart
|
<SquigglePercentilesChart
|
||||||
data={{ facet: data }}
|
data={{ facet: valueData }}
|
||||||
actions={false}
|
actions={false}
|
||||||
signalListeners={signalListeners}
|
signalListeners={signalListeners}
|
||||||
/>
|
/>
|
||||||
{showChart}
|
{showChart}
|
||||||
|
{_.keysIn(error2).map((k) => (
|
||||||
|
<ShowError heading={k}>
|
||||||
|
{`Values: [${error2[k].map((r) => r.x.toFixed(2)).join(",")}]`}
|
||||||
|
</ShowError>
|
||||||
|
))}
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
@ -308,7 +324,6 @@ export const SquiggleChart: React.FC<SquiggleChartProps> = ({
|
||||||
// At this point, we came across an error. What was our error?
|
// At this point, we came across an error. What was our error?
|
||||||
return <ShowError heading={"Parse Error"}>{result.value}</ShowError>;
|
return <ShowError heading={"Parse Error"}>{result.value}</ShowError>;
|
||||||
}
|
}
|
||||||
return <p>{"Invalid Response"}</p>;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
function getPercentiles(percentiles: number[], t: DistPlus) {
|
function getPercentiles(percentiles: number[], t: DistPlus) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user