From bdeb53a6c4ea3f76e2b8a8db5234aeb4b37320d1 Mon Sep 17 00:00:00 2001 From: Ozzie Gooen Date: Tue, 3 Mar 2020 19:25:06 +0000 Subject: [PATCH] Initial buttons --- src/components/charts/DistPlusPlot.re | 58 ++++++++++++++++-------- src/distributions/DistPlusIngredients.re | 2 +- src/interface/FormBuilder.re | 4 +- 3 files changed, 43 insertions(+), 21 deletions(-) diff --git a/src/components/charts/DistPlusPlot.re b/src/components/charts/DistPlusPlot.re index 32be15ad..139606be 100644 --- a/src/components/charts/DistPlusPlot.re +++ b/src/components/charts/DistPlusPlot.re @@ -1,14 +1,22 @@ type state = { log: bool, showStats: bool, + showParams: bool, height: int, }; type action = | CHANGE_LOG | CHANGE_SHOW_STATS + | CHANGE_SHOW_PARAMS | CHANGE_HEIGHT(int); +let showAsForm = (distPlus: DistTypes.distPlus) => { +
+ E.O.default("")} /> +
; +}; + let table = (distPlus, x) => {
@@ -207,6 +215,8 @@ module IntegralChart = { }; }; +let button = "bg-gray-300 hover:bg-gray-500 text-grey-darkest text-xs px-4 py-1"; + [@react.component] let make = (~distPlus: DistTypes.distPlus) => { let (x, setX) = React.useState(() => 0.); @@ -217,8 +227,9 @@ let make = (~distPlus: DistTypes.distPlus) => { | CHANGE_LOG => {...state, log: !state.log} | CHANGE_HEIGHT(height) => {...state, height} | CHANGE_SHOW_STATS => {...state, showStats: !state.showStats} + | CHANGE_SHOW_PARAMS => {...state, showParams: !state.showParams} }, - {log: false, height: 80, showStats: false}, + {log: false, height: 80, showStats: false, showParams: false}, ); let chart = React.useMemo2( @@ -231,25 +242,36 @@ let make = (~distPlus: DistTypes.distPlus) => { [|distPlus|], );
-
dispatch(CHANGE_LOG)}> - {(state.log ? "true" : "False") |> ReasonReact.string} -
-
dispatch(CHANGE_SHOW_STATS)}> - {"Stats" |> ReasonReact.string} -
-
dispatch(CHANGE_HEIGHT(state.height + 40))}> - {"HightPlus" |> ReasonReact.string} -
-
- dispatch( - CHANGE_HEIGHT(state.height < 81 ? state.height : state.height - 40), - ) - }> - {"HightMinus" |> ReasonReact.string} -
chart chart2 +
+ + + + + +
+ {state.showParams ? showAsForm(distPlus) : ReasonReact.null} {state.showStats ? table(distPlus, x) : ReasonReact.null}
; // chart diff --git a/src/distributions/DistPlusIngredients.re b/src/distributions/DistPlusIngredients.re index 9882b917..2f6be1a1 100644 --- a/src/distributions/DistPlusIngredients.re +++ b/src/distributions/DistPlusIngredients.re @@ -31,7 +31,7 @@ let toDistPlus = ~shape=_, ~domain=t.domain, ~unit=t.unit, - ~guesstimatorString=None, + ~guesstimatorString=Some(t.guesstimatorString), (), ), ) diff --git a/src/interface/FormBuilder.re b/src/interface/FormBuilder.re index 35f61608..94e7b4cb 100644 --- a/src/interface/FormBuilder.re +++ b/src/interface/FormBuilder.re @@ -20,8 +20,8 @@ let propValue = (t: Prop.Value.t) => { | DistPlusIngredients((r: DistTypes.distPlusIngredients)) => let newDistribution = DistPlusIngredients.toDistPlus( - ~sampleCount=2000, - ~outputXYPoints=1000, + ~sampleCount=1000, + ~outputXYPoints=2000, ~truncateTo=Some(500), r, );