Previous topic TOC

Create diagrams

Next topic

Graph Diagrams can be displayed by using the graph object. You can add one or more data-series to the graph and set some options on how the diagram is displayed. Example:
//use some material
factory.material = Material(1e-6, .2, .9, 0.1);

// create a box that will fall down
var b = Box(10,10,10);

// this function will be plotted
function f_y()
    return b.position[1];  // returns the y-position

// creates a new diagram
var g = Graph("position");

// add a series with the y-position of the box
g.addSeries(f_y, 0, 0, RGB(255,0,0), GRAPH_ON_WAITFRAME, "y");

// simulate scene
while (simulator.time < 1)
	WaitFrame(); .01 );
This example shows a diagram called "position" in a new tab next to the inspect tab. The  depicted parabola is the result of the evaluation of the function f_y, each time when the WaitFrame function is called. More series can be added to one graph, and more than one graph can be created. You can copy to clipboard or print the graph by using the copy and print command respectively.