Assigning Rectangular Coordinates Explicitly

You can explicitly define the RectCoord object, if needed. The script below is the same as the script in Assigning Rectangular Coordinates Automatically, but uses two scales to explicitly define a set of rectangular coordinates. These coordinates are then explicitly assigned to the chart.

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);

var rect = new RectCoord(xscale,yscale);

graph.setCoordinate(rect);

graph.addElement(elem);

The resulting chart is the same as in the previous case.

<< Assigning Rectangular Coordinates Automatically © 1996-2013 InetSoft Technology Corporation (v11.5) CT.12.2 Polar Coordinates >>