InetSoft Product Information: Charting API

By default, the rectangular coordinate's X-axis is mapped to the polar coordinate's angle, and the rectangular coordinate's Y-axis is mapped to the polar coordinate's magnitude (radius). To reverse a mapping, use the Coordinate object's transpose() method.

demo
Read how InetSoft saves money and resources with deployment flexibility.

Tailoring a Coordinate Mapping

When converting rectangular to polar coordinates, you can choose to map only one of the dimensions. Use the PolarCoord Type property to do this.

The example below is the same as that in Converting Rectangular to Polar Coordinates, except that here only the angle dimension is mapped:

 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);
 var polar = new PolarCoord(rect);
 polar.setType(PolarCoord.THETA);
 graph.setCoordinate(polar);
 graph.addElement(elem);

The result is that all points have the same magnitude, with variation only along the angle dimension. To reverse a mapping, use the Coordinate object's transpose() method. For example, a pie chart. You can think of a pie chart as a stacked bar chart with just one bar, displayed in polar coordinates. To see this, consider the script below, which creates a simple bar 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 = [["State", "Revenue"], ["CA", 200],
            ["NY",300],["PA",150]];
 dataset = new DefaultDataSet(arr);
 graph = new EGraph();
 var elem = new IntervalElement("State","Revenue");
 var xscale = new CategoricalScale("State") var yscale = new LinearScale("Revenue");
 var rect = new RectCoord(xscale, yscale);
 graph.setCoordinate(rect);
 graph.addElement(elem);
Previous: Charts API Next: Flash Chart API (cont.)