SingleView

The Single view

Description

The Single view displays a single value based on a search manager, which can be useful for showing an aggregate value such as a stats count.

Library path

Simple XML wrapper

Properties

Name

Default value

Description

id Required. The unique ID for this control.
afterLabel""Deprecated. The label to display before (to the left of) the value.
beforeLabel""Deprecated. The label to display after (to the right of) the value.
classField""When set to "range", works with the rangemap search command to visually convey severity (see the example below). For more on rangemap, see Using rangemap with single value panels.
colorBy"value"Specifies whether all single value components are colored by delta value's color ("trend"), or by value's severity color ("value"). Available colors are red, green, and black. By default, or if trendColorInterpretation is set to "standard", a positive trend color is green, a 0 trend value is black, and a negative trend value is red. If trendColorInterpretation is set to "inverse", a positive trend is red, negative is green.
colorMode"none"Specifies how the background is colored based on the range map severity ("block" displays the background with the range color with white text, and "none" displays a white background with text that uses the range color).
data"preview"The type of data to retrieve from the search results
results | preview | events | summary | timeline ).
drilldown"none"Indicates whether to enable drilldown ( "all" enables drilldown, "none" disables drilldown).
field""The search field to use as the display value.
height115Specifies the view height, in pixels.
manageridnullThe ID of the search manager to bind this view to.
numberPrecision"0"Specifies the number of decimal places to display. For decimal precision, indicate the number of places using "0." followed by up to four zeroes, for example "0.0" or "0.00".
rangeColors(severe: red | high: orange | elevated: yellow | guarded: blue | low: green)A string array that specifies the hex values for coloring the range order. The values map to each of the rangeValue ranges. The hex value format should be "0xFFFFFF" or "FFFFFF". If there are more rangeColor hex values than ranges, excess rangeColor values at end of array are ignored. If there are more rangeValues than rangeColors, excess rangeValues appear dark gray if metric falls within that range.
You can specify any number of colors.
rangeValuesA numeric array that specifies the range limits for coloring. If there are more rangeColor hex values than ranges, excess rangeColor values at end of array are ignored. If there are more rangeValues than rangeColors, excess rangeValues appear dark gray if metric falls within that range.
Use the rangeColors property to customize severity levels and colors.
settingsThe properties of the view. See the methods below to get and set values.
showSparklinetrueSpecifies whether the single value hides its sparkline, if available. A sparkline is available for searches that use the timechart search command for the search results.
showTrendIndicatortrueSpecifies whether the single value hides its delta value, if available.
trendColorInterpretation"standard"Specifies whether a field value greater than 0 is a positive ("standard") or negative ("inverse") development.
trendDisplayMode"absolute"Specifies whether the delta amount is displayed as a percentage ("percent") or an absolute count ("absolute").
trendInterval"auto"Specifies a time range in the past from which to calculate a delta from the most recent data point in the same metric. Use the search syntax for time modifiers to indicate the range. For more, see Specify time modifiers in your search in the Search Manual.
underLabelnullThe label to display below the value.
useColorsfalseSpecifies whether all single value components are colored. Set to true for text coloring and color options availability.
useThousandSeparatorstrueSpecifies whether to format the result value with thousand separators.

Methods

Name

Description

renderDraws the view to the screen. Called only when you create the view manually.
settings.get( property )Returns the value of property for the current component.
settings.set( propertyvalue )Sets the value of property to the specified value for the current component.

Example

require([
    "splunkjs/mvc/singleview",
    "splunkjs/mvc/simplexml/ready!"
], function(SingleView) {

    // Instantiate components
    new SingleView({
        id: "example-single",
        managerid: "example-search",
        beforeLabel: "Event count:",
        el: $("#mysingleview")
    }).render();

});