Minor cleanup

This commit is contained in:
Ozzie Gooen 2020-08-08 20:50:09 +01:00
parent 8196b4814b
commit d162572910
8 changed files with 40 additions and 295 deletions

View File

@ -60,8 +60,7 @@
"reschema": "1.3.0",
"tailwindcss": "1.2.0",
"vega": "5.11.1",
"vega-embed": "6.6.0",
"vega-lite": "^4.14.1"
"vega-embed": "6.6.0"
},
"devDependencies": {
"@glennsl/bs-jest": "^0.5.1",

View File

@ -168,36 +168,59 @@ module DemoDist = {
DistPlusRenderer.runFunction(
inputs1,
(f, a),
[|`SymbolicDist(`Float(5.0))|],
[|`SymbolicDist(`Float(0.0))|],
);
let result2 =
DistPlusRenderer.runFunction(
inputs1,
(f, a),
[|`SymbolicDist(`Float(10.0))|],
[|`SymbolicDist(`Float(2.0))|],
);
let result3 =
DistPlusRenderer.runFunction(
inputs1,
(f, a),
[|`SymbolicDist(`Float(20.0))|],
[|`SymbolicDist(`Float(4.0))|],
);
switch (result1, result2, result3) {
let result4 =
DistPlusRenderer.runFunction(
inputs1,
(f, a),
[|`SymbolicDist(`Float(6.0))|],
);
let result5 =
DistPlusRenderer.runFunction(
inputs1,
(f, a),
[|`SymbolicDist(`Float(8.0))|],
);
let result6 =
DistPlusRenderer.runFunction(
inputs1,
(f, a),
[|`SymbolicDist(`Float(10.0))|],
);
switch (result1, result2, result3, result4, result5, result6) {
| (
Ok(`DistPlus(distPlus1)),
Ok(`DistPlus(distPlus2)),
Ok(`DistPlus(distPlus3)),
Ok(`DistPlus(distPlus4)),
Ok(`DistPlus(distPlus5)),
Ok(`DistPlus(distPlus6)),
) =>
<>
<PercentilesChart
dists=[|
(5.0, distPlus1),
(10.0, distPlus2),
(20.0, distPlus3),
(0.0, distPlus1),
(2.0, distPlus2),
(4.0, distPlus3),
(6.0, distPlus4),
(8.0, distPlus5),
(10.0, distPlus6),
|]
/>
</>
| (Error(r), _, _) => r |> R.ste
| _ => "Failure " |> R.ste
};
| Error(r) => r |> R.ste

View File

@ -6,50 +6,6 @@ import {
} from "react-vega";
import spec from './spec-percentiles';
// export class PercentilesChart extends React.PureComponent {
// constructor(props) {
// super(props);
// this.containerRef = React.createRef();
// this.view = null;
// this.spec = _.cloneDeep(spec);
// this.spec.data[0].values = this.props.data;
// }
// componentDidMount() {
// this.view = new vega.View(vega.parse(this.spec), {
// renderer: 'canvas',
// container: this.containerRef.current,
// hover: true
// });
// this.view.addEventListener('mouseover', function (name, value) {
// console.log("Got event back", name, value)
// });
// return this.view.runAsync();
// }
// componentWillUnmount() {
// if (this.view) {
// this.view.finalize();
// }
// }
// // https://gist.github.com/simonw/7e4b21d0f3cc1d17eaa314fb3f904843
// componentDidUpdate() {
// console.log("Update", this.props);
// var changeset = vega.changeset().remove(() => true).insert(this.props.data);
// this.view.change("table", changeset).run()
// }
// render() {
// return React.createElement("div", {
// ref: this.containerRef,
// });
// }
// }
const PercentilesChart = createClassFromSpec({
spec
});

View File

@ -3,10 +3,10 @@ external percentilesChart: ReasonReact.reactClass = "PercentilesChart";
module Internal = {
[@react.component]
let make = (~data, ~children=ReasonReact.null) =>
let make = (~data, ~signalListeners, ~children=ReasonReact.null) =>
ReasonReact.wrapJsForReason(
~reactClass=percentilesChart,
~props={"data": data},
~props={"data": data, "signalListeners": signalListeners},
children,
)
|> ReasonReact.element;
@ -37,5 +37,5 @@ let make =
});
Js.log3("Data", dists, data);
let da = {"facet": data};
<Internal data=da />;
<Internal data=da signalListeners={}/>;
};

View File

@ -1,11 +0,0 @@
[@bs.module "./thingy.js"]
external reactClass : ReasonReact.reactClass = "Input";
[@react.component]
let make = (~data=?, ~children=ReasonReact.null) =>
ReasonReact.wrapJsForReason(
~reactClass,
~props={"data": Js.Undefined.fromOption(data)},
children,
)|> ReasonReact.element;

View File

@ -1,11 +0,0 @@
import React from "react";
export class Input extends React.Component {
constructor(props) {
super(props);
}
render() {
return ( < div > < /div> )
}
}

View File

@ -1,144 +0,0 @@
// type victoryData = {
// .
// "x": int,
// "y": int,
// };
// module VictoryTheme = {
// type t;
// [@bs.module "victory-core/es/victory-theme/material"] [@bs.val]
// external material : t = "default";
// [@bs.module "victory-core/es/victory-theme/grayscale"] [@bs.val]
// external grayscale : t = "default";
// };
// module VictoryBar = {
// [@bs.module "victory"]
// external victoryBar : ReasonReact.reactClass = "VictoryBar";
// let make = (~data=?, children) =>
// ReasonReact.wrapJsForReason(
// ~reactClass=victoryBar,
// ~props={"data": Js.Undefined.fromOption(data)},
// children,
// );
// };
// module VictoryStack = {
// [@bs.module "victory"]
// external victoryStack : ReasonReact.reactClass = "VictoryStack";
// let make = (~colorScale=?, children) =>
// ReasonReact.wrapJsForReason(
// ~reactClass=victoryStack,
// ~props={"colorScale": Js.Undefined.fromOption(colorScale)},
// children,
// );
// };
// module VictoryChart = {
// [@bs.module "victory"]
// external victoryChart : ReasonReact.reactClass = "VictoryChart";
// [@react.component]
// let make =
// (
// ~domainPadding=?,
// ~theme: option(VictoryTheme.t)=?,
// ~scale=?,
// ~maxDomain=?,
// ~minDomain=?,
// ~padding=?,
// ~height=?,
// ~width=?,
// ~children=ReasonReact.null
// ) =>
// ReasonReact.wrapJsForReason(
// ~reactClass=victoryChart,
// ~props={
// "domainPadding": Js.Undefined.fromOption(domainPadding),
// "theme": Js.Undefined.fromOption(theme),
// "scale": Js.Undefined.fromOption(scale),
// "maxDomain": Js.Undefined.fromOption(maxDomain),
// "minDomain": Js.Undefined.fromOption(minDomain),
// "padding": Js.Undefined.fromOption(padding),
// "height": Js.Undefined.fromOption(height),
// "width": Js.Undefined.fromOption(width),
// },
// children,
// ) |> ReasonReact.element
// };
// module VictoryLine = {
// [@bs.module "victory"]
// external victoryLine : ReasonReact.reactClass = "VictoryLine";
// [@react.component]
// let make = (~data=?, ~style=?, ~children=ReasonReact.null) =>
// ReasonReact.wrapJsForReason(
// ~reactClass=victoryLine,
// ~props={
// "data": Js.Undefined.fromOption(data),
// "style": Js.Undefined.fromOption(style),
// },
// children,
// ) |> ReasonReact.element
// };
// module VictoryAxis = {
// [@bs.module "victory"]
// external victoryAxis : ReasonReact.reactClass = "VictoryAxis";
// [@react.component]
// let make =
// (
// ~tickValues=?,
// ~height=?,
// ~style=?,
// ~scale=?,
// ~tickFormat: option('a => string)=?,
// ~dependentAxis: option(bool)=?,
// ~children=ReasonReact.null,
// ) =>
// ReasonReact.wrapJsForReason(
// ~reactClass=victoryAxis,
// ~props={
// "height": Js.Undefined.fromOption(height),
// "tickValues": Js.Undefined.fromOption(tickValues),
// "tickFormat": Js.Undefined.fromOption(tickFormat),
// "dependentAxis": Js.Undefined.fromOption(dependentAxis),
// "style": Js.Undefined.fromOption(style),
// "scale": Js.Undefined.fromOption(scale),
// },
// children,
// ) |> ReasonReact.element
// };
// module VictoryArea = {
// [@bs.module "victory"]
// external victoryArea : ReasonReact.reactClass = "VictoryArea";
// let make =
// (~animate=?, ~data=?, ~interpolation="linear", ~style=?, children) =>
// ReasonReact.wrapJsForReason(
// ~reactClass=victoryArea,
// ~props={
// "animate": Js.Undefined.fromOption(animate),
// "data": Js.Undefined.fromOption(data),
// "style": Js.Undefined.fromOption(style),
// "interpolation": interpolation,
// },
// children,
// );
// };
// module VictoryScatter = {
// [@bs.module "victory"]
// external victoryScatter : ReasonReact.reactClass = "victoryScatter";
// let make = (~data=?, ~style=?, children) =>
// ReasonReact.wrapJsForReason(
// ~reactClass=victoryScatter,
// ~props={
// "data": Js.Undefined.fromOption(data),
// "style": Js.Undefined.fromOption(style),
// },
// children,
// );
// };

View File

@ -1424,11 +1424,6 @@
dependencies:
"@babel/types" "^7.3.0"
"@types/clone@~0.1.30":
version "0.1.30"
resolved "https://registry.yarnpkg.com/@types/clone/-/clone-0.1.30.tgz#e7365648c1b42136a59c7d5040637b3b5c83b614"
integrity sha1-5zZWSMG0ITalnH1QQGN7O1yDthQ=
"@types/color-name@^1.1.1":
version "1.1.1"
resolved "https://registry.yarnpkg.com/@types/color-name/-/color-name-1.1.1.tgz#1c1261bbeaa10a8055bbc5d8ab84b7b2afc846a0"
@ -1439,11 +1434,6 @@
resolved "https://registry.yarnpkg.com/@types/events/-/events-3.0.0.tgz#2862f3f58a9a7f7c3e78d79f130dd4d71c25c2a7"
integrity sha512-EaObqwIvayI5a8dCzhFrjKzVwKLxjoG9T6Ppd5CEo07LRKfQ8Yokw54r5+Wq7FaBQ+yXRvQAYPrHwya1/UFt9g==
"@types/fast-json-stable-stringify@^2.0.0":
version "2.0.0"
resolved "https://registry.yarnpkg.com/@types/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz#40363bb847cb86b2c2e1599f1398d11e8329c921"
integrity sha512-mky/O83TXmGY39P1H9YbUpjV6l6voRYlufqfFCvel8l1phuy8HRjdWc1rrPuN53ITBJlbyMSV6z3niOySO5pgQ==
"@types/glob@^7.1.1":
version "7.1.1"
resolved "https://registry.yarnpkg.com/@types/glob/-/glob-7.1.1.tgz#aa59a1c6e3fbc421e07ccd31a944c30eba521575"
@ -1946,11 +1936,6 @@ array-equal@^1.0.0:
resolved "https://registry.yarnpkg.com/array-equal/-/array-equal-1.0.0.tgz#8c2a5ef2472fd9ea742b04c77a75093ba2757c93"
integrity sha1-jCpe8kcv2ep0KwTHenUJO6J1fJM=
array-flat-polyfill@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/array-flat-polyfill/-/array-flat-polyfill-1.0.1.tgz#1e3a4255be619dfbffbfd1d635c1cf357cd034e7"
integrity sha512-hfJmKupmQN0lwi0xG6FQ5U8Rd97RnIERplymOv/qpq8AoNKPPAnxJadjFA23FNWm88wykh9HmpLJUUwUtNU/iw==
array-tree-filter@^2.1.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/array-tree-filter/-/array-tree-filter-2.1.0.tgz#873ac00fec83749f255ac8dd083814b4f6329190"
@ -2816,7 +2801,7 @@ clone@^1.0.2:
resolved "https://registry.yarnpkg.com/clone/-/clone-1.0.4.tgz#da309cc263df15994c688ca902179ca3c7cd7c7e"
integrity sha1-2jCcwmPfFZlMaIypAheco8fNfH4=
clone@^2.1.1, clone@^2.1.2, clone@~2.1.2:
clone@^2.1.1, clone@^2.1.2:
version "2.1.2"
resolved "https://registry.yarnpkg.com/clone/-/clone-2.1.2.tgz#1b7f4b9f591f1e8f83670401600345a02887435f"
integrity sha1-G39Ln1kfHo+DZwQBYANFoCiHQ18=
@ -4318,11 +4303,6 @@ fast-deep-equal@^3.1.1:
resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-3.1.1.tgz#545145077c501491e33b15ec408c294376e94ae4"
integrity sha512-8UEa58QDLauDNfpbrX55Q9jrGHThw2ZMdOky5Gl1CDtVeJDPVrG4Jxx1N8jw2gkWaff5UUuX1KJd+9zGe2B+ZA==
fast-deep-equal@~3.1.3:
version "3.1.3"
resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz#3a7d56b559d6cbc3eb512325244e619a65c6c525"
integrity sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==
fast-glob@^2.2.2:
version "2.2.7"
resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-2.2.7.tgz#6953857c3afa475fff92ee6015d52da70a4cd39d"
@ -4352,7 +4332,7 @@ fast-json-patch@^3.0.0-1:
resolved "https://registry.yarnpkg.com/fast-json-patch/-/fast-json-patch-3.0.0-1.tgz#4c68f2e7acfbab6d29d1719c44be51899c93dabb"
integrity sha512-6pdFb07cknxvPzCeLsFHStEy+MysPJPgZQ9LbQ/2O67unQF93SNqfdSqnPPl71YMHX+AD8gbl7iuoGFzHEdDuw==
fast-json-stable-stringify@^2.0.0, fast-json-stable-stringify@~2.1.0:
fast-json-stable-stringify@^2.0.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz#874bf69c6f404c2b5d99c481341399fd55892633"
integrity sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==
@ -5960,7 +5940,7 @@ json-schema@0.2.3:
resolved "https://registry.yarnpkg.com/json-schema/-/json-schema-0.2.3.tgz#b480c892e59a2f05954ce727bd3f2a4e882f9e13"
integrity sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=
json-stringify-pretty-compact@^2.0.0, json-stringify-pretty-compact@~2.0.0:
json-stringify-pretty-compact@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/json-stringify-pretty-compact/-/json-stringify-pretty-compact-2.0.0.tgz#e77c419f52ff00c45a31f07f4c820c2433143885"
integrity sha512-WRitRfs6BGq4q8gTgOy4ek7iPFXjbra0H3PmDLKm2xnZ+Gh1HUhiKGgCZkSPNULlP7mvfu6FV/mOLhCarspADQ==
@ -9881,11 +9861,6 @@ tslib@^1.10.0, tslib@^1.9.3:
resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.11.1.tgz#eb15d128827fbee2841549e171f45ed338ac7e35"
integrity sha512-aZW88SY8kQbU7gpV19lN24LtXh/yD4ZZg6qieAJDDg+YBsJcSmLGK9QpnUjAKVG/xefmvJGd1WUmfpT/g6AJGA==
tslib@~2.0.0:
version "2.0.1"
resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.0.1.tgz#410eb0d113e5b6356490eec749603725b021b43e"
integrity sha512-SgIkNheinmEBgx1IUNirK0TUD4X9yjjBRTqqjggWCU3pUEqIk3/Uwl3yRixYKT6WjQuGiwDv4NomL3wqRCj+CQ==
tty-browserify@0.0.0:
version "0.0.0"
resolved "https://registry.yarnpkg.com/tty-browserify/-/tty-browserify-0.0.0.tgz#a157ba402da24e9bf957f9aa69d524eed42901a6"
@ -10216,13 +10191,6 @@ vega-expression@^2.6.4, vega-expression@~2.6.4:
dependencies:
vega-util "^1.13.2"
vega-expression@~2.6.5:
version "2.6.5"
resolved "https://registry.yarnpkg.com/vega-expression/-/vega-expression-2.6.5.tgz#7bda7524b9223cbbf9034071695c7c2a9bd81971"
integrity sha512-3hJts0gKomu3ePXYeIb+VAw7yNKoHJ6VqSKsHHFPyoEGNdwmlgI5d9IBblelPCiMCHK4sMt7h1OTWB33cfxZGA==
dependencies:
vega-util "^1.14.0"
vega-force@~4.0.4:
version "4.0.4"
resolved "https://registry.yarnpkg.com/vega-force/-/vega-force-4.0.4.tgz#b73cba2e169cc248c994c9d981c374eb06aff764"
@ -10274,24 +10242,6 @@ vega-hierarchy@~4.0.5:
vega-dataflow "^5.5.1"
vega-util "^1.13.2"
vega-lite@^4.14.1:
version "4.14.1"
resolved "https://registry.yarnpkg.com/vega-lite/-/vega-lite-4.14.1.tgz#76e76ee43dfd598544db61c7bace5d4d34fe892c"
integrity sha512-aA4hoaGd7n50uQi9eogCACeaACULp5ohzqBA0eJ+1PTUv8ILy+QHRDe3hX9FCEaXcq0Dj3DDj/sxF4PL6JaD+w==
dependencies:
"@types/clone" "~0.1.30"
"@types/fast-json-stable-stringify" "^2.0.0"
array-flat-polyfill "^1.0.1"
clone "~2.1.2"
fast-deep-equal "~3.1.3"
fast-json-stable-stringify "~2.1.0"
json-stringify-pretty-compact "~2.0.0"
tslib "~2.0.0"
vega-event-selector "~2.0.3"
vega-expression "~2.6.5"
vega-util "~1.14.1"
yargs "~15.4.1"
vega-loader@^4.2.2, vega-loader@~4.2.2:
version "4.2.2"
resolved "https://registry.yarnpkg.com/vega-loader/-/vega-loader-4.2.2.tgz#a9375f339c558dc1d083cabd2f8c29d8142b18f8"
@ -10442,7 +10392,7 @@ vega-util@^1.13.1, vega-util@^1.13.2, vega-util@~1.13.2:
resolved "https://registry.yarnpkg.com/vega-util/-/vega-util-1.13.2.tgz#d9fe2378f0e780290e231d128d8c125407fb3559"
integrity sha512-cN/VaO8CjPb3ELfQb+IVi5NGoQpYhWSUFfH7K2ibwagO8obZlUFa9ze8fYiexi2Txf78HFgWm9MXNdV6PROrkw==
vega-util@^1.14.0, vega-util@^1.14.1, vega-util@~1.14.1:
vega-util@^1.14.1:
version "1.14.1"
resolved "https://registry.yarnpkg.com/vega-util/-/vega-util-1.14.1.tgz#0fb614277764f98738ba0b80e5cdfbe663426183"
integrity sha512-pSKJ8OCkgfgHZDTljyj+gmGltgulceWbk1BV6LWrXqp6P3J8qPA/oZA8+a93YNApYxXZ3yzIVUDOo5O27xk0jw==
@ -10748,7 +10698,7 @@ yargs-parser@^15.0.1:
camelcase "^5.0.0"
decamelize "^1.2.0"
yargs-parser@^18.1.1, yargs-parser@^18.1.2:
yargs-parser@^18.1.1:
version "18.1.3"
resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-18.1.3.tgz#be68c4975c6b2abf469236b0c870362fab09a7b0"
integrity sha512-o50j0JeToy/4K6OZcaQmW6lyXXKhq7csREXcDwk2omFPJEwUNOVtJKvmDr9EI1fAJZUyZcRF7kxGBWmRXudrCQ==
@ -10815,23 +10765,6 @@ yargs@^15.0.2, yargs@^15.3.1:
y18n "^4.0.0"
yargs-parser "^18.1.1"
yargs@~15.4.1:
version "15.4.1"
resolved "https://registry.yarnpkg.com/yargs/-/yargs-15.4.1.tgz#0d87a16de01aee9d8bec2bfbf74f67851730f4f8"
integrity sha512-aePbxDmcYW++PaqBsJ+HYUFwCdv4LVvdnhBy78E57PIor8/OVvhMrADFFEDh8DHDFRv/O9i3lPhsENjO7QX0+A==
dependencies:
cliui "^6.0.0"
decamelize "^1.2.0"
find-up "^4.1.0"
get-caller-file "^2.0.1"
require-directory "^2.1.1"
require-main-filename "^2.0.0"
set-blocking "^2.0.0"
string-width "^4.2.0"
which-module "^2.0.0"
y18n "^4.0.0"
yargs-parser "^18.1.2"
zen-observable-ts@^0.8.21:
version "0.8.21"
resolved "https://registry.yarnpkg.com/zen-observable-ts/-/zen-observable-ts-0.8.21.tgz#85d0031fbbde1eba3cd07d3ba90da241215f421d"