diff --git a/src/DistBuilder.re b/src/DistBuilder.re
index d951856a..fd0b0cd2 100644
--- a/src/DistBuilder.re
+++ b/src/DistBuilder.re
@@ -40,6 +40,8 @@ module Styles = {
open Css;
let row =
style([display(`flex), selector("div > div", [flex(`num(1.))])]);
+ let form = style([backgroundColor(hex("eee")), padding(em(1.))]);
+ let spacer = style([marginTop(em(3.))]);
};
module FieldFloat = {
@@ -70,8 +72,8 @@ let make = () => {
~initialState={
guesstimatorString: "mm(5 to 20, floor(normal(20,2)), [.5, .5])",
domainType: "Complete",
- xPoint: "0.0",
- excludingProbabilityMass: "",
+ xPoint: "50.0",
+ excludingProbabilityMass: "0.3",
unitType: "UnspecifiedDistribution",
zero: MomentRe.momentNow(),
unit: "days",
@@ -84,125 +86,179 @@ let make = () => {
reform.submit();
};
-
-
-
-
-
-
- E.ste}>
- e |> handleChange}>
-
- {"Complete" |> E.ste}
-
-
- {"LeftLimited" |> E.ste}
-
-
- {"RightLimited" |> E.ste}
-
-
- {"LeftAndRightLimited" |> E.ste}
-
-
-
- }
- />
-
-
-
-
-
-
-
-
-
- E.ste}>
- e |> handleChange}>
-
- {"UnspecifiedDistribution" |> E.ste}
-
-
- {"TimeDistribution" |> E.ste}
-
-
-
- }
- />
-
-
-
- E.ste}>
- {
- e |> handleChange;
+ let domain =
+ switch (reform.state.values.domainType) {
+ | "Complete" => DistTypes.Complete
+ | "LeftLimited" =>
+ LeftLimited({
+ xPoint: reform.state.values.xPoint |> float_of_string,
+ excludingProbabilityMass:
+ reform.state.values.excludingProbabilityMass |> float_of_string,
+ })
+ | "RightLimited" =>
+ RightLimited({
+ xPoint: reform.state.values.xPoint |> float_of_string,
+ excludingProbabilityMass:
+ reform.state.values.excludingProbabilityMass |> float_of_string,
+ })
+ | "LeftAndRightLimited" =>
+ LeftAndRightLimited(
+ {
+ xPoint: reform.state.values.xPoint |> float_of_string,
+ excludingProbabilityMass:
+ reform.state.values.excludingProbabilityMass |> float_of_string,
+ },
+ {
+ xPoint: reform.state.values.xPoint |> float_of_string,
+ excludingProbabilityMass:
+ reform.state.values.excludingProbabilityMass |> float_of_string,
+ },
+ )
+ | _ => Js.Exn.raiseError("domain is unknown")
+ };
- _ => ();
- }}
- />
-
- }
- />
-
-
-
- E.ste}>
- e |> handleChange}>
-
- {"days" |> E.ste}
-
-
- {"hours" |> E.ste}
-
-
- {"milliseconds" |> E.ste}
-
-
- {"minutes" |> E.ste}
-
-
- {"months" |> E.ste}
-
-
- {"quarters" |> E.ste}
-
-
- {"seconds" |> E.ste}
-
-
- {"weeks" |> E.ste}
-
-
- {"years" |> E.ste}
-
-
-
- }
- />
-
+ let unit =
+ switch (reform.state.values.unitType) {
+ | "UnspecifiedDistribution" => DistTypes.UnspecifiedDistribution
+ | "TimeDistribution" =>
+ TimeDistribution({
+ zero: reform.state.values.zero,
+ unit: reform.state.values.unit |> TimeTypes.TimeUnit.ofString,
+ })
+ | _ => Js.Exn.raiseError("unit is unknown")
+ };
+
+ let guesstimatorString = reform.state.values.guesstimatorString;
+
+
+
+
+
+ {DistPlusIngredients.make(~guesstimatorString, ~domain, ~unit, ())
+ |> DistPlusIngredients.toDistPlus(
+ ~sampleCount=10000,
+ ~outputXYPoints=2000,
+ ~truncateTo=Some(1000),
+ )
+ |> E.O.React.fmapOrNull(distPlus => )}
-
- {reform.state.formState == Submitting
- ? "Loading" |> E.ste
- :
- {"Submit" |> E.ste}
- }
-
-
- ;
+
+
+
+
+
+
+
+
+
+ E.ste}>
+ e |> handleChange}>
+
+ {"Complete" |> E.ste}
+
+
+ {"LeftLimited" |> E.ste}
+
+
+ {"RightLimited" |> E.ste}
+
+
+ {"LeftAndRightLimited" |> E.ste}
+
+
+
+ }
+ />
+
+
+
+
+
+
+
+
+
+ E.ste}>
+ e |> handleChange}>
+
+ {"UnspecifiedDistribution" |> E.ste}
+
+
+ {"TimeDistribution" |> E.ste}
+
+
+
+ }
+ />
+
+
+
+ E.ste}>
+ {
+ e |> handleChange;
+
+ _ => ();
+ }}
+ />
+
+ }
+ />
+
+
+
+ E.ste}>
+ e |> handleChange}>
+
+ {"days" |> E.ste}
+
+
+ {"hours" |> E.ste}
+
+
+ {"milliseconds" |> E.ste}
+
+
+ {"minutes" |> E.ste}
+
+
+ {"months" |> E.ste}
+
+
+ {"quarters" |> E.ste}
+
+
+ {"seconds" |> E.ste}
+
+
+ {"weeks" |> E.ste}
+
+
+ {"years" |> E.ste}
+
+
+
+ }
+ />
+
+
+
+
+
+
;
};
diff --git a/src/distributions/TimeTypes.re b/src/distributions/TimeTypes.re
index 7a8368e0..3340ea32 100644
--- a/src/distributions/TimeTypes.re
+++ b/src/distributions/TimeTypes.re
@@ -33,6 +33,20 @@ module TimeUnit = {
| `weeks => "weeks"
| `years => "years"
};
+
+ let ofString = (timeUnit: string) =>
+ switch (timeUnit) {
+ | "days" => `days
+ | "hours" => `hours
+ | "milliseconds" => `milliseconds
+ | "minutes" => `minutes
+ | "months" => `months
+ | "quarters" => `quarters
+ | "seconds" => `seconds
+ | "weeks" => `weeks
+ | "years" => `years
+ | _ => Js.Exn.raiseError("TimeUnit is unknown")
+ };
};
module TimePoint = {
@@ -72,4 +86,4 @@ module RelativeTimePoint = {
| Time(r) => _timeToX(r, timeVector.zero, timeVector.unit)
| XValue(r) => r
};
-};
\ No newline at end of file
+};