Merge remote-tracking branch 'origin/master' into feature/1101

This commit is contained in:
Roman Galochkin 2020-03-04 13:28:16 +03:00
commit 6a2a3848a8
3 changed files with 58 additions and 15 deletions

View File

@ -20,23 +20,68 @@ let setup = dist =>
~sampleCount=10000, ~sampleCount=10000,
~outputXYPoints=2000, ~outputXYPoints=2000,
~truncateTo=Some(1000), ~truncateTo=Some(1000),
); )
|> E.O.React.fmapOrNull(distPlus => <DistPlusPlot distPlus />);
let distributions = () => let distributions = () =>
<div> <div>
<div> <div>
<h2> {"Single-Discrete" |> ReasonReact.string} </h2> <h2 className="text-gray-800 text-xl font-bold">
{"Initial Section" |> ReasonReact.string}
</h2>
<h3 className="text-gray-600 text-lg font-bold">
{"Continuous" |> ReasonReact.string}
</h3>
{setup(DistPlusIngredients.make(~guesstimatorString="5 to 20", ()))}
<h3 className="text-gray-600 text-lg font-bold">
{"Discrete" |> ReasonReact.string}
</h3>
{setup(
DistPlusIngredients.make(~guesstimatorString="floor(10 to 20)", ()),
)}
<h3 className="text-gray-600 text-lg font-bold">
{"Mixed" |> ReasonReact.string}
</h3>
{setup( {setup(
DistPlusIngredients.make( DistPlusIngredients.make(
~guesstimatorString= ~guesstimatorString="mm(5 to 20, floor(20 to 30), [.5,.5])",
"uniform(0,1) > 0.3 ? lognormal(6.652, -0.41): 0",
~domain=
RightLimited({xPoint: 50.0, excludingProbabilityMass: 0.3}),
(), (),
), ),
) )}
|> E.O.React.fmapOrNull(distPlus => <DistPlusPlot distPlus />)} <h2 className="text-gray-800 text-xl font-bold">
{"Over Time" |> ReasonReact.string}
</h2>
<h3 className="text-gray-600 text-lg font-bold">
{"Continuous" |> ReasonReact.string}
</h3>
{setup(
DistPlusIngredients.make(
~guesstimatorString="5 to 20",
~unit=TimeDistribution({zero: MomentRe.momentNow(), unit: `years}),
(),
),
)}
<h3 className="text-gray-600 text-lg font-bold">
{"Discrete" |> ReasonReact.string}
</h3>
{setup(
DistPlusIngredients.make(
~guesstimatorString="floor(10 to 20)",
~unit=TimeDistribution({zero: MomentRe.momentNow(), unit: `years}),
(),
),
)}
<h3 className="text-gray-600 text-lg font-bold">
{"Mixed" |> ReasonReact.string}
</h3>
{setup(
DistPlusIngredients.make(
~guesstimatorString="mm(5 to 20, floor(20 to 30), [.5,.5])",
~unit=TimeDistribution({zero: MomentRe.momentNow(), unit: `years}),
(),
),
)}
</div> </div>
</div>; </div>;
let entry = EntryTypes.(entry(~title="Pdf", ~render=distributions)); let entry = EntryTypes.(entry(~title="Pdf", ~render=distributions));

View File

@ -245,7 +245,7 @@ let make = (~distPlus: DistTypes.distPlus) => {
<button <button
className=button className=button
onClick={_ => dispatch(CHANGE_LOG(index))}> onClick={_ => dispatch(CHANGE_LOG(index))}>
{(state.log ? "log" : "linear") |> ReasonReact.string} {(config.log ? "x-log" : "x-linear") |> ReasonReact.string}
</button> </button>
<button <button
className=button className=button
@ -259,18 +259,18 @@ let make = (~distPlus: DistTypes.distPlus) => {
<button <button
className=button className=button
onClick={_ => dispatch(HEIGHT_INCREMENT(index))}> onClick={_ => dispatch(HEIGHT_INCREMENT(index))}>
{"Expand" |> ReasonReact.string} {"expand" |> ReasonReact.string}
</button> </button>
<button <button
className=button className=button
onClick={_ => dispatch(HEIGHT_DECREMENT(index))}> onClick={_ => dispatch(HEIGHT_DECREMENT(index))}>
{"Compress" |> ReasonReact.string} {"shrink" |> ReasonReact.string}
</button> </button>
{index != 0 {index != 0
? <button ? <button
className=button className=button
onClick={_ => dispatch(REMOVE_DIST(index))}> onClick={_ => dispatch(REMOVE_DIST(index))}>
{"Remove" |> ReasonReact.string} {"remove" |> ReasonReact.string}
</button> </button>
: ReasonReact.null} : ReasonReact.null}
</div> </div>

View File

@ -5,7 +5,6 @@ type chartConfig = {
}; };
type state = { type state = {
log: bool,
showStats: bool, showStats: bool,
showParams: bool, showParams: bool,
distributions: list(chartConfig), distributions: list(chartConfig),
@ -87,7 +86,6 @@ let reducer = (state: state, action: action) =>
}; };
let init = { let init = {
log: false,
showStats: false, showStats: false,
showParams: false, showParams: false,
distributions: [ distributions: [