GraphCalc2App is a simple graphing calculator demonstration using myphysicslab. Includes a SliderControl that sets a parameter "b" which can be used in the graph equation.

Recipe for Graphing

  • make a LabCanvas with a SimView, connected to an HTML canvas
  • make a VarsList with 2 variables.
  • make a GraphLine which collects data from the VarsList
  • make a DisplayGraph to show the GraphLine
  • add DisplayGraph to SimView
  • add DisplayAxes to SimView
  • put the expression you want to graph into a string variable, it is a function of x.
  • in a loop, from x=0 to 10, by increment of 0.05: put x into vars[0]; evaluate the expression to get y, put it into vars[1]; call graph.memorize()
  • call canvas.paint()

TO DO: add AutoScale, so that full range is shown

TO DO: add pan-zoom controls

Hierarchy (view full)




graph_controls: null | HTMLDivElement

div for graph controls

x: number = 0

The expression evaluating process uses Terminal.expand() to access the 'x' variable which is a property of GraphCalc2App.


  • Define short-cut name replacement rules. For example 'x' is replaced by 'myApp.x' when myName is 'myApp'.


    • myName: string

      the name of this object, valid in global Javascript context.

    Returns void

  • Parameters

    • script: string
    • output: boolean = true

      whether to print the result to the output text area and add the script to session history; default is true

    Returns any

    the result of evaluating the string

  • Parameters

    • Optional expr: string
    • Optional range1: number
    • Optional range2: number
    • Optional numPts: number

    Returns void

  • Sets whether this Subject will broadcast events, typically used to temporarily disable broadcasting. Intended to be used in situations where a subclass overrides a method that broadcasts an event. This allows the subclass to prevent the superclass broadcasting that event, so that the subclass can broadcast the event when the method is completed.


    • value: boolean

      whether this Subject should broadcast events

    Returns boolean

    the previous value

  • Returns a minimal string representation of this object, usually giving just identity information like the class name and name of the object.

    For an object whose main purpose is to represent another Printable object, it is recommended to include the result of calling toStringShort on that other object. For example, calling toStringShort() on a DisplayShape might return something like this:


    Returns string

    a minimal string representation of this object.

Generated using TypeDoc