From 9923021b4845c2b746423715c2e8bb262ffb9a35 Mon Sep 17 00:00:00 2001 From: Ozzie Gooen Date: Mon, 17 Feb 2020 22:53:39 +0000 Subject: [PATCH] Attempt at simple graphs --- showcase/entries/Continuous.re | 53 +++++++++++--- showcase/index.html | 3 +- src/components/charts/ChartWithNumber.re | 23 ------- .../charts/GenericDistributionChart.re | 69 +++++++++++++++++++ src/components/charts/cdfChartd3.js | 2 +- 5 files changed, 116 insertions(+), 34 deletions(-) delete mode 100644 src/components/charts/ChartWithNumber.re create mode 100644 src/components/charts/GenericDistributionChart.re diff --git a/showcase/entries/Continuous.re b/showcase/entries/Continuous.re index 5475fd92..832d6789 100644 --- a/showcase/entries/Continuous.re +++ b/showcase/entries/Continuous.re @@ -1,19 +1,54 @@ open ForetoldComponents.Base; let data: DistributionTypes.xyShape = { - xs: [|0.2, 20., 80., 212., 330.|], - ys: [|0.0, 0.3, 0.5, 0.2, 0.1|], + xs: [|1., 10., 10., 200., 250., 292., 330.|], + ys: [|0.0, 0.0, 0.1, 0.3, 0.5, 0.2, 0.1|], }; -let alerts = () => +let mixedDist = + GenericDistribution.make( + ~generationSource=GuesstimatorString("mm(3, normal(5,1), [.5,.5])"), + ~probabilityType=Pdf, + ~domain=Complete, + ~unit=Unspecified, + (), + ) + |> GenericDistribution.renderIfNeeded(~sampleCount=3000); + +let timeDist = + GenericDistribution.make( + ~generationSource=GuesstimatorString("mm(3, normal(5,1), [.5,.5])"), + ~probabilityType=Pdf, + ~domain=Complete, + ~unit=Time({zero: MomentRe.momentNow(), unit: `years}), + (), + ) + |> GenericDistribution.renderIfNeeded(~sampleCount=3000); + +let domainLimitedDist = + GenericDistribution.make( + ~generationSource=GuesstimatorString("mm(3, normal(5,1), [.5,.5])"), + ~probabilityType=Pdf, + ~domain=RightLimited({xPoint: 6.0, excludingProbabilityMass: 0.3}), + ~unit=Unspecified, + (), + ) + |> GenericDistribution.renderIfNeeded(~sampleCount=3000); + +let distributions = () =>
-
- Shape.XYShape.integral} - color={`hex("333")} - /> +

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

+ +
+
+

{"Time Distribution" |> ReasonReact.string}

+ +
+
+

{"Domain Limited Distribution" |> ReasonReact.string}

+
; -let entry = EntryTypes.(entry(~title="Pdf", ~render=alerts)); \ No newline at end of file +let entry = EntryTypes.(entry(~title="Pdf", ~render=distributions)); \ No newline at end of file diff --git a/showcase/index.html b/showcase/index.html index 7879deec..b459bc86 100644 --- a/showcase/index.html +++ b/showcase/index.html @@ -6,7 +6,8 @@ - + +