TextFrame.setText(value,text)

Specifies the mapping between a value and the text that should be displayed. The corresponding “getter” function is getText(value).

Parameters

value

the data value to be replaced

text

the replacement string

Example 1

Chart Component Script
dataset = [["State", "Quantity"], ["NJ",200], ["NY",300]]; (1)
graph = new EGraph();
var elem = new IntervalElement("State", "Quantity");
var tframe = new DefaultTextFrame("State"); (2)
tframe.setText('NJ','New Jersey'); (3)
tframe.setText('NY','New York'); (3)
elem.setTextFrame(tframe); (4)
graph.addElement(elem);
1 See dataset to use a data block instead of an array literal.
2 Create the DefaultTextFrame object.
3 Use setText to assign the desired labels to ‘NJ’ and ‘NY’.
4 Use GraphElement.setTextFrame(frame) to add the DefaultTextFrame to the IntervalElement.

TextFrame2setText

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.

To change the property on a Chart that was previously created with the Chart Editor, use “getter” methods such as EGraph.getElement(index) ① and GraphElement.getTextFrame() ② to obtain a handle to the desired GraphElement and TextFrame. For example:

var elem = graph.getElement(0); (1)
var frame = elem.getTextFrame(); (2)
// Compact syntax: var frame = graph.getElement(0).getTextFrame();

frame.setText('NJ','New Jersey');
frame.setText('NY','New York');