Class ResultGauge
- All Implemented Interfaces:
Serializable,Portlet,ComplexCalculationResult
In some views, the gauge is drawn as a horizontal bar with a marker instead of the dial. The bar uses the same value, range and sectors.
Create an instance with api.newGauge() and return it from a logic element.
Example:
def gauge = api.newGauge()
gauge.setMin(0)
gauge.setMax(100)
gauge.setValue(37)
gauge.addSector(20, "#FF0000")
gauge.addSector(50, "#FFFF00")
gauge.addSector(null, "#00FF00")
return gauge
- See Also:
-
Field Summary
Fields inherited from class AbstractPortletDto
dragDropEnabled, layout, messages, resizingEnabled -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddSector(BigDecimal upperBound, String color) Adds a colored sector to the dial.getMax()The maximum dial value.getMin()The minimum dial value.Returns the tooltip prefix set withsetPrefix(String).Returns the result type of the gauge.Returns the sectors added withaddSector(BigDecimal, String).Returns the tooltip suffix set withsetSuffix(String).getValue()The current value on the dial.voidsetMax(BigDecimal maxValue) The maximum dial value.voidsetMin(BigDecimal minValue) The minimum dial value.voidSets the tooltip prefix, the text before the value in the tooltip of the dial.voidSets the tooltip suffix, the text after the value in the tooltip of the dial.voidsetValue(BigDecimal value) The current value on the dial.Methods inherited from class AbstractPortletDto
getLabelOverride, layout, setLabelOverride, setLayout, value, withDragDrop, withError, withHeight, withHeight, withInfo, withLabelOverride, withLayout, withLayout, withLayout, withResizing, withTab, withWarning, withWidth, withWidth
-
Constructor Details
-
ResultGauge
public ResultGauge()Not intended for public use. Useapi.newGauge()instead.- See Also:
-
-
Method Details
-
getValue
The current value on the dial.- Returns:
- The value set with
setValue(BigDecimal), or 0 if it is not set.
-
setValue
The current value on the dial.The gauge shows a value below the minimum dial value at the minimum, and a value above the maximum dial value at the maximum.
- Parameters:
value- the new dial value. Default value is 0
-
getMin
The minimum dial value.- Returns:
- The minimum dial value set with
setMin(BigDecimal).
-
setMin
The minimum dial value.- Parameters:
minValue- the new minimum dial value. If it is not set, the gauge uses 0.
-
getMax
The maximum dial value.- Returns:
- The maximum dial value set with
setMax(BigDecimal).
-
setMax
The maximum dial value.- Parameters:
maxValue- the new maximum dial value. If it is not set, the gauge uses 100.
-
addSector
Adds a colored sector to the dial.Sectors are drawn in the order they are added. The first sector starts at the minimum dial value, and each next sector starts where the previous one ends. Use
nullas the upper bound of the last sector to extend it to the maximum dial value.- Parameters:
upperBound- The dial value where the sector ends, ornullto end it at the maximum dial value.color- The CSS color of the sector, for example"#FF0000".
-
getSectors
Returns the sectors added withaddSector(BigDecimal, String).- Returns:
- The sectors in the order they were added. Each sector is a map with these keys:
- upperBound: the dial value where the sector ends, or
null - color: the CSS color of the sector
- upperBound: the dial value where the sector ends, or
-
getSuffix
Returns the tooltip suffix set withsetSuffix(String).- Returns:
- The tooltip suffix.
-
setSuffix
Sets the tooltip suffix, the text after the value in the tooltip of the dial.The tooltip does not show the suffix at the moment. It always shows the value without a suffix.
- Parameters:
suffix- the new tooltip suffix.
-
getPrefix
Returns the tooltip prefix set withsetPrefix(String).- Returns:
- The tooltip prefix.
-
setPrefix
Sets the tooltip prefix, the text before the value in the tooltip of the dial.The value label on the dial and the bar do not show the prefix.
- Parameters:
prefix- the new tooltip prefix. If it is not set, the tooltip shows no prefix.
-
getResultType
Returns the result type of the gauge.- Specified by:
getResultTypein interfaceComplexCalculationResult- Returns:
- Always
"GAUGE".
-