CR.3 Getting and Setting Chart Properties

The Chart API provides “getter” and “setter” methods that allow you to read and write most chart properties from script. The following sections provide definitions and examples for the “setter” methods.

In general, you can call the “getter” method corresponding to a particular “setter” method by simply changing the method name prefix.

For example, the “getter” method corresponding to LabelForm.setAlignmentY() is LabelForm.getAlignmentY(). The following script illustrates how you can “get” the alignment of one chart component, and use it to “set” the alignment of another.

dataset = [["State","Quantity"], ["NJ",200], ["NY",300]];

graph = new EGraph();

var elem = new IntervalElement("State", "Quantity");

var form1 = new LabelForm();

var form2 = new LabelForm();

form1.setLabel("label1");

form1.setPoint(new java.awt.Point(100, 100));

form1.setAlignmentY(Chart.TOP_ALIGNMENT);

form2.setLabel("label2");

form2.setPoint(new java.awt.Point(200, 100));

form2.setAlignmentY(form1.getAlignmentY());

graph.addForm(form1);

graph.addForm(form2);

graph.addElement(elem);

Many attributes can also be accessed as object properties. For example:

form2.alignmentY = form1.alignmentY;

<< CR.2 Object Hierarchy © 1996-2013 InetSoft Technology Corporation (v11.5) CR.4 General Chart Properties >>