Skip to content

Commit 48c17fb

Browse files
Merge pull request #184 from Speedrunyourknowledge/develop
add derivative graphs
2 parents ecd6610 + abc28a6 commit 48c17fb

23 files changed

+41440
-172
lines changed

calc-frontend/public/cosineDeriv.json

Lines changed: 6130 additions & 0 deletions
Large diffs are not rendered by default.

calc-frontend/public/cubicDeriv.json

Lines changed: 3530 additions & 0 deletions
Large diffs are not rendered by default.

calc-frontend/public/eDeriv.json

Lines changed: 6130 additions & 0 deletions
Large diffs are not rendered by default.

calc-frontend/public/linearDeriv.json

Lines changed: 3530 additions & 0 deletions
Large diffs are not rendered by default.

calc-frontend/public/lnDeriv.json

Lines changed: 6136 additions & 0 deletions
Large diffs are not rendered by default.

calc-frontend/public/quadDeriv.json

Lines changed: 3530 additions & 0 deletions
Large diffs are not rendered by default.

calc-frontend/public/sineDeriv.json

Lines changed: 6130 additions & 0 deletions
Large diffs are not rendered by default.

calc-frontend/public/tanDeriv.json

Lines changed: 6130 additions & 0 deletions
Large diffs are not rendered by default.

calc-frontend/src/components/Cosine/CosineDeriv.tsx

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,47 @@
1-
import { useLayoutEffect, useRef } from "react";
2-
import CosineDerivGraph from "./CosineDerivGraph"
1+
import { useLayoutEffect, useState, useRef } from "react";
2+
import Plot from "react-plotly.js";
33

44
function CosineDeriv() {
55

6+
const [figData, setFigData] = useState<any | null>(null);
67
const container = useRef(null);
78

89
useLayoutEffect(() =>{
910
//@ts-ignore
1011
let MQ = MathQuill.getInterface(2);
1112
MQ.StaticMath(container.current, { })
1213

13-
}, []);
14+
fetch("/cosineDeriv.json")
15+
.then((res) => res.json())
16+
.then((json) => setFigData(json));
1417

18+
}, []);
1519
return (
16-
<div>
17-
<div className="flex">
20+
21+
<div>
22+
<div className="flex">
1823
<div ref={container} className="center-header">
1924
\frac&#123;d&#125;&#123;dx&#125;(\cos(x))
2025
</div>
2126
</div>
2227

23-
<div className="graph-outer-box" >
24-
<CosineDerivGraph />
25-
</div>
28+
<div className="flex justify-center">
29+
<div className="plotly-graph-div graph-frame">
30+
{figData && (
31+
<Plot
32+
data={figData.data}
33+
layout={{
34+
...figData.layout,
35+
margin: { l: 40, r: 40, t: 40, b: 40 },
36+
}}
37+
frames={figData.frames}
38+
config={figData.config}
39+
style={{ width: "100%", height: "100%" }}
40+
/>
41+
)}
42+
</div>
43+
</div>
2644
</div>
27-
2845
)
2946
}
3047

calc-frontend/src/components/Cosine/CosineDerivGraph.tsx

Lines changed: 0 additions & 15 deletions
This file was deleted.

0 commit comments

Comments
 (0)