diff --git a/src/App.vue b/src/App.vue index ce01029..2d74dbe 100644 --- a/src/App.vue +++ b/src/App.vue @@ -54,7 +54,7 @@ Dark.set(true) diff --git a/src/pages/RangeChartEditor.vue b/src/pages/RangeChartEditor.vue new file mode 100644 index 0000000..b7e59e1 --- /dev/null +++ b/src/pages/RangeChartEditor.vue @@ -0,0 +1,118 @@ + + + diff --git a/src/quasar-variables.sass b/src/quasar-variables.sass index edc3022..ad6e563 100644 --- a/src/quasar-variables.sass +++ b/src/quasar-variables.sass @@ -1,5 +1,5 @@ $primary : #553564 -$secondary : #26A69A +$secondary : #008e80 $accent : #9C27B0 $dark : #1D1D1D @@ -8,5 +8,5 @@ $dark : #1D1D1D $positive : #21BA45 $negative : #C10015 -$info : #31CCEC +$info : #7da9b2 $warning : #F2C037 \ No newline at end of file diff --git a/src/support/page.ts b/src/support/page.ts index cb2336e..3b55eed 100644 --- a/src/support/page.ts +++ b/src/support/page.ts @@ -128,6 +128,25 @@ export class MathPage { .filter(x => x.isFunctionDeclaration()) } + /** Look up a function statement by name, if it exists. */ + getFunctionByName(name: string): MathStatement|undefined { + for ( const fn of this.functions() ) { + const node = fn.parse() as math.FunctionAssignmentNode + if ( node.name === name ) { + return fn + } + } + } + + /** Look up a function statement by name, if it exists. */ + getFunctionByNameOrFail(name: string): MathStatement { + const fn = this.getFunctionByName(name) + if ( !fn ) { + throw new Error('Unable to find function with name: ' + name) + } + return fn + } + /** Evaluate the current state of the page and get the result. */ evaluate(): EvaluationResult { const evaluations: Record = {} diff --git a/src/support/types.ts b/src/support/types.ts index d14794c..248ef7f 100644 --- a/src/support/types.ts +++ b/src/support/types.ts @@ -111,3 +111,16 @@ export class ImageContainer { } +export class ChartBox { + // eslint-disable-next-line max-params + constructor( + public fnName: string, + public minX: number, + public maxX: number, + public stepX: number = 1, + public x: number = 0, + public y: number = 0, + ) {} +} + +