From 6c536183d484167cddaa385e907add3c009d2658 Mon Sep 17 00:00:00 2001 From: Ozzie Gooen Date: Mon, 24 Feb 2020 22:04:39 +0000 Subject: [PATCH] Fixed deadly tiny bugs --- showcase/entries/Continuous.re | 57 +------------------ src/components/charts/DistPlusPlot.re | 11 ++-- .../charts/DistributionPlot/distPlotD3.js | 10 +--- src/distributions/Distributions.re | 2 +- 4 files changed, 10 insertions(+), 70 deletions(-) diff --git a/showcase/entries/Continuous.re b/showcase/entries/Continuous.re index d33dae77..0406f5b8 100644 --- a/showcase/entries/Continuous.re +++ b/showcase/entries/Continuous.re @@ -20,7 +20,7 @@ let distributions = () =>

{"Single-Discrete" |> ReasonReact.string}

{setup( DistPlusIngredients.make( - ~guesstimatorString="floor(10 to 14)", + ~guesstimatorString="8 to 12, [.5,.5])", ~domain=Complete, (), ), @@ -28,60 +28,5 @@ let distributions = () => |> E.O.React.fmapOrNull(distPlus => )} ; -// |> E.O.React.fmapOrNull(distPlus => )} -// ) -// ), -// (), -// ~domain=Complete, -// ~guesstimatorString="(5 to 10)", -// DistPlusIngredients.make( -// {setup( -//

{"Continuous Only" |> ReasonReact.string}

-// |> E.O.React.fmapOrNull(distPlus => )} -// ) -// ), -// (), -// ~domain=Complete, -// ~guesstimatorString="floor(5 to 10)", -// DistPlusIngredients.make( -// {setup( -//

{"Discrete Only" |> ReasonReact.string}

-// |> E.O.React.fmapOrNull(distPlus => )} -// ) -// ), -// (), -// ~domain=Complete, -// ~guesstimatorString="mm(floor(10 to 15), 10 to 11, [.9,.1])", -// DistPlusIngredients.make( -// {setup( -//

{"Simple Mixed Distribution" |> ReasonReact.string}

-// |> E.O.React.fmapOrNull(distPlus => )} -// ) -// ), -// (), -// }), -// unit: `days, -// zero: MomentRe.momentNow(), -// DistTypes.TimeDistribution({ -// ~unit= -// ~domain=Complete, -// ~guesstimatorString="mm(floor(10 to 15), 10 to 11, [.9,.1])", -// DistPlusIngredients.make( -// {setup( -//

{"Complex Distribution Days" |> ReasonReact.string}

-// |> E.O.React.fmapOrNull(distPlus => )} -// ) -// ), -// (), -// }), -// unit: `years, -// zero: MomentRe.momentNow(), -// DistTypes.TimeDistribution({ -// ~unit= -// ~domain=Complete, -// ~guesstimatorString="mm(floor(10 to 15), 10 to 11, [.9,.1])", -// DistPlusIngredients.make( -// {setup( -//

{"Complex Distribution" |> ReasonReact.string}

let entry = EntryTypes.(entry(~title="Pdf", ~render=distributions)); \ No newline at end of file diff --git a/src/components/charts/DistPlusPlot.re b/src/components/charts/DistPlusPlot.re index 9924932d..1d8027f3 100644 --- a/src/components/charts/DistPlusPlot.re +++ b/src/components/charts/DistPlusPlot.re @@ -28,15 +28,16 @@ module IntegralChart = { let make = (~distPlus: DistTypes.distPlus, ~onHover) => { open Distributions.DistPlus; let integral = - Distributions.DistPlus.T.Integral.get(~cache=None, distPlus); + Distributions.DistPlus.T.toShape(distPlus) + |> Distributions.Shape.T.Integral.get(~cache=None); let continuous = integral - |> T.toContinuous - |> E.O.bind(_, Distributions.Continuous.toLinear) + |> Distributions.Continuous.toLinear |> E.O.fmap(Distributions.Continuous.getShape); - let minX = T.minX(integral); - let maxX = T.maxX(integral); + let minX = integral |> Distributions.Continuous.T.minX; + let maxX = integral |> Distributions.Continuous.T.maxX; let timeScale = distPlus.unit |> DistTypes.DistributionUnit.toJson; + Js.log3("HIHI", continuous, distPlus); update(~shape, t); // This bit is kind of akward, could probably use rethinking. - let integral = (~cache as _, t: t) => + let integral = (~cache, t: t) => updateShape(Continuous(t.integralCache), t); // todo: adjust for limit, maybe?