CT.8 Changing the Appearance of Chart Elements

You can change the static appearance of chart elements by using a static VisualFrame. For example, you can set static colors, sizes, and textures to enhance the aesthetic appearance of a chart.

Consider the script below:

Note: Script that modifies 'graph' should be placed at the element level. See Adding Element-Level Script in Report Scripting and Adding Component Script in Dashboard Scripting for more information.

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

graph = new EGraph();

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

graph.addElement(elem);

 

This creates a basic point (scatter) chart displaying the dimensions 'State' and 'Quantity'. However, the points are rather small and hard to see. To increase the size of the points and assign them a bolder color, use a StaticColorFrame and a StaticSizeFrame.

Follow these steps:

1. Create a new StaticColorFrame object, and specify a static color (red).

var cframe = new StaticColorFrame();

cframe.setColor(java.awt.Color(0xff0000)); // red

2. Create a new StaticSizeFrame object, and specify a static size.

var sframe = new StaticSizeFrame();

sframe.setSize(10);

3. Assign the StaticColorFrame and StaticSizeFrame objects to the GraphElement object.

elem.setColorFrame(cframe);

elem.setSizeFrame(sframe);

 

The complete script is shown below. The points are now large and red.

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

graph = new EGraph();

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

var cframe = new StaticColorFrame();

cframe.setColor(java.awt.Color(0xff0000)); // red

var sframe = new StaticSizeFrame();

sframe.setSize(10);

elem.setColorFrame(cframe);

elem.setSizeFrame(sframe);

graph.addElement(elem);

Because these are static VisualFrames, the color and size are not keyed to the data. To represent data values using color, size, or other visual attributes, see Representing Data with Shape, Color, Size.

See Also

Representing Data with Shape, Color, Size, to use dynamic VisualFrame objects.

Adding Decorative Elements, for information on GraphForm objects.

<< CT.7.2 Changing Scaling for a VisualFrame © 1996-2013 InetSoft Technology Corporation (v11.4) CT.9 Changing Axis Properties >>