InetSoft Product Information: Chart API

InetSoft's dashboard reporting software includes a chart API for complete control over charting when the built-in chart types needs to be further customized. There are several different coordinate objects, each of which creates a different kind of chart. The following sections discuss the different types of chart coordinate systems.

Rectangular Coordinates

The default coordinate set is rectangular coordinates, as defined by the RectCoord object. Rectangular coordinates represent two-dimensional data on horizontal (X) and vertical (Y) axes. A RectCoord object is created automatically when you create a new chart object. Therefore, if you plan to use rectangular coordinates on the chart, you do not need to explicitly specify a RectCoord object. You only need to explicitly create a RectCoord object when you define other types of coordinate systems. (See the following sections for more details.)

view gallery
View live interactive examples in InetSoft's dashboard and visualization gallery.

Assigning Rectangular Coordinates Automatically

The following example illustrates automatic creation of rectangular coordinates:

importPackage(inetsoft.graph)
importPackage(inetsoft.graph.element)
importPackage(inetsoft.graph.scale)
importPackage(inetsoft.graph.aesthetic)
importPackage(inetsoft.graph.coord)
importPackage(inetsoft.graph.data)

var arr = [["Direction", "Score"],
 [(Math.PI/2),20],
 [(Math.PI/4),30],
 [(Math.PI),35]];
dataset = new DefaultDataSet(arr);
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(GraphConstants.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(GraphConstants.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);

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.

 importPackage(inetsoft.graph)
 importPackage(inetsoft.graph.element)
 importPackage(inetsoft.graph.scale)
 importPackage(inetsoft.graph.aesthetic)
 importPackage(inetsoft.graph.coord)
 importPackage(inetsoft.graph.data)
   var arr = [["Direction", "Score"],
            [(Math.PI/2),20],
            [(Math.PI/4),30],
            [(Math.PI),35]];
 dataset = new DefaultDataSet(arr);
 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(GraphConstants.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(GraphConstants.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.

Previous: Dashboarding API