InetSoft Product Information: Chart Code

AxisSpec.setAbbreviate(boolean)

Specifies that the common prefix of TimeScale labels should be omitted to conserve space. This property is only observed when a Date format is specified.

Parameter
 Boolean
 true: drop common prefixes
 false: do not drop prefixes
Example (Report or Viewsheet)
 importPackage(inetsoft.graph)
 importPackage(inetsoft.graph.data)
 importPackage(inetsoft.graph.element)
 importPackage(inetsoft.graph.aesthetic)
 importPackage(inetsoft.graph.scale)
 importPackage(inetsoft.graph.coord)
 importPackage(inetsoft.graph.guide.form)
 
 var date1 = new Date();
 var date2 = new Date();
 date1.setFullYear(2008,0,1);
 date2.setFullYear(2008,10,1);
 var arr = [["Date", "Quantity"], [date1,200], [date2,300]];
 dataset = new DefaultDataSet(arr);
 graph = new EGraph();
 var elem = new IntervalElement("Date", "Quantity");
 var tscale = new TimeScale("Date");
 var aspec = new AxisSpec();
 var tspec = new TextSpec();
 tspec.setFormat(java.text.SimpleDateFormat('yyyy-MMM'));
 aspec.setTextSpec(tspec);
 aspec.setAbbreviate(true);
 tscale.setAxisSpec(aspec);
 graph.setScale("Date", tscale);
 graph.addElement(elem);
Read how InetSoft was rated #3 for implementation in G2 Crowd's user survey-based index.

AxisSpec.setAxisStyle(value)

Specifies the axis style.

Parameter
 value
 AxisSpec.AXIS_SINGLE  (axes on left/bottom)
 AxisSpec.AXIS_SINGLE2 (axis on top/right)
 AxisSpec.AXIS_DOUBLE  (both axes, left/bot labels)
 AxisSpec.AXIS_DOUBLE2 (both axes, top/right labels)
 AxisSpec.AXIS_CROSS   (axis at zero-position)
 AxisSpec.AXIS_NONE    (axis not drawn)
Example (Report or Viewsheet)
 importPackage(inetsoft.graph)
 importPackage(inetsoft.graph.data)
 importPackage(inetsoft.graph.element)
 importPackage(inetsoft.graph.aesthetic)
 importPackage(inetsoft.graph.scale)
 importPackage(inetsoft.graph.coord)
 importPackage(inetsoft.graph.guide.form)
 
 var arr = [["State","Quantity"],["NJ",20000],["NY",30000]];
 dataset = new DefaultDataSet(arr);
 graph = new EGraph();
 var elem = new IntervalElement("State", "Quantity");
 var qscale = new LinearScale("Quantity");
 var aspec = new AxisSpec();
 aspec.setAxisStyle(AxisSpec.AXIS_DOUBLE2);
 qscale.setAxisSpec(aspec);
 graph.setScale("Quantity", qscale);
 graph.addElement(elem);

AxisSpec.setGridAsShape(boolean)

Specifies whether axis grid lines are represented as shapes or positions. If represents as shapes, the grid lines can be transformed into curves under a coordinate transformation (for example, transformation of rectangular to polar coordinates). Otherwise, the grid lines remain straight, and only the endpoints are transformed.

Parameter
 Boolean
 true if represented as shape
 false if represented as position

AxisSpec.setGridColor(value)

Specifies the color of the axis grid lines.

Parameter
 value
 a java.awt.Color object
Example (Report or Viewsheet)
 importPackage(inetsoft.graph)
 importPackage(inetsoft.graph.data)
 importPackage(inetsoft.graph.element)
 importPackage(inetsoft.graph.aesthetic)
 importPackage(inetsoft.graph.scale)
 importPackage(inetsoft.graph.coord)
 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");
 var form = new LabelForm();
 form.setLabel("label1");
 form.setValues(['NY', 100]);
 var spec = new TextSpec();
 spec.setBackground(java.awt.Color(0xcccccc));
 form.setTextSpec(spec)
 graph.addForm(form);
 graph.addElement(elem);

AxisSpec.setGridOnTop(boolean)

Specifies whether axis grid lines are layered over or under the chart elements.

Parameter
 Boolean
 true: grid overlays elements
 false: elements overlay grid
Example (Report or Viewsheet)
 importPackage(inetsoft.graph)
 importPackage(inetsoft.graph.data)
 importPackage(inetsoft.graph.element)
 importPackage(inetsoft.graph.aesthetic)
 importPackage(inetsoft.graph.scale)
 importPackage(inetsoft.graph.coord)
 importPackage(inetsoft.graph.guide.form)
 
 var arr = [["State","Quantity"],["NJ",20000],["NY",30000]];
 dataset = new DefaultDataSet(arr);
 graph = new EGraph();
 var elem = new IntervalElement("State", "Quantity");
 var qscale = new LinearScale("Quantity");
 var aspec = new AxisSpec();
 aspec.setGridOnTop(true);
 aspec.setGridColor(java.awt.Color(0xff0000));
 aspec.setGridStyle(Chart.DASH_LINE);
 qscale.setAxisSpec(aspec);
 graph.setScale("Quantity", qscale);
 graph.addElement(elem);
Previous: Dashboard Code
Next: Axis Grid