diff --git a/packages/components/src/components/FunctionChart.tsx b/packages/components/src/components/FunctionChart.tsx
index 2da5d367..fda699e9 100644
--- a/packages/components/src/components/FunctionChart.tsx
+++ b/packages/components/src/components/FunctionChart.tsx
@@ -1,9 +1,15 @@
import * as React from "react";
-import { SqLambda, environment, SqValueTag } from "@quri/squiggle-lang";
+import {
+ SqLambda,
+ environment,
+ SqValueTag,
+ SqError,
+} from "@quri/squiggle-lang";
import { FunctionChart1Dist } from "./FunctionChart1Dist";
import { FunctionChart1Number } from "./FunctionChart1Number";
import { DistributionPlottingSettings } from "./DistributionChart";
-import { ErrorAlert, MessageAlert } from "./Alert";
+import { MessageAlert } from "./Alert";
+import { SquiggleErrorAlert } from "./SquiggleErrorAlert";
export type FunctionChartSettings = {
start: number;
@@ -19,6 +25,25 @@ interface FunctionChartProps {
height: number;
}
+const FunctionCallErrorAlert = ({ error }: { error: SqError }) => {
+ const [expanded, setExpanded] = React.useState(false);
+ if (expanded) {
+ }
+ return (
+
+
+ setExpanded(!expanded)}
+ >
+ {expanded ? "Hide" : "Show"} error details
+
+ {expanded ? : null}
+
+
+ );
+};
+
export const FunctionChart: React.FC
= ({
fn,
chartSettings,
@@ -26,7 +51,8 @@ export const FunctionChart: React.FC = ({
distributionPlotSettings,
height,
}) => {
- if (fn.parameters.length > 1) {
+ console.log(fn.parameters().length);
+ if (fn.parameters().length !== 1) {
return (
Only functions with one parameter are displayed.
@@ -47,9 +73,7 @@ export const FunctionChart: React.FC = ({
const validResult = getValidResult();
if (validResult.tag === "Error") {
- return (
- {validResult.value.toString()}
- );
+ return ;
}
switch (validResult.value.tag) {
diff --git a/packages/components/src/components/SquiggleViewer/VariableBox.tsx b/packages/components/src/components/SquiggleViewer/VariableBox.tsx
index 9ad59597..ca0fc875 100644
--- a/packages/components/src/components/SquiggleViewer/VariableBox.tsx
+++ b/packages/components/src/components/SquiggleViewer/VariableBox.tsx
@@ -1,4 +1,4 @@
-import { SqValue, SqValueLocation } from "@quri/squiggle-lang";
+import { SqValue } from "@quri/squiggle-lang";
import React, { useContext, useReducer } from "react";
import { Tooltip } from "../ui/Tooltip";
import { LocalItemSettings, MergedItemSettings } from "./utils";
@@ -70,7 +70,7 @@ export const VariableBox: React.FC = ({
{location.path.items.length ? (
) : null}