Class graph
Defined in: Graph.js.
Constructor Attributes  Constructor Name and Description 

graph(xlow/xhigh, ylow/yhigh, points, functions, counter, points, functions)
A class representing a 2axis graph

Method Attributes  Method Name and Description 

addPoint(newpoint)
Adds a point to the array of points to be interpolated.


changeInterpolation(value)


changeX(rangestring)
Read and parse input of xrange and updates the xrange.


changeY(rangestring)
Read and parse input of yrange and updates the yrange.


clear()
Clears all points and functions from the graph


drawAxes()
Draws the axes of the graph along with the gridlines within


drawFunction(interpolated)
Draws a function on the graph by drawing lines between calculated points.


Draw the latest function added


Draws all points currently in array onto graph


<inner> 
lsq(points)

plotAndConnectPoints(points)
Draws a curve defined by points


pointToPixel(point)
Convert units to pixels


<inner> 
qsq(points)

redraw()
Draws the backdrop of the graph


Removes all functions from the graph


Removes all points from the graph


Removes the chosen function from the graph


removePoint(p)
Removes the chosen point from the graph


{double}

xpu()
Calulates the X pixels per unit ratio

xrange()
Provide graphs current xrange


{double}

ypu()
Calulates the Y pixels per unit ratio

yrange()
Provide graphs current yrange

Class Detail
graph(xlow/xhigh, ylow/yhigh, points, functions, counter, points, functions)
A class representing a 2axis graph
 Parameters:
 {double} xlow/xhigh
 The high and low values of the xrange.
 {double} ylow/yhigh
 The high and low values of the yrange.
 {double} points
 The array of points added.
 {double} functions
 The array of functions added/formed.
 counter
 points
 functions
Method Detail
addPoint(newpoint)
Adds a point to the array of points to be interpolated.
It also checks if the point is outside the current viewing window and
adjusts if necessary.
 Parameters:
 {Point} newpoint
 The newpoint to be drawn
changeInterpolation(value)
 Parameters:
 value
changeX(rangestring)
Read and parse input of xrange and updates the xrange.
 Parameters:
 {string} rangestring
 The values for xhigh and xlow as a string
changeY(rangestring)
Read and parse input of yrange and updates the yrange.
 Parameters:
 {string} rangestring
 The values for yhigh and ylow as a string
clear()
Clears all points and functions from the graph
drawAxes()
Draws the axes of the graph along with the gridlines within
drawFunction(interpolated)
Draws a function on the graph by drawing lines between calculated points.
 Parameters:
 {PolynomialTerm} interpolated
 The interpolated function
drawLatest()
Draw the latest function added
drawPoints()
Draws all points currently in array onto graph
<inner>
lsq(points)
 Parameters:
 points
plotAndConnectPoints(points)
Draws a curve defined by points
 Parameters:
 {Point[]} points
 The points to be plotted and connected;
pointToPixel(point)
Convert units to pixels
 Parameters:
 point
<inner>
qsq(points)
 Parameters:
 points
redraw()
Draws the backdrop of the graph
removeAllFunctions()
Removes all functions from the graph
removeAllPoints()
Removes all points from the graph
removeFunction(f)
Removes the chosen function from the graph
 Parameters:
 {String} f
 The function to be removed
removePoint(p)
Removes the chosen point from the graph
 Parameters:
 {String} p
 The point to be removed
{double}
xpu()
Calulates the X pixels per unit ratio
 Returns:
 {double} xpu Returns the xpu value
xrange()
Provide graphs current xrange
{double}
ypu()
Calulates the Y pixels per unit ratio
 Returns:
 {double} ypu Returns the ypu value
yrange()
Provide graphs current yrange