StaticColorFrame.setNegativeColor(value)

Specifies the static color to be used for negative field values. If a value is specified for StaticColorFrame.setNegativeColor(), then StaticColorFrame.setColor() defines the color of positive values, and StaticColorFrame.setNegativeColor() defines the color of negative values. In this case, the inherited VisualFrame.setField(field) property is not used.

Value (Property Syntax)

java.awt.Color          e.g., java.awt.Color.BLUE

number (hex)            e.g., 0xFF0000

string (color name)     e.g., 'red'

array [r,g,b]           e.g., [255,0,0]

JSON {r:#,g:#,b:#}      e.g., {r:255,g:0,b:0}

Value (Function Syntax)

value a java.awt.Color object

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

Example (Report)

In this example, you will set the color of negative values for a bar chart. Follow the steps below:

1. Create a new report, and add a Chart component to the report.

2. Click on the chart to open the Chart Editor.

3. In the Data tab of the Chart Editor, expand the 'All Sales' query.

4. Drag the 'Order Date' field from the Data tab to the 'X' region.

5. Press the 'Edit Dimension' button next to the 'X' region. Select 'Quarter' from the 'Level' menu, and press 'Apply'.

6. Drag the 'Total' field from the Data tab to the 'Y' region.

7. Press the 'Edit Measure' button next to the 'Y' region. Select 'Change from Previous' from the 'Calculate' menu, and press 'Apply'.

8. Drag the 'Total' field from the Data tab to the 'Color' region.

9. Press the 'Edit Measure' button next to the 'Color' region. Select 'Change from Previous' from the 'Calculate' menu, and press 'Apply'.

 

10. Add the following script in the onLoad handler.

Chart1.bindingInfo.colorFrame = new StaticColorFrame;

Chart1.bindingInfo.colorFrame.color = 0x00FF00;

Chart1.bindingInfo.colorFrame.negativeColor = 0xFF0000;

Note: You can use highlighting to achieve the same effect with­out script.

11. Preview the report, and observe that negative-valued bars are displayed in the specified static color.

 

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 (Viewsheet or Report)

dataset = [["State", "Quantity"], ["NJ",200], ["NY",-300]];

graph = new EGraph();

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

var frame = new StaticColorFrame();

frame.setField("Quantity");

frame.setColor(java.awt.Color(0x00ff00));

frame.setNegativeColor(java.awt.Color(0xff0000));

elem.setColorFrame(frame);

graph.addElement(elem);

 

See Also

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

<< StaticColorFrame.setColor(value) © 1996-2013 InetSoft Technology Corporation (v11.4) CR.7.7 CircularColorFrame >>