Fixed bug that would not truncate correctly

This commit is contained in:
Ozzie Gooen 2020-04-19 17:44:53 +01:00
parent b14f1244c2
commit 747e3a6706
4 changed files with 6 additions and 4 deletions

View File

@ -146,6 +146,7 @@ module DemoDist = {
(),
);
let response = DistPlusRenderer.run(inputs);
Js.log(response);
switch (RenderTypes.DistPlusRenderer.Outputs.distplus(response)) {
| Some(distPlus) => <DistPlusPlot distPlus />
| _ =>

View File

@ -4,9 +4,10 @@ let truncateIfShould =
outputs: RenderTypes.ShapeRenderer.Combined.outputs,
dist,
) => {
let willTruncate =
shouldTruncate
&& RenderTypes.ShapeRenderer.Combined.methodUsed(outputs) == `Sampling
? dist |> Distributions.DistPlus.T.truncate(recommendedLength) : dist;
&& RenderTypes.ShapeRenderer.Combined.methodUsed(outputs) == `Sampling;
willTruncate ? dist |> Distributions.DistPlus.T.truncate(recommendedLength) : dist;
};
let run =

View File

@ -61,7 +61,7 @@ module ShapeRenderer = {
};
let methodUsed = ({symbolic, sampling}:outputs) => switch(symbolic, sampling){
| (Some(Ok(_)), _) => `Symbolic
| (None, Some({shape: Some(_)})) => `Sampling
| (_, Some({shape: Some(_)})) => `Sampling
| _ => `None
}
let getShape = (r: outputs) =>

View File

@ -1,4 +1,4 @@
// This transforms an array intesperced with spaces or newlines with a normally formatted one.
// This transforms an array intersperced with spaces or newlines with a normally formatted one.
// "3 4 5 3 2 1 " -> "[3,4,5,3,2,1]""
let formatMessyArray = str => {
let split = Js.String.splitByRe([%re "/\\n|\\r|\\s/"], str);