aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/nodes/FunctionPlotBox.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/views/nodes/FunctionPlotBox.tsx')
-rw-r--r--src/client/views/nodes/FunctionPlotBox.tsx11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/client/views/nodes/FunctionPlotBox.tsx b/src/client/views/nodes/FunctionPlotBox.tsx
index 67445e552..a86bdbd79 100644
--- a/src/client/views/nodes/FunctionPlotBox.tsx
+++ b/src/client/views/nodes/FunctionPlotBox.tsx
@@ -51,7 +51,16 @@ export class FunctionPlotBox extends ViewBoxAnnotatableComponent<FieldViewProps>
.map(d => LinkManager.getOppositeAnchor(d, this.Document))
.filter(d => d)
.map(d => d!);
- return links.concat(DocListCast(this.dataDoc[this.fieldKey])).map(doc => StrCast(doc.text, 'x^2').replace(/\\frac\{(.*)\}\{(.*)\}/, '($1/$2)'));
+ const funcs = links.concat(DocListCast(this.dataDoc[this.fieldKey])).map(doc =>
+ StrCast(doc.text, 'x^2')
+ .replace(/\\sqrt/g, 'sqrt')
+ .replace(/\\frac\{(.*)\}\{(.*)\}/g, '($1/$2)')
+ .replace(/\\left/g, '')
+ .replace(/\\right/g, '')
+ .replace(/\{/g, '')
+ .replace(/\}/g, '')
+ );
+ return funcs;
}
createGraph = (ele?: HTMLDivElement) => {
this._plotEle = ele || this._plotEle;