InetSoft Product Information: Chart Reference (API)

Are you looking for a reference for a chart API? InetSoft provides a JavaScript-like API in its enterprise charting solution. It is well-suited for cloud application developers to use to dynamically generate interactive charts for their end users. To review the API, see https://www.inetsoft.com/docs/2021/apidoc

#1 Ranking: Read how InetSoft was rated #1 for user adoption in G2's user survey-based index Read More

Scale

The Scale object contains a scale defining the measurement of a dimension.

Scale.setAxisSpec(spec)

Specifies the axis properties for the scale.

Parameter

spec
 AxisSpec

Example (Report or Viewsheet)

importPackage(inetsoft.graph)
importPackage(inetsoft.graph.data)
importPackage(inetsoft.graph.scale)
importPackage(inetsoft.graph.aesthetic)
importPackage(inetsoft.graph.element)
importPackage(inetsoft.graph.coord)
 
var arr = [["State", "Quantity"], ["NJ",200], ["NY",300]];
dataset = new DefaultDataSet(arr);
graph = new EGraph();
var qscale = new LinearScale("Quantity");
var elem = new IntervalElement("State", "Quantity")
var spec = new AxisSpec();
spec.setLineColor(java.awt.Color(0xff0000));
qscale.setAxisSpec(spec);
graph.setScale("Quantity", qscale);
graph.addElement(elem);

Scale.setDataFields(arr)

Specifies the fields to use for initializing the scale; i.e., determining the maximum and minimum values. If left unspecified, the values in the Scale.setFields(field) property are used for this purpose.

Parameter

arr
 Array of Strings

Example (Report or Viewsheet)

importPackage(inetsoft.graph)
importPackage(inetsoft.graph.data)
importPackage(inetsoft.graph.scale)
importPackage(inetsoft.graph.aesthetic)
importPackage(inetsoft.graph.element)
importPackage(inetsoft.graph.coord)
 
var arr = [["State","Quantity","Total"], ["NJ",100,0],
           ["NY",1500,30000]];
dataset = new DefaultDataSet(arr);
graph = new EGraph();
var qscale = new LogScale();
var elem = new IntervalElement("State", "Quantity");
qscale.setDataFields(["Total"]);
graph.addElement(elem)
graph.setScale("Quantity", qscale);

Scale.setFields(field)

Specifies the fields to which the scale should be applied.

Parameter

field
 a String containing a column name
Example (Report or Viewsheet)
importPackage(inetsoft.graph)
importPackage(inetsoft.graph.data)
importPackage(inetsoft.graph.scale)
importPackage(inetsoft.graph.aesthetic)
importPackage(inetsoft.graph.element)
importPackage(inetsoft.graph.coord)
 
var arr = [["State","Quantity"],["NJ",100],["NY",4000]];
dataset = new DefaultDataSet(arr);
graph = new EGraph();
var qscale = new LogScale();
var elem = new IntervalElement("State", "Quantity");
qscale.setFields(["Quantity"]);
var coord = new RectCoord(new CategoricalScale("State"),
            qscale)
graph.setCoordinate(coord);
graph.addElement(elem);

Scale.setScaleOption(value)

Specifies a scaling option for the default scaling. The Scale.TICKS and Scale.ZERO options determine the maximum and minimum values that are used to calculate the scale range.

The Scale.TICKS option uses the maximum and minimum tick values (i.e., rounded numbers) rather than the maximum and minimum data values. The Scale.ZERO option uses zero as the minimum rather than the minimum data value (if positive). To combine multiple options, use the pipe (“or”) operator:

qscale.setScaleOption(Scale.ZERO | Scale.TICKS);

Parameter

 value
  Scale.NO_NULL  (remove NULL-data gaps in scale) 
  Scale.TICKS    (use ticks in scale range calculation) 
  Scale.ZERO     (use zero in scale range)

Example (Report or Viewsheet)

importPackage(inetsoft.graph)
importPackage(inetsoft.graph.data)
importPackage(inetsoft.graph.scale)
importPackage(inetsoft.graph.aesthetic)
importPackage(inetsoft.graph.element)
importPackage(inetsoft.graph.coord)
 
var arr = [["State", "Quantity"], ["NJ", 200], ["NY", 300]];
dataset = new DefaultDataSet(arr);
graph = new EGraph();
var elem = new IntervalElement("State", "Quantity");
var sscale = new CategoricalScale("State");
var qscale = new LinearScale("Quantity");
var coord = new RectCoord(sscale,qscale);
qscale.setScaleOption(Scale.ZERO);
graph.setCoordinate(coord);
graph.addElement(elem);
Read why choosing InetSoft's cloud-flexible BI provides advantages over other BI options.

Previous: Chart Reference