|
6 | 6 |
|
7 | 7 | import { FunctionPlot } from "../../fnplot"; |
8 | 8 | import { onMount } from "svelte"; |
9 | | - import PlotModal from "../PlotModal/PlotModal.svelte"; |
10 | 9 | import CreatePlotModal from "../../app/CreatePlotModal"; |
11 | | - import { timeHours } from "d3"; |
12 | | - import { insertPlot } from "../../common/utils"; |
13 | 10 |
|
14 | 11 | export let options: PlotInputs, |
15 | 12 | plugin: ObsidianFunctionPlot, |
16 | 13 | showConstantsSettings = false; |
17 | 14 |
|
18 | 15 | let plotContainer: HTMLElement; |
19 | 16 | let plot: FunctionPlot; |
20 | | - let prevGraphType = new Array(); |
21 | | -
|
22 | | - onMount(() => { |
23 | | - createNewPlot(); |
24 | | - }); |
25 | | - // $: { |
26 | | - // const scope = ( |
27 | | - // Object.entries(options.constants) as [string, ConstantInputs][] |
28 | | - // ).reduce((scope_, [key, val]) => { |
29 | | - // scope_[key] = val.value; |
30 | | - // return scope_; |
31 | | - // }, {}); |
32 | | - // options.data.forEach((datum) => { |
33 | | - // datum.scope = scope; |
34 | | - // }); |
35 | | - // } |
| 17 | + let prevGraphType = []; |
36 | 18 |
|
37 | 19 | function createNewPlot() { |
38 | 20 | // First destroy any existing plot completely |
|
50 | 32 | plot.render(); |
51 | 33 | } |
52 | 34 |
|
| 35 | + onMount(() => { |
| 36 | + createNewPlot(); |
| 37 | + }); |
| 38 | + // $: { |
| 39 | + // const scope = ( |
| 40 | + // Object.entries(options.constants) as [string, ConstantInputs][] |
| 41 | + // ).reduce((scope_, [key, val]) => { |
| 42 | + // scope_[key] = val.value; |
| 43 | + // return scope_; |
| 44 | + // }, {}); |
| 45 | + // options.data.forEach((datum) => { |
| 46 | + // datum.scope = scope; |
| 47 | + // }); |
| 48 | + // } |
| 49 | +
|
53 | 50 | $: { |
54 | 51 | if (options?.data) { |
55 | 52 | for (let i = 0; i < options.data.length; i++) { |
|
0 commit comments