Scale.setFields(field)
Specifies the fields to which the Scale should be applied. The corresponding “getter” function is getFields().
Example
Chart Component Script
dataset = [["State","Quantity"],["NJ",100],["NY",4000]]; (1)
graph = new EGraph();
var qscale = new LogScale(); (2)
var elem = new IntervalElement("State", "Quantity");
qscale.setFields(["Quantity"]); (3)
var coord = new RectCoord(new CategoricalScale("State"), qscale); (4)
graph.setCoordinate(coord); (5)
graph.addElement(elem);
| 1 | See dataset to use a data block instead of an array literal. |
| 2 | Create the Scale object. |
| 3 | Use setFields to apply the Scale to the ‘Quantity’ field. |
| 4 | Use the Scale to create a new Coordinate. |
| 5 | Use EGraph.setCoordinate(coord) to add the Coordinate to the Chart. |

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.
|