Added bs-css, styld Chart.re

This commit is contained in:
Ozzie Gooen 2020-02-13 18:35:10 +00:00
parent b85f2c8729
commit dfbdc51085
5 changed files with 31 additions and 12 deletions

View File

@ -19,6 +19,7 @@
"bs-ant-design-alt", "bs-ant-design-alt",
"reason-react", "reason-react",
"bs-reform", "bs-reform",
"bs-css",
"rationale", "rationale",
"bs-moment", "bs-moment",
"reschema" "reschema"

View File

@ -28,6 +28,7 @@
"antd": "3.17.0", "antd": "3.17.0",
"autoprefixer": "^9.7.4", "autoprefixer": "^9.7.4",
"bs-ant-design-alt": "2.0.0-alpha.31", "bs-ant-design-alt": "2.0.0-alpha.31",
"bs-css": "^11.0.0",
"bs-moment": "0.4.4", "bs-moment": "0.4.4",
"bs-reform": "9.7.1", "bs-reform": "9.7.1",
"lenses-ppx": "4.0.0", "lenses-ppx": "4.0.0",

View File

@ -1,3 +1,15 @@
module Styles = {
open Css;
let graph = chartColor =>
style([
selector(".axis", [fontSize(`px(9))]),
selector(".domain", [display(`none)]),
selector(".tick line", [display(`none)]),
selector(".tick text", [color(`hex("bfcad4"))]),
selector(".chart .area-path", [SVG.fill(chartColor)]),
]);
};
[@react.component] [@react.component]
let make = let make =
( (
@ -8,13 +20,15 @@ let make =
~height=50, ~height=50,
~color=`hex("7e9db7"), ~color=`hex("7e9db7"),
) => ) =>
<ForetoldComponents.CdfChart__Base <div className={Styles.graph(color)}>
width=0 <ForetoldComponents.CdfChart__Base
height width=0
?minX height
?maxX ?minX
marginBottom=20 ?maxX
showVerticalLine=false marginBottom=20
showDistributionLines=false showVerticalLine=false
primaryDistribution=data showDistributionLines=false
/>; primaryDistribution=data
/>
</div>;

View File

@ -40,7 +40,10 @@ module Value = {
let cdf: Types.distribution = let cdf: Types.distribution =
CdfLibrary.Distribution.fromString(r, 2000); CdfLibrary.Distribution.fromString(r, 2000);
<> <>
<Chart data={cdf |> CdfLibrary.Distribution.toPdf |> Types.toJs} /> <Chart
height=100
data={cdf |> CdfLibrary.Distribution.toPdf |> Types.toJs}
/>
{r |> ReasonReact.string} {r |> ReasonReact.string}
</>; </>;
| Probability(r) => | Probability(r) =>

View File

@ -1955,7 +1955,7 @@ bs-ant-design-alt@2.0.0-alpha.31:
bs-moment "^0.4.4" bs-moment "^0.4.4"
re-classnames "^4.0.0" re-classnames "^4.0.0"
bs-css@11.0.0: bs-css@11.0.0, bs-css@^11.0.0:
version "11.0.0" version "11.0.0"
resolved "https://registry.yarnpkg.com/bs-css/-/bs-css-11.0.0.tgz#6ed1726d7c06aa584d255d1cf23240a2acc0aa07" resolved "https://registry.yarnpkg.com/bs-css/-/bs-css-11.0.0.tgz#6ed1726d7c06aa584d255d1cf23240a2acc0aa07"
integrity sha512-bpSwj1VvmWNMoJ5qnsHMQC+Mj0zjL9iwcOhl5ipP7Hfr7v+ZyKqjSMaMK+L1EdukuCp0rJmRD2I/MbS4BHnMmQ== integrity sha512-bpSwj1VvmWNMoJ5qnsHMQC+Mj0zjL9iwcOhl5ipP7Hfr7v+ZyKqjSMaMK+L1EdukuCp0rJmRD2I/MbS4BHnMmQ==