Skip to content

3.6 Plot

amaliejvik edited this page Jul 3, 2024 · 3 revisions

Plot

The plot displays a function plot for a mathematical single-variable expression.

Extends:

Implements:

  • none

Parameters:

Required:

  • func: string A mathematical expression as a string that will be parsed when calculating the plot points.

Optional:

  • numPoints?: number The number of points to use when approximating the graph. This should be left untouched unless serious performance issues occurs, or the plot is too inaccurate.
  • dashed?: boolean Whether the plot should be dashed.
  • lineWidth?: number Linewidth of the plot.
  • color?: number Color of the graph line.
  • coefficients?: Coefficients Any coefficients that was used in the function string should be specified with a value here.
  • plotRange?: number How far the plot should extend on each side of the x-axis. Should be left untouched. Use plotBetween instead.
  • plotBetween: [number, number] | undefined: Two x-values to plot the graph between.

Extra types:

  • Coefficients = { [key: string]: number; }

Default Parameters:

numPoints: 1500,
dashed: false,
lineWidth: 4,
color: 0xfaa307,
coefficients: {},
plotBetween: undefined,

Implemented Methods:

  • getName(): string
  • getColorAsString(): string
  • getDisplayText(): string
  • hover(): void
  • unhover(): void

Methods

  • setCoefficients(coefficients: Coefficients): void Set the coefficients to a specified value. Will re-render the graph accordingly.
  • setExpression(expression: string): void Set the function expression to a specified string value. Will re-render the graph accordingly.
Clone this wiki locally