Class MbGraph extends Sprite
use | constructors | methods | getters/ setters
Use
g = MbGraph.setupBoard(plaGraph);
g.setRanges(-10000,2010, 0, 7);
g.doAxesOrigin("time (years)", 2000, "population (billions)", 1);
g.addTopTitle("even more experimental");
g.enableCoordsDisplay();
g.addSeries(ser);
g.draw();
addChild(g);
var serTemp:MbGraphable;
serTemp = g.setupEquation("e^(t*"+parm+")", "t", 0, 2000, 10);
serTemp = new MbGraphableLine(serTemp, oxff0000, 2, .8);
serTemp = g.setupDataFromArray([[500,1],[1000,3],[1500,7],[500,1],
[1000,3],[1500,7]]);
serTemp = new MbGraphableLine(serTemp, 0xdca921, 2);
serTemp = new MbGraphableDot(serTemp, 0x8b9742, 5);
Constructors
MbGraph(gb:MbGraphingBoard1)
static setupBoard(ph:DisplayObject):MbGraph
most common constructor
draw()
this draws the whole graph
User Drawing
enableUserDraw(color=0xdddd22, th=1)
doEraseUserNum(num=-1):void
doEraseUserAll(num=-1):void
Axes
addAxis(ax:MbAxis)
use this for a non-standard axis
doAxesOrigin(titleX, tickX, titleY, tickY)
doAxesBox(titleX, tickX, titleY, tickY)
these 2 methods provide the most common combinations of axes
drawAxes()
draw the axes
Adding text to the graph
addTopTitle(str)
addLabel(str, xPos, yPos)
enableCoordsDisplay():void
disableCoordsDisplay():void
default is disabled
Data series
setupDataFromArray(arr:Array):MbGraphable
setupEquation(equation, charVar="x", nFrom=-999, nTo=-999, stepSz_=-1):MbGraphable
these are factory methods -- then wrap the series in MbGraphableLine/Bar/Dot for formatting
doRocNum(num, str_, init_=0, vars_="t", nSteps=100, stepSz_=1)
OBSOLETE
addSeries(ser:MbGraphable)
drawData()
showData(ser:MbGraphable, toDraw=true, redrawGraph=true):void
showDataAll(toDraw=true, redrawGraph=true):void
these two methods TEMPORARILY remove/show data
can also do this--> ser.setDraw(false);
removeData(ser:MbSeries, toDraw=true):void
this method removes data permanently
replaceData(serOld:MbGraphable, serNew:MbGraphable, toDraw=true):MbGraphable
use this method to change the data
//IMPORTANT: use the return value to set the old series, e.g.,
//serOld = replaceData(serOld, serNew);
//otherwise, the next replaceData will fail!!!!!!!!
eraseData(toDraw=false):void
Getters/ Setters
getBoard():MbGraphingBoard1
getXMin():Number
getXMax():Number
getXHalf():Number
getRangeX():Array
relating to the x coordinates
getYMin():Number
getYMax():Number
getRangeY():Array
relating to the y coordinates
setRanges(xMin, xMax, yMin, yMax)
getRangesEqu(numEqu):Array
find the y-range for a given equation on a given graph -- OBSOLETE because of numEqu