Skip to content

Commit

Permalink
fix: enable user functions for scatter plots
Browse files Browse the repository at this point in the history
  • Loading branch information
mgreminger committed Nov 14, 2023
1 parent e7086c6 commit 505594e
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
3 changes: 3 additions & 0 deletions public/dimensional_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,9 @@ class ScatterQueryStatement(TypedDict):
cellNum: int
isFromPlotCell: bool
params: list[str] # will be empty list
functions: list[UserFunction | UserFunctionRange | FunctionUnitsQuery]
arguments: list[FunctionArgumentQuery | FunctionArgumentAssignment]
localSubs: list[LocalSubstitution | LocalSubstitutionRange]
implicitParams: list[ImplicitParameter]
exponents: list[Exponent | ExponentName]
xValuesQuery: ScatterXValuesQueryStatement
Expand Down
7 changes: 7 additions & 0 deletions src/parser/LatexToSympy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -679,10 +679,17 @@ export class LatexToSympy extends LatexParserVisitor<string | Statement | UnitBl
outputUnits = this.visitU_block(ctx.u_block(1));
}

if (this.rangeCount > 0) {
this.addParsingErrorMessage('Range may not be specified for a scatter plot.');
}

return {
type: "scatterQuery",
asLines: Boolean(ctx.AS_LINES()),
params: [],
functions: this.functions,
arguments: this.arguments,
localSubs: this.localSubs,
implicitParams: this.implicitParams,
exponents: this.exponents,
equationIndex: this.equationIndex,
Expand Down
3 changes: 3 additions & 0 deletions src/parser/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,9 @@ export type ScatterQueryStatement = {
type: "scatterQuery";
asLines: boolean;
params: [];
functions: (UserFunction | UserFunctionRange | FunctionUnitsQuery)[];
arguments: (FunctionArgumentAssignment | FunctionArgumentQuery) [];
localSubs: (LocalSubstitution | LocalSubstitutionRange)[];
implicitParams: ImplicitParameter[];
exponents: Exponent[];
equationIndex: number;
Expand Down

0 comments on commit 505594e

Please sign in to comment.