CR.7.12  CategoricalColorFrame

The CategoricalColorFrame object contains a color frame that returns a distinct color for each unique value in the bound field. To create a CategoricalColorFrame object, call the CategoricalColorFrame constructor.

var frame = new CategoricalColorFrame('State');

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.

Note: Report script that modifies 'bindingInfo' should be placed in the onLoad handler.

Example (Report)

Bind a bar-type chart to the sample 'All Sales' query, with 'Company' (top 5) on the X-axis, and Sum(Total) on the Y-axis. Add the following script in the onLoad handler.

Chart1.bindingInfo.setColorField("Employee",Chart.STRING);

Chart1.bindingInfo.colorFrame = new CategoricalColorFrame;

 

Note: Script that modifies 'graph' should be placed at the element level. See Adding Element-Level Script in Report Scripting and Adding Component Script in Dashboard Scripting for more information.

Example (Report or Viewsheet)

dataset = [["State", "Quantity"], ["NJ",20], ["NY",40]];

graph = new EGraph();

var elem = new IntervalElement("State", "Quantity");

var frame = new CategoricalColorFrame();

frame.setField("State");

elem.setColorFrame(frame);

graph.addElement(elem);

 

Full Name

inetsoft.graph.aesthetic.CategoricalColorFrame

CategoricalColorFrame: getColor, init, setColor

See Also

DataSet, to use a Data Block or query as the dataset source.

<< CR.7.11 RGBCubeColorFrame © 1996-2013 InetSoft Technology Corporation (v11.4) CategoricalColorFrame.getColor(val) >>