InetSoft Product Information: Chart JS

EGraph.getForm(index)

Returns a handle to the GraphForm object specified by the index. This is useful in cases where the form was not explicitly assigned to a variable at creation time.

Parameter
 index Integer index of form
Example (Report or Viewsheet)
 importPackage(inetsoft.graph)
 importPackage(inetsoft.graph.data)
 importPackage(inetsoft.graph.element)
 importPackage(inetsoft.graph.aesthetic)
 importPackage(inetsoft.graph.guide.form)
 
 var arr = [["State", "Quantity"], ["NJ", 200], ["NY", 300]];
 dataset = new DefaultDataSet(arr);
 graph = new EGraph();
 var elem = new IntervalElement("State", "Quantity");
 graph.addForm(new LineForm());
 var form = graph.getForm(0);
 form.addPoint(java.awt.Point(100,100));
 form.addPoint(java.awt.Point(200,200));
 form.setColor(java.awt.Color(0xff0000));
 graph.addElement(elem);

EGraph.getFormCount()

Returns the number of forms currently present on the chart.

Example (Report or Viewsheet)
 importPackage(inetsoft.graph)
 importPackage(inetsoft.graph.data)
 importPackage(inetsoft.graph.element)
 importPackage(inetsoft.graph.aesthetic)
 importPackage(inetsoft.graph.guide.form)
 
 var arr = [["State", "Quantity"], ["NJ", 200], ["NY", 300]];
 dataset = new DefaultDataSet(arr);
 graph = new EGraph();
 var elem = new IntervalElement("State", "Quantity");
 graph.addForm(new LineForm());
 graph.addForm(new LineForm());
 graph.addForm(new LineForm());
 var formCount = graph.getFormCount();
 for (var i=0;i

EGraph.getScale(field)

Returns a handle to the Scale object specified by the field name parameter. This is useful in cases where the scale was not explicitly assigned to a variable at creation time.

Parameters
 field
 String representing field name
Example (Report)
Bind a bar-type chart to the sample 'All Sales' query, with 'Company' (top 5) on the X-axis, and Sum(Total) on the Y-axis. Add the following script:
 var scale = graph.getScale("Sum(Total)");
 scale.setMin(600000);
 scale.setMax(1000000);
Example (Viewsheet)
Create a Viewsheet based on the 'Sales Explore' Worksheet. Bind a bar-type chart with 'Company' (top 5) on the X-axis, and Sum(Total) on the Y-axis. Add the following script:
 var scale = graph.getScale("Sum(Total)");
 scale.setMin(600000);
 scale.setMax(1000000);
Previous: Chart JavaScript