From 762ac2bf354e4cc2c4b15f42502da939f5061646 Mon Sep 17 00:00:00 2001
From: bobzel <zzzman@gmail.com>
Date: Fri, 9 Aug 2024 16:48:18 -0400
Subject: a bunch more typing fixes.

---
 src/client/views/nodes/FunctionPlotBox.tsx | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

(limited to 'src/client/views/nodes/FunctionPlotBox.tsx')

diff --git a/src/client/views/nodes/FunctionPlotBox.tsx b/src/client/views/nodes/FunctionPlotBox.tsx
index 3d1bd7563..6b439cd64 100644
--- a/src/client/views/nodes/FunctionPlotBox.tsx
+++ b/src/client/views/nodes/FunctionPlotBox.tsx
@@ -1,4 +1,4 @@
-import functionPlot from 'function-plot';
+import functionPlot, { Chart } from 'function-plot';
 import { computed, makeObservable, reaction } from 'mobx';
 import { observer } from 'mobx-react';
 import * as React from 'react';
@@ -22,11 +22,11 @@ export class FunctionPlotBox extends ViewBoxAnnotatableComponent<FieldViewProps>
         return FieldView.LayoutString(FunctionPlotBox, fieldKey);
     }
     public static GraphCount = 0;
-    _plot: any;
+    _plot: Chart | undefined;
     _plotId = '';
-    _plotEle: any;
+    _plotEle: HTMLDivElement | null = null;
 
-    constructor(props: any) {
+    constructor(props: FieldViewProps) {
         super(props);
         makeObservable(this);
         this._plotId = 'graph' + FunctionPlotBox.GraphCount++;
@@ -42,8 +42,10 @@ export class FunctionPlotBox extends ViewBoxAnnotatableComponent<FieldViewProps>
     getAnchor = (addAsAnnotation: boolean, pinProps?: PinProps) => {
         const anchor = Docs.Create.ConfigDocument({ annotationOn: this.Document });
         PinDocView(anchor, { pinDocLayout: pinProps?.pinDocLayout, pinData: { ...(pinProps?.pinData ?? {}), datarange: true } }, this.Document);
-        anchor.config_xRange = new List<number>(Array.from(this._plot.options.xAxis.domain));
-        anchor.config_yRange = new List<number>(Array.from(this._plot.options.yAxis.domain));
+        if (this._plot) {
+            anchor.config_xRange = new List<number>(Array.from(this._plot.options.xAxis?.domain ?? []));
+            anchor.config_yRange = new List<number>(Array.from(this._plot.options.yAxis?.domain ?? []));
+        }
         if (addAsAnnotation) this.addDocument(anchor);
         return anchor;
     };
@@ -68,9 +70,9 @@ export class FunctionPlotBox extends ViewBoxAnnotatableComponent<FieldViewProps>
         const width = this._props.PanelWidth();
         const height = this._props.PanelHeight();
         try {
-            this._plotEle.children.length && this._plotEle.removeChild(this._plotEle.children[0]);
+            this._plotEle?.children.length && this._plotEle.removeChild(this._plotEle.children[0]);
             this._plot = functionPlot({
-                target: '#' + this._plotEle.id,
+                target: '#' + this._plotEle?.id,
                 width,
                 height,
                 xAxis: { domain: Cast(this.layoutDoc.xRange, listSpec('number'), [-10, 10]) },
@@ -104,7 +106,7 @@ export class FunctionPlotBox extends ViewBoxAnnotatableComponent<FieldViewProps>
         return false;
     };
 
-    _dropDisposer: any;
+    _dropDisposer: DragManager.DragDropDisposer | undefined;
     protected createDropTarget = (ele: HTMLDivElement) => {
         this._dropDisposer?.();
         if (ele) {
-- 
cgit v1.2.3-70-g09d2

