Minor fixes
This commit is contained in:
parent
00301ec7d3
commit
7389fda068
11
package.json
11
package.json
|
@ -29,18 +29,23 @@
|
||||||
"@foretold/cdf": "1.0.15",
|
"@foretold/cdf": "1.0.15",
|
||||||
"@foretold/components": "0.0.3",
|
"@foretold/components": "0.0.3",
|
||||||
"@foretold/guesstimator": "1.0.10",
|
"@foretold/guesstimator": "1.0.10",
|
||||||
|
"@glennsl/bs-jest": "^0.4.9",
|
||||||
"antd": "3.17.0",
|
"antd": "3.17.0",
|
||||||
"autoprefixer": "9.7.4",
|
"autoprefixer": "9.7.4",
|
||||||
"babel-jest": "25.1.0",
|
"babel-jest": "25.1.0",
|
||||||
"bs-ant-design-alt": "2.0.0-alpha.31",
|
"bs-ant-design-alt": "2.0.0-alpha.31",
|
||||||
"bs-css": "11.0.0",
|
"bs-css": "11.0.0",
|
||||||
"bs-moment": "0.4.4",
|
"bs-moment": "0.4.4",
|
||||||
|
"bs-platform": "7.0.1",
|
||||||
"bs-reform": "9.7.1",
|
"bs-reform": "9.7.1",
|
||||||
|
"bsb-js": "1.1.7",
|
||||||
"d3": "5.15.0",
|
"d3": "5.15.0",
|
||||||
"lenses-ppx": "5.1.0",
|
"gh-pages": "2.2.0",
|
||||||
"jest": "^25.1.0",
|
"jest": "^25.1.0",
|
||||||
|
"lenses-ppx": "5.1.0",
|
||||||
"less": "3.10.3",
|
"less": "3.10.3",
|
||||||
"lodash": "4.17.15",
|
"lodash": "4.17.15",
|
||||||
|
"moduleserve": "0.9.1",
|
||||||
"moment": "2.24.0",
|
"moment": "2.24.0",
|
||||||
"parcel-bundler": "1.12.4",
|
"parcel-bundler": "1.12.4",
|
||||||
"parcel-plugin-less-js-enabled": "1.0.2",
|
"parcel-plugin-less-js-enabled": "1.0.2",
|
||||||
|
@ -50,10 +55,6 @@
|
||||||
"react-dom": "16.12.0",
|
"react-dom": "16.12.0",
|
||||||
"reason-react": ">=0.7.0",
|
"reason-react": ">=0.7.0",
|
||||||
"reschema": "1.3.0",
|
"reschema": "1.3.0",
|
||||||
"bs-platform": "7.0.1",
|
|
||||||
"bsb-js": "1.1.7",
|
|
||||||
"gh-pages": "2.2.0",
|
|
||||||
"moduleserve": "0.9.1",
|
|
||||||
"tailwindcss": "1.2.0"
|
"tailwindcss": "1.2.0"
|
||||||
},
|
},
|
||||||
"alias": {
|
"alias": {
|
||||||
|
|
|
@ -40,6 +40,8 @@ let distributions = () =>
|
||||||
<div>
|
<div>
|
||||||
<div>
|
<div>
|
||||||
<h2> {"Basic Mixed Distribution" |> ReasonReact.string} </h2>
|
<h2> {"Basic Mixed Distribution" |> ReasonReact.string} </h2>
|
||||||
|
<GenericDistributionChart dist=timeDist />
|
||||||
|
<h2> {"Simple Continuous" |> ReasonReact.string} </h2>
|
||||||
<GenericDistributionChart dist=mixedDist />
|
<GenericDistributionChart dist=mixedDist />
|
||||||
</div>
|
</div>
|
||||||
</div>;
|
</div>;
|
||||||
|
|
|
@ -1,71 +1,15 @@
|
||||||
module Continuous = {
|
module Mixed = {
|
||||||
[@react.component]
|
[@react.component]
|
||||||
let make = (~data, ~
|
let make = (~data: DistributionTypes.mixedShape, ~unit) => {
|
||||||
|
|
||||||
) => {
|
|
||||||
let (x, setX) = React.useState(() => 0.);
|
let (x, setX) = React.useState(() => 0.);
|
||||||
let timeScale = unit |> DistributionTypes.DistributionUnit.toJson;
|
let timeScale = unit |> DistributionTypes.DistributionUnit.toJson;
|
||||||
let chart =
|
|
||||||
React.useMemo1(
|
|
||||||
() =>
|
|
||||||
<CdfChart__Plain
|
|
||||||
data
|
|
||||||
timeScale
|
|
||||||
color={`hex("333")}
|
|
||||||
onHover={r => setX(_ => r)}
|
|
||||||
/>,
|
|
||||||
[|data|],
|
|
||||||
);
|
|
||||||
|
|
||||||
<div>
|
|
||||||
chart
|
|
||||||
<table className="table-auto">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th className="px-4 py-2"> {"X Point" |> ReasonReact.string} </th>
|
|
||||||
<th className="px-4 py-2"> {"Y Pount" |> ReasonReact.string} </th>
|
|
||||||
<th className="px-4 py-2">
|
|
||||||
{"Y Integral to Point" |> ReasonReact.string}
|
|
||||||
</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
<tr>
|
|
||||||
<th className="px-4 py-2 border ">
|
|
||||||
{x |> E.Float.toString |> ReasonReact.string}
|
|
||||||
</th>
|
|
||||||
<th className="px-4 py-2 border ">
|
|
||||||
{Shape.Continuous.findY(x, data)
|
|
||||||
|> E.Float.with2DigitsPrecision
|
|
||||||
|> ReasonReact.string}
|
|
||||||
</th>
|
|
||||||
<th className="px-4 py-2 border ">
|
|
||||||
{Shape.Continuous.findY(
|
|
||||||
x,
|
|
||||||
Shape.XYShape.Range.integrateWithTriangles(data)
|
|
||||||
|> E.O.toExt(""),
|
|
||||||
)
|
|
||||||
|> E.Float.with2DigitsPrecision
|
|
||||||
|> ReasonReact.string}
|
|
||||||
</th>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
<div />
|
|
||||||
</div>;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
module Mixed = {
|
|
||||||
[@react.component]
|
|
||||||
let make = (~data: DistributionTypes.mixedShape) => {
|
|
||||||
let (x, setX) = React.useState(() => 0.);
|
|
||||||
let chart =
|
let chart =
|
||||||
React.useMemo1(
|
React.useMemo1(
|
||||||
() =>
|
() =>
|
||||||
<CdfChart__Plain
|
<CdfChart__Plain
|
||||||
data={data.continuous}
|
data={data.continuous}
|
||||||
color={`hex("333")}
|
color={`hex("333")}
|
||||||
|
timeScale
|
||||||
onHover={r => setX(_ => r)}
|
onHover={r => setX(_ => r)}
|
||||||
/>,
|
/>,
|
||||||
[|data|],
|
[|data|],
|
||||||
|
@ -116,21 +60,12 @@ let make = (~dist) => {
|
||||||
),
|
),
|
||||||
}) =>
|
}) =>
|
||||||
<div>
|
<div>
|
||||||
<Continuous data={n |> Shape.Continuous.toPdf} unit />
|
|
||||||
<Continuous
|
|
||||||
unit
|
|
||||||
data={
|
|
||||||
n
|
|
||||||
|> Shape.XYShape.Range.integrateWithTriangles
|
|
||||||
|> E.O.toExt("")
|
|
||||||
|> Shape.XYShape.scaleCdfTo
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
<Mixed
|
<Mixed
|
||||||
|
unit
|
||||||
data={
|
data={
|
||||||
continuous:
|
continuous:
|
||||||
n
|
n
|
||||||
|> Shape.Continuous.toCdf
|
|> Shape.XYShape.Range.integrateWithTriangles
|
||||||
|> E.O.toExt("")
|
|> E.O.toExt("")
|
||||||
|> Shape.XYShape.scaleCdfTo
|
|> Shape.XYShape.scaleCdfTo
|
||||||
|> Shape.Continuous.toPdf
|
|> Shape.Continuous.toPdf
|
||||||
|
@ -139,19 +74,6 @@ let make = (~dist) => {
|
||||||
discreteProbabilityMassFraction: f,
|
discreteProbabilityMassFraction: f,
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
<Continuous
|
|
||||||
unit
|
|
||||||
data={
|
|
||||||
n
|
|
||||||
|> Shape.XYShape.Range.integrateWithTriangles
|
|
||||||
|> E.O.toExt("")
|
|
||||||
|> Shape.XYShape.Range.derivative
|
|
||||||
|> E.O.toExt("")
|
|
||||||
|> Shape.XYShape.Range.integrateWithTriangles
|
|
||||||
|> E.O.toExt("")
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
{d |> Shape.Discrete.scaleYToTotal(f) |> Shape.Discrete.render}
|
|
||||||
</div>
|
</div>
|
||||||
| _ => <div />
|
| _ => <div />
|
||||||
};
|
};
|
||||||
|
|
|
@ -18,6 +18,7 @@ module Internals = {
|
||||||
|
|
||||||
let toContinous = (r: combined): DistributionTypes.continuousShape =>
|
let toContinous = (r: combined): DistributionTypes.continuousShape =>
|
||||||
continuousGet(r) |> CdfLibrary.JS.jsToDist;
|
continuousGet(r) |> CdfLibrary.JS.jsToDist;
|
||||||
|
|
||||||
let toDiscrete = (r: combined): DistributionTypes.discreteShape =>
|
let toDiscrete = (r: combined): DistributionTypes.discreteShape =>
|
||||||
discreteGet(r) |> jsToDistDiscrete;
|
discreteGet(r) |> jsToDistDiscrete;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user