Trying to add squigglechart types for declaration
This commit is contained in:
parent
533c97c41c
commit
c5673fd1b1
|
@ -11,12 +11,34 @@ import {
|
||||||
defaultImports,
|
defaultImports,
|
||||||
defaultBindings,
|
defaultBindings,
|
||||||
defaultEnvironment,
|
defaultEnvironment,
|
||||||
|
continuousDeclaration,
|
||||||
|
declarationContinuousArg,
|
||||||
} from "@quri/squiggle-lang";
|
} from "@quri/squiggle-lang";
|
||||||
import { NumberShower } from "./NumberShower";
|
import { NumberShower } from "./NumberShower";
|
||||||
import { DistributionChart } from "./DistributionChart";
|
import { DistributionChart } from "./DistributionChart";
|
||||||
import { ErrorBox } from "./ErrorBox";
|
import { ErrorBox } from "./ErrorBox";
|
||||||
import { FunctionChart, FunctionChartSettings } from "./FunctionChart";
|
import { FunctionChart, FunctionChartSettings } from "./FunctionChart";
|
||||||
|
|
||||||
|
function getRange<a>(x: continuousDeclaration<a>) {
|
||||||
|
let first = x.args[0]
|
||||||
|
switch(first.tag){
|
||||||
|
case "Float": {return{floats: {min: first.value.min, max: first.value.max}}}
|
||||||
|
case "Time": {return{time: {min: first.value.min, max: first.value.max}}}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function getChartSettings<a>(x: continuousDeclaration<a>):FunctionChartSettings {
|
||||||
|
console.log("HERE")
|
||||||
|
let foo = getRange(x)
|
||||||
|
console.log("HIHI", foo)
|
||||||
|
let min = foo.floats ? foo.floats.min : 0
|
||||||
|
let max = foo.floats ? foo.floats.max : 10
|
||||||
|
return ({
|
||||||
|
start: min,
|
||||||
|
stop: max,
|
||||||
|
count: 20,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
const variableBox = {
|
const variableBox = {
|
||||||
Component: styled.div`
|
Component: styled.div`
|
||||||
background: white;
|
background: white;
|
||||||
|
|
|
@ -14,6 +14,9 @@ export {
|
||||||
errorValueToString,
|
errorValueToString,
|
||||||
distributionErrorToString,
|
distributionErrorToString,
|
||||||
distributionError,
|
distributionError,
|
||||||
|
continuousDeclaration,
|
||||||
|
relativeComparisonDeclaration,
|
||||||
|
declarationContinuousArg,
|
||||||
} from "../rescript/TypescriptInterface.gen";
|
} from "../rescript/TypescriptInterface.gen";
|
||||||
export type { errorValue, externalBindings as bindings, jsImports };
|
export type { errorValue, externalBindings as bindings, jsImports };
|
||||||
import {
|
import {
|
||||||
|
|
|
@ -90,3 +90,15 @@ let defaultEnvironment = ReducerInterface_ExpressionValue.defaultEnvironment
|
||||||
|
|
||||||
@genType
|
@genType
|
||||||
let foreignFunctionInterface = Reducer.foreignFunctionInterface
|
let foreignFunctionInterface = Reducer.foreignFunctionInterface
|
||||||
|
|
||||||
|
@genType
|
||||||
|
type declarationContinuousArg = Declaration.continuousArg
|
||||||
|
|
||||||
|
@genType
|
||||||
|
type continuousDeclaration<'a> = Declaration.continuousDeclaration<'a>
|
||||||
|
|
||||||
|
@genType
|
||||||
|
type relativeComparisonDeclaration<'a> = Declaration.relativeComparisonDeclaration<'a>
|
||||||
|
|
||||||
|
@genType
|
||||||
|
type declaration<'a> = Declaration.declaration<'a>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user