Assigning Rectangular Coordinates Automatically
The following example illustrates automatic creation of rectangular coordinates:
Note: Script that modifies 'graph' should be placed at the element level. See Adding Element-Level Script in Report Scripting and Adding Component Script in Dashboard Scripting for more information.
dataset = [["Direction", "Score"],[(Math.PI/2),20],[(Math.PI/4),30],[(Math.PI),35]];
graph = new EGraph();
var elem = new PointElement("Direction", "Score");
var xscale = new LinearScale("Direction");
var yscale = new LinearScale("Score");
yscale.setMin(0);
yscale.setMax(40);
var yaxis = new AxisSpec();
yaxis.setGridStyle(Chart.DOT_LINE);
yscale.setAxisSpec(yaxis);
xscale.setMin(0);
xscale.setMax(1.95*Math.PI);
xscale.setIncrement(Math.PI/8);
var xaxis = new AxisSpec();
var tspec = new TextSpec();
tspec.setFormat(new java.text.DecimalFormat("0.0"));
xaxis.setTextSpec(tspec);
xaxis.setGridStyle(Chart.DOT_LINE);
xscale.setAxisSpec(xaxis);
graph.setScale("Direction",xscale);
graph.setScale("Score",yscale);
graph.addElement(elem);

The script defines a PointElement style (scatter plot), and specifies a LinearScale for the 'Direction' field and 'Score' field. Note that the script does not explicitly create a RectCoord object. A rectangular coordinate system is created automatically, and this allows you to assign the specified scales directly to the Graph:
graph.setScale("Direction",xscale);
graph.setScale("Score",yscale);
| << CT.12.1 Rectangular Coordinates | © 1996-2013 InetSoft Technology Corporation (v11.5) | Assigning Rectangular Coordinates Explicitly >> |