Attributes for KPI Widgets
KPI widgets are configured in the type kpiWidget or one of its subitems. They can make use of the following attributes:
- color
Background color for the rectangle widget area, for example #A0B0C0. - footer
String to show at the bottom of the widget (shown in the left example as Number of accessible tickets), can be localized, see section Localization of String Values of Attributes for details. - height
Widget rectangle height in pixels (integer value). - localization
Localization definition for string values displayed, see section Localization of String Values of Attributes for details. - maxValueForSize
The numeric widget value above which the font size will be reduced in order to fit the value in the line inside the rectangle, default is 100000. - symbol
Character symbol or string to show as prefix for the numeric value. - title
String to show in the top line of the widget (shown in the left example as Open tickets), can be localized, see section Localization of String Values of Attributes for details. - trend
Identifier for the trending symbol to be shown after the numeric value (see the left example), valid identifiers are up, down, and flat. - value
The numeric value to be shown, normally it is not wanted that this is a fixed value, but it should be dynamically resolved. This, however, can only be achieved by a script, see below for details. Just entering a number here without using a script will always display this number only. - visible
A boolean value determining, if the widget should be rendered or not, identical to other widget types.
The following code provides an example of a KPI widget script:
import com.consol.cmas.common.model.ticket.*
import java.util.*
import com.consol.cmas.common.model.DateRange
TicketCriteria crt = new TicketCriteria()
def to_date = new Date()
def from_date = to_date - 7
def range = new DateRange(from_date,to_date)
crt.setCreationDateRange(range)
// crt.setStatus(TicketCriteria.Status.OPEN)
ticketcount = ticketService.getByCriteria(crt).size()
switch (ticketcount) {
case 0..25:
trendline = 'down'
break
case 26..50:
trendline = 'flat'
break
default:
trendline = 'up'
}
return[value: ticketcount as String, trend: trendline, visible: 'true']
Code example 34: Admin Tool script for a KPI widget which calculates the tickets which have been opened during the last week
The widget will be displayed in the Web Client as shown in the following figure.
Figure 288: ConSol CM Web Client - KPI widget on Dashboard page