Fixed deadly tiny bugs

This commit is contained in:
Ozzie Gooen 2020-02-24 22:04:39 +00:00
parent 2a9b83b16c
commit 6c536183d4
4 changed files with 10 additions and 70 deletions

View File

@ -20,7 +20,7 @@ let distributions = () =>
<h2> {"Single-Discrete" |> ReasonReact.string} </h2>
{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 => <DistPlusPlot distPlus />)}
</div>
</div>;
// |> E.O.React.fmapOrNull(distPlus => <DistPlusPlot distPlus />)}
// )
// ),
// (),
// ~domain=Complete,
// ~guesstimatorString="(5 to 10)",
// DistPlusIngredients.make(
// {setup(
// <h2> {"Continuous Only" |> ReasonReact.string} </h2>
// |> E.O.React.fmapOrNull(distPlus => <DistPlusPlot distPlus />)}
// )
// ),
// (),
// ~domain=Complete,
// ~guesstimatorString="floor(5 to 10)",
// DistPlusIngredients.make(
// {setup(
// <h2> {"Discrete Only" |> ReasonReact.string} </h2>
// |> E.O.React.fmapOrNull(distPlus => <DistPlusPlot distPlus />)}
// )
// ),
// (),
// ~domain=Complete,
// ~guesstimatorString="mm(floor(10 to 15), 10 to 11, [.9,.1])",
// DistPlusIngredients.make(
// {setup(
// <h2> {"Simple Mixed Distribution" |> ReasonReact.string} </h2>
// |> E.O.React.fmapOrNull(distPlus => <DistPlusPlot 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(
// <h2> {"Complex Distribution Days" |> ReasonReact.string} </h2>
// |> E.O.React.fmapOrNull(distPlus => <DistPlusPlot 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(
// <h2> {"Complex Distribution" |> ReasonReact.string} </h2>
let entry = EntryTypes.(entry(~title="Pdf", ~render=distributions));

View File

@ -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);
<DistributionPlot
minX
maxX

View File

@ -129,6 +129,8 @@ export class CdfChartD3 {
data(data) {
this.attrs.data = data;
this.attrs.data.continuous = data.continuous || {xs: [], ys: []};
this.attrs.data.discrete = data.discrete || {xs: [], ys: []};
return this;
}
@ -308,14 +310,6 @@ export class CdfChartD3 {
// Add drawing rectangle.
{
const context = this;
const range = [
xScale(dataPoints[dataPoints.length - 1][0].x),
xScale(
dataPoints
[dataPoints.length - 1]
[dataPoints[dataPoints.length - 1].length - 1].x,
),
];
function mouseover() {
const mouse = d3.mouse(this);

View File

@ -504,7 +504,7 @@ module DistPlus = {
let fromShape = (t, shape): t => 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?