SizeFrame
The SizeFrame object contains the size scale for visual chart objects. You can use a SizeFrame object to represent data dimensions with size (size coding), or to apply a fixed (static) size. To create a SizeFrame, use a constructor such as LinearSizeFrame or StaticSizeFrame.
You can pass the name of a field (e.g., ‘State’) to the constructor, or specify this later using the inherited VisualFrame.setField(field) property. You can also assign a SizeFrame using the bindingInfo.sizeFrame property in onRefresh script. See Example 2 below.
SizeFrame provides the following special methods:
Example 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 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. -
Add the following script to the Chart component. (See Add Component Script.)
Chart Component Scriptvar elem = Chart1.graph.getElement(0); (1) var frame = new StaticSizeFrame(); (2) frame.setSize(30); elem.setSizeFrame(frame); (3)1 Use EGraph.getElement(index) to get a handle to the PointElement. 2 Create the StaticSizeFrameobject.3 Use GraphElement.setSizeFrame(frame) to add the StaticSizeFrameto the PointElement.
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
This example illustrates how to use bindingInfo properties to control the SizeFrame.
-
Bind a Bar 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 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. -
Add the following script in the onRefresh handler. (See Add Dashboard Script.)
onRefresh ScriptChart1.bindingInfo.setSizeField("Total",Chart.NUMBER); Chart1.bindingInfo.sizeFrame = new LinearSizeFrame; Chart1.bindingInfo.sizeFrame.smallest = 10; Chart1.bindingInfo.sizeFrame.largest = 50; Chart1.bindingInfo.sizeFrame.max = 100;
Dashboard script that modifies bindingInfoshould generally be placed in the onRefresh handler. See Add Dashboard Script.