From c42c646838718a762f1f7c9d1915f40d97665b98 Mon Sep 17 00:00:00 2001 From: Sam Nolan Date: Thu, 23 Jun 2022 03:16:35 +0000 Subject: [PATCH] Add logX and expY as playground settings --- .../src/components/SquigglePlayground.tsx | 30 ++++++++++++++++--- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/packages/components/src/components/SquigglePlayground.tsx b/packages/components/src/components/SquigglePlayground.tsx index cf0544f6..7476193c 100644 --- a/packages/components/src/components/SquigglePlayground.tsx +++ b/packages/components/src/components/SquigglePlayground.tsx @@ -32,6 +32,10 @@ interface PlaygroundProps { showControls?: boolean; /** Whether to show the summary table in the playground */ showSummary?: boolean; + /** Whether to log the x coordinate on distribution charts */ + logX?: boolean; + /** Whether to exp the y coordinate on distribution charts */ + expY?: boolean; /** If code is set, component becomes controlled */ code?: string; onCodeChange?(expr: string): void; @@ -71,6 +75,8 @@ const schema = yup showControls: yup.boolean(), showSummary: yup.boolean(), showEditor: yup.boolean(), + logX: yup.boolean(), + expY: yup.boolean(), showSettingsPage: yup.boolean().default(false), diagramStart: yup .number() @@ -203,6 +209,8 @@ export const SquigglePlayground: FC = ({ showTypes = false, showControls = false, showSummary = false, + logX = false, + expY = false, code: controlledCode, onCodeChange, showEditor = true, @@ -219,10 +227,12 @@ export const SquigglePlayground: FC = ({ sampleCount: 1000, xyPointLength: 1000, chartHeight: 150, - showTypes: showTypes, - showControls: showControls, - showSummary: showSummary, - showEditor: showEditor, + showTypes, + showControls, + logX, + expY, + showSummary, + showEditor, leftSizePercent: 50, showSettingsPage: false, diagramStart: 0, @@ -313,6 +323,16 @@ export const SquigglePlayground: FC = ({
+ + = ({ showTypes={vars.showTypes} showControls={vars.showControls} showSummary={vars.showSummary} + logX={vars.logX} + expY={vars.expY} bindings={defaultBindings} jsImports={imports} />