StaticShapeFrame

The StaticShapeFrame object contains a shape frame defined by explicit shape data in the VisualFrame.setField(field) column, or by the fixed shape in StaticShapeFrame.setShape(shape). To create a StaticShapeFrame object, call the StaticShapeFrame constructor.

var frame = new StaticShapeFrame('GShape.CIRCLE');

You can pass a GShape or GShape.ImageShape object (e.g., GShape.CIRCLE, SVGShape.FACE_BLANK) or a field name (e.g., ‘Shape’) to the constructor, or specify this later using the StaticShapeFrame.setShape(shape) or inherited VisualFrame.setField(field) functions.

Example 1

Chart Component Script
dataset = [["State","Quantity","Shape"], ["NJ",200,"STAR"], ["NY",300,"CIRCLE"]]; (1)
graph = new EGraph();
var elem = new PointElement("State", "Quantity");
var sizeframe = new StaticSizeFrame(5);
var shapeframe = new StaticShapeFrame(); (2)
shapeframe.setField("Shape");
elem.setShapeFrame(shapeframe); (3)
elem.setSizeFrame(sizeframe);
graph.addElement(elem);
1 See dataset to use a data block instead of an array literal.
2 Create the StaticShapeFrame object.
3 Use GraphElement.setShapeFrame(frame) to add the StaticShapeFrame to the PointElement.

StaticShapeFrame2

Script that modifies the graph or dataset properties should be placed on the Chart component itself. See Add Component Script for more information. This script has access to the Chart data and Chart API methods. Scripted Charts are not good candidates for user-modification, so you should deselect ‘Enable Ad Hoc Editing’ in the Chart Properties dialog box.

Example 2

Chart Component Script
dataset = [["State","Quantity"], ["NJ",200], ["NY",300]]; (1)
graph = new EGraph();
var elem = new PointElement("State","Quantity");
var shapeFrame = new StaticShapeFrame(SVGShape.FACE_HAPPY); (2)
var sizeFrame = new StaticSizeFrame(10);
elem.setSizeFrame(sizeFrame);
elem.setShapeFrame(shapeFrame); (3)
graph.addElement(elem);
1 See dataset to use a data block instead of an array literal.
2 Create the StaticShapeFrame object.
3 Use GraphElement.setShapeFrame(frame) to add the StaticShapeFrame to the PointElement.

StaticShapeFrameSVG

Script that modifies the graph or dataset properties should be placed on the Chart component itself. See Add Component Script for more information. This script has access to the Chart data and Chart API methods. Scripted Charts are not good candidates for user-modification, so you should deselect ‘Enable Ad Hoc Editing’ in the Chart Properties dialog box.

Example 3

This example illustrates how to use bindingInfo properties to control the ShapeFrame.

  1. Bind a Point Chart to the sample ‘All Sales’ Data Worksheet, with ‘Company’ (top 5) on the X-axis, and Sum(Total) on the Y-axis.

    The ‘All Sales’ Data Worksheet can be found in the Data Worksheet  Sample Queries folder. You may need to download the examples.zip file from GitHub into your environment. (This requires access to Enterprise Manager.) See Import and Export Assets for instructions on how to import.
  2. Add the following script in the onRefresh handler. (See Add Dashboard Script.)

    onRefresh Script
    Chart1.bindingInfo.setShapeField("Company",Chart.STRING);
    Chart1.bindingInfo.shapeFrame = new StaticShapeFrame;
    Chart1.bindingInfo.shapeFrame.setShape(GShape.ARROWBAR);

    StaticShapeFrame

    Dashboard script that modifies bindingInfo should generally be placed in the onRefresh handler. See Add Dashboard Script.