diff --git a/showcase/entries/Continuous.re b/showcase/entries/Continuous.re index 4f1c3563..0c9a5eae 100644 --- a/showcase/entries/Continuous.re +++ b/showcase/entries/Continuous.re @@ -6,7 +6,8 @@ let data: DistributionTypes.xyShape = { // "mm(floor(uniform(30,35)), normal(50,20), [.25,.5])", let timeDist = GenericDistribution.make( - ~generationSource=GuesstimatorString("floor(normal(30,3))"), + ~generationSource= + GuesstimatorString("mm(floor(normal(30,3)), normal(39,1), [.5,.5])"), ~probabilityType=Pdf, ~domain=Complete, ~unit=TimeDistribution({zero: MomentRe.momentNow(), unit: `days}), @@ -24,14 +25,5 @@ let distributions = () =>

{"Simple Continuous" |> ReasonReact.string}

; -// -//
-//

{"Time Distribution" |> ReasonReact.string}

-// -//
-//
-//

{"Domain Limited Distribution" |> ReasonReact.string}

-// -//
let entry = EntryTypes.(entry(~title="Pdf", ~render=distributions)); \ No newline at end of file diff --git a/src/core/Shape.re b/src/core/Shape.re index b3537574..9a9922d2 100644 --- a/src/core/Shape.re +++ b/src/core/Shape.re @@ -197,8 +197,9 @@ module Mixed = { let minX = (t: DistributionTypes.mixedShape) => min(t.continuous |> Continuous.minX, t.discrete |> Discrete.minX); - let maxX = (t: DistributionTypes.mixedShape) => - min(t.continuous |> Continuous.maxX, t.discrete |> Discrete.maxX); + let maxX = (t: DistributionTypes.mixedShape) => { + max(t.continuous |> Continuous.maxX, t.discrete |> Discrete.maxX); + }; let mixedMultiply = ( diff --git a/src/interface/FormBuilder.re b/src/interface/FormBuilder.re index 377e902b..ac779529 100644 --- a/src/interface/FormBuilder.re +++ b/src/interface/FormBuilder.re @@ -21,19 +21,10 @@ let propValue = (t: Prop.Value.t) => { let newDistribution = GenericDistribution.renderIfNeeded(~sampleCount=1000, r); switch (newDistribution) { - | Some({ - generationSource: - Shape( - Mixed({ - continuous: n, - discrete: d, - discreteProbabilityMassFraction: f, - }), - ), - }) => + | Some(distribution) =>
- Shape.Continuous.toJs} /> - {d |> Shape.Discrete.scaleYToTotal(f) |> Shape.Discrete.render} + {GenericDistribution.normalize(distribution) + |> E.O.React.fmapOrNull(dist => )}
| None => "Something went wrong" |> ReasonReact.string | _ =>