This recipe shows how to change needle color based on Value Example 2.
Major steps include the following:
- Create a blank report template (hosts.rml) using the datasource (cpu.ds).
- Add a Meter Half Chord chart in the blank area under “Section Header”.
- Enter the following script in the “Script” tab page:if (cxt!=null)
{
var Data = cxt.getData();
var value = Data.getMax(“Value”).getValueOverGroup();
var str2 = Data.getMax(“STR2”).getValueOverGroup();
if (value>str2) plot.setNeedlePaint(java.awt.Color.red);
else plot.setNeedlePaint(java.awt.Color.blue);
}
To download the necessary files for this recipe, refer to the attached ZIP package.
ChangeNeedleColorBasedOnValueEg2.zip (4.6 KB)