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.

Documentation

Library path

Simple XML wrapper

Properties

Name

Default value

Description

id Required. The unique ID for this control.
afterLabel""The label to display before (to the left of) the value.
beforeLabel""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.
data"preview"The type of data to retrieve from the search results
results | preview | events | summary | timeline ).
field""The search field to use as the display value.
manageridnullThe ID of the search manager to bind this view to.
underLabelnullThe label to display below the value.

Methods

Name

Description

renderDraws the view to the screen. Called only when you create the view manually in JavaScript.

Example (Django tag)

{% single id="example-single" managerid="example-search" beforeLabel="Event count:" %}

Example (JavaScript)

<script>
    var deps = [
        "splunkjs/ready!",
        "splunkjs/mvc/singleview"
    ];
    require(deps, function(mvc) {
        var SingleView = require("splunkjs/mvc/singleview");

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

    });
</script>

Code examples