diff --git a/packages/components/src/SquiggleChart.tsx b/packages/components/src/SquiggleChart.tsx index f3d6f982..e381127c 100644 --- a/packages/components/src/SquiggleChart.tsx +++ b/packages/components/src/SquiggleChart.tsx @@ -12,7 +12,7 @@ import { createClassFromSpec } from "react-vega"; import * as chartSpecification from "./spec-distributions.json"; import * as percentilesSpec from "./spec-percentiles.json"; import { NumberShower } from "./NumberShower"; -import styled from 'styled-components' +import styled from "styled-components"; let SquiggleVegaChart = createClassFromSpec({ spec: chartSpecification as Spec, @@ -53,14 +53,17 @@ const Error = styled.div` padding: 0.4em 0.8em; `; -const ShowError: React.FC<{ heading:string, errorMessage: string }> = ({ heading="Error", errorMessage }) => { +const ShowError: React.FC<{ heading: string; children: React.ReactNode }> = ({ + heading = "Error", + children, +}) => { return (

{heading}

- <>{errorMessage} + {children}
); -} +}; export const SquiggleChart: React.FC = ({ squiggleString = "", @@ -72,7 +75,7 @@ export const SquiggleChart: React.FC = ({ diagramStop = 10, diagramCount = 20, environment = [], - onEnvChange = () => { }, + onEnvChange = () => {}, width = 500, height = 60, }: SquiggleChartProps) => { @@ -247,7 +250,11 @@ export const SquiggleChart: React.FC = ({ return <>{chartResults}; } else if (result.tag === "Error") { // At this point, we came across an error. What was our error? - return + return ( + + {result.value} + + ); } return

{"Invalid Response"}

; }; @@ -336,4 +343,4 @@ function getPercentiles(percentiles: number[], t: DistPlus) { }); return bounds; } -} \ No newline at end of file +} diff --git a/packages/components/src/spec-distributions.json b/packages/components/src/spec-distributions.json index 64231c21..40aebfe4 100644 --- a/packages/components/src/spec-distributions.json +++ b/packages/components/src/spec-distributions.json @@ -180,4 +180,4 @@ } } ] -} \ No newline at end of file +} diff --git a/packages/components/src/spec-percentiles.json b/packages/components/src/spec-percentiles.json index 6afa5c0b..64b9035d 100644 --- a/packages/components/src/spec-percentiles.json +++ b/packages/components/src/spec-percentiles.json @@ -20,9 +20,7 @@ "transform": [ { "type": "aggregate", - "groupby": [ - "x" - ], + "groupby": ["x"], "ops": [ "mean", "mean", @@ -372,4 +370,4 @@ } } ] -} \ No newline at end of file +}