Make sure that chart minimum is shown
This commit is contained in:
parent
c30fab22c7
commit
ddd0bc0820
|
@ -1,6 +1,7 @@
|
||||||
// "mm(floor(uniform(30,35)), normal(50,20), [.25,.5])",
|
// "mm(floor(uniform(30,35)), normal(50,20), [.25,.5])",
|
||||||
// "mm(floor(normal(28,4)), normal(32,2), uniform(20,24), [.5,.2,.1])",
|
// "mm(floor(normal(28,4)), normal(32,2), uniform(20,24), [.5,.2,.1])",
|
||||||
|
|
||||||
|
// "mm(5 to 20, floor(normal(20,2)), [.5, .5])",
|
||||||
let timeDist =
|
let timeDist =
|
||||||
DistPlusIngredients.make(
|
DistPlusIngredients.make(
|
||||||
~guesstimatorString="(floor(10 to 15))",
|
~guesstimatorString="(floor(10 to 15))",
|
||||||
|
@ -24,7 +25,8 @@ let distributions = () =>
|
||||||
<h2> {"Single-Discrete" |> ReasonReact.string} </h2>
|
<h2> {"Single-Discrete" |> ReasonReact.string} </h2>
|
||||||
{setup(
|
{setup(
|
||||||
DistPlusIngredients.make(
|
DistPlusIngredients.make(
|
||||||
~guesstimatorString="mm(5 to 20, floor(normal(20,2)), [.5, .5])",
|
~guesstimatorString=
|
||||||
|
"uniform(0,1) > 0.036 ? lognormal(6.652, -0.41): 0",
|
||||||
~domain=
|
~domain=
|
||||||
RightLimited({xPoint: 50.0, excludingProbabilityMass: 0.3}),
|
RightLimited({xPoint: 50.0, excludingProbabilityMass: 0.3}),
|
||||||
(),
|
(),
|
||||||
|
|
|
@ -7,7 +7,13 @@ module DistPlusChart = {
|
||||||
distPlus
|
distPlus
|
||||||
|> T.toScaledContinuous
|
|> T.toScaledContinuous
|
||||||
|> E.O.fmap(Distributions.Continuous.getShape);
|
|> E.O.fmap(Distributions.Continuous.getShape);
|
||||||
let minX = T.minX(distPlus);
|
let range = T.xTotalRange(distPlus);
|
||||||
|
let minX =
|
||||||
|
switch (T.minX(distPlus), range) {
|
||||||
|
| (Some(min), Some(range)) => Some(min -. range *. 0.001)
|
||||||
|
| _ => None
|
||||||
|
};
|
||||||
|
|
||||||
let maxX = T.maxX(distPlus);
|
let maxX = T.maxX(distPlus);
|
||||||
let timeScale = distPlus.unit |> DistTypes.DistributionUnit.toJson;
|
let timeScale = distPlus.unit |> DistTypes.DistributionUnit.toJson;
|
||||||
<DistributionPlot
|
<DistributionPlot
|
||||||
|
|
|
@ -40,8 +40,8 @@ function CdfChartReact(props) {
|
||||||
.minX(props.minX)
|
.minX(props.minX)
|
||||||
.onHover(props.onHover)
|
.onHover(props.onHover)
|
||||||
.marginBottom(props.marginBottom || 15)
|
.marginBottom(props.marginBottom || 15)
|
||||||
.marginLeft(5)
|
.marginLeft(30)
|
||||||
.marginRight(5)
|
.marginRight(30)
|
||||||
.marginTop(5)
|
.marginTop(5)
|
||||||
.showDistributionLines(props.showDistributionLines)
|
.showDistributionLines(props.showDistributionLines)
|
||||||
.showDistributionYAxis(props.showDistributionYAxis)
|
.showDistributionYAxis(props.showDistributionYAxis)
|
||||||
|
|
|
@ -216,8 +216,9 @@ module Mixed = {
|
||||||
Dist({
|
Dist({
|
||||||
type t = DistTypes.mixedShape;
|
type t = DistTypes.mixedShape;
|
||||||
type integral = DistTypes.continuousShape;
|
type integral = DistTypes.continuousShape;
|
||||||
let minX = ({continuous, discrete}: t) =>
|
let minX = ({continuous, discrete}: t) => {
|
||||||
min(Continuous.T.minX(continuous), Discrete.T.minX(discrete));
|
min(Continuous.T.minX(continuous), Discrete.T.minX(discrete));
|
||||||
|
};
|
||||||
let maxX = ({continuous, discrete}: t) =>
|
let maxX = ({continuous, discrete}: t) =>
|
||||||
max(Continuous.T.maxX(continuous), Discrete.T.maxX(discrete));
|
max(Continuous.T.maxX(continuous), Discrete.T.maxX(discrete));
|
||||||
let toShape = (t: t): DistTypes.shape => Mixed(t);
|
let toShape = (t: t): DistTypes.shape => Mixed(t);
|
||||||
|
|
|
@ -63,8 +63,9 @@ module RelativeTimePoint = {
|
||||||
|> MomentRe.Moment.add(~duration=MomentRe.duration(r, timeVector.unit))
|
|> MomentRe.Moment.add(~duration=MomentRe.duration(r, timeVector.unit))
|
||||||
};
|
};
|
||||||
|
|
||||||
let _timeToX = (time, timeStart, timeUnit) =>
|
let _timeToX = (time, timeStart, timeUnit) => {
|
||||||
MomentRe.diff(timeStart, time, timeUnit);
|
MomentRe.diff(time, timeStart, timeUnit);
|
||||||
|
};
|
||||||
|
|
||||||
let toXValue = (timeVector: timeVector, timeInVector: timeInVector) =>
|
let toXValue = (timeVector: timeVector, timeInVector: timeInVector) =>
|
||||||
switch (timeInVector) {
|
switch (timeInVector) {
|
||||||
|
|
|
@ -17,12 +17,20 @@ let propValue = (t: Prop.Value.t) => {
|
||||||
switch (t) {
|
switch (t) {
|
||||||
| SelectSingle(r) => r |> ReasonReact.string
|
| SelectSingle(r) => r |> ReasonReact.string
|
||||||
| ConditionalArray(r) => "Array" |> ReasonReact.string
|
| ConditionalArray(r) => "Array" |> ReasonReact.string
|
||||||
| DistPlusIngredients(r) =>
|
| DistPlusIngredients((r: DistTypes.distPlusIngredients)) =>
|
||||||
let newDistribution =
|
let newDistribution =
|
||||||
DistPlusIngredients.toDistPlus(~sampleCount=1000, r);
|
DistPlusIngredients.toDistPlus(
|
||||||
|
~sampleCount=2000,
|
||||||
|
~outputXYPoints=2000,
|
||||||
|
~truncateTo=Some(100),
|
||||||
|
r,
|
||||||
|
);
|
||||||
switch (newDistribution) {
|
switch (newDistribution) {
|
||||||
| Some(distribution) =>
|
| Some(distribution) =>
|
||||||
<div> <DistPlusPlot distPlus=distribution /> </div>
|
<div>
|
||||||
|
<DistPlusPlot distPlus=distribution />
|
||||||
|
{r.guesstimatorString |> ReasonReact.string}
|
||||||
|
</div>
|
||||||
| None => "Something went wrong" |> ReasonReact.string
|
| None => "Something went wrong" |> ReasonReact.string
|
||||||
};
|
};
|
||||||
| FloatCdf(_) => <div />
|
| FloatCdf(_) => <div />
|
||||||
|
|
|
@ -1,21 +1,16 @@
|
||||||
let guesstimatorString = "normal(40,10)";
|
let guesstimatorString = "uniform(1, 100)";
|
||||||
|
|
||||||
let makeI = (currentDateTime: MomentRe.Moment.t) => {
|
let makeI = (currentDateTime: MomentRe.Moment.t) => {
|
||||||
DistPlusIngredients.make(
|
DistPlusIngredients.make(
|
||||||
~guesstimatorString,
|
~guesstimatorString,
|
||||||
~unit=TimeDistribution({zero: currentDateTime, unit: `years}),
|
~unit=TimeDistribution({zero: currentDateTime, unit: `years}),
|
||||||
|
~domain=RightLimited({xPoint: 300.0, excludingProbabilityMass: 0.3}),
|
||||||
(),
|
(),
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
module Model = {
|
module Model = {
|
||||||
let make = (currentDateTime: MomentRe.Moment.t) => {
|
let make = (currentDateTime: MomentRe.Moment.t) => {
|
||||||
let distPlusIngredients =
|
Prop.Value.DistPlusIngredients(makeI(currentDateTime));
|
||||||
DistPlusIngredients.make(
|
|
||||||
~guesstimatorString,
|
|
||||||
~unit=TimeDistribution({zero: currentDateTime, unit: `years}),
|
|
||||||
(),
|
|
||||||
);
|
|
||||||
Prop.Value.DistPlusIngredients(distPlusIngredients);
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -52,8 +52,8 @@ module Internals = {
|
||||||
let stringToMixedShape =
|
let stringToMixedShape =
|
||||||
(
|
(
|
||||||
~string,
|
~string,
|
||||||
~sampleCount=1000,
|
~sampleCount=3000,
|
||||||
~outputXYPoints=1000,
|
~outputXYPoints=3000,
|
||||||
~truncateTo=Some(500),
|
~truncateTo=Some(500),
|
||||||
(),
|
(),
|
||||||
) =>
|
) =>
|
||||||
|
|
|
@ -13,9 +13,9 @@ const minMaxRatio = (minValue, maxValue) => {
|
||||||
return 'SMALL';
|
return 'SMALL';
|
||||||
}
|
}
|
||||||
const ratio = maxValue / minValue;
|
const ratio = maxValue / minValue;
|
||||||
if (ratio < 100000) {
|
if (ratio < 10000) {
|
||||||
return 'SMALL';
|
return 'SMALL';
|
||||||
} else if (ratio < 10000000) {
|
} else if (ratio < 1000000) {
|
||||||
return 'MEDIUM';
|
return 'MEDIUM';
|
||||||
} else {
|
} else {
|
||||||
return 'LARGE';
|
return 'LARGE';
|
||||||
|
@ -46,7 +46,7 @@ const toPdf = (values, outputResolutionCount, min, max) => {
|
||||||
const samples = new Samples(continuousSamples);
|
const samples = new Samples(continuousSamples);
|
||||||
|
|
||||||
const ratioSize$ = ratioSize(samples);
|
const ratioSize$ = ratioSize(samples);
|
||||||
const width = ratioSize$ === 'SMALL' ? 100 : 1;
|
const width = ratioSize$ === 'SMALL' ? 40 : 1;
|
||||||
|
|
||||||
const pdf = samples.toPdf({ size: outputResolutionCount, width, min, max });
|
const pdf = samples.toPdf({ size: outputResolutionCount, width, min, max });
|
||||||
continuous = pdf;
|
continuous = pdf;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user