TextSpec.setRotation(value)

Specifies the text rotation in degrees. The corresponding “getter” function is getRotation().

Parameter

value

a number of degrees

Example

Chart Component Script
dataset = [["State","Quantity"],["NJ",20000],["NY",30000]]; (1)
graph = new EGraph();
var elem = new IntervalElement("State", "Quantity");
var qscale = new LinearScale("Quantity");
var aspec = new AxisSpec();
var tspec = new TextSpec(); (2)
tspec.setRotation(45); (3)
aspec.setTextSpec(tspec); (4)
qscale.setAxisSpec(aspec);
graph.setScale("Quantity", qscale);
graph.addElement(elem);
1 See dataset to use a data block instead of an array literal.
2 Create the TextSpec object.
3 Use setRotation() to assign the number format to the TextSpec.
4 Use AxisSpec.setTextSpec(spec) to assign the TextSpec to the AxisSpec.

TextSpecsetRotation

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.getCoordinate() ①, RectCoord.getYScale() ②, Scale.getAxisSpec() ③, and AxisSpec.getTextSpec() ④ to obtain a handle to the desired Coordinate, Scale, AxisSpec, and TextSpec. For example:

var coord = graph.getCoordinate(); (1)
var scale = coord.getYScale(); (2)
var spec = scale.getAxisSpec(); (3)
var textspec = spec.getTextSpec(); (4)
// Compact syntax: var textspec = graph.getCoordinate().getYScale().getAxisSpec().getTextSpec();

textspec.setRotation(45);