jQuery Bullet API

The Bullet widget is useful when you need to compare a single measure to a target value. The widget comprises a horizontal bar indicating the measure and a vertical line indicating the target value.

import Bullet from "devextreme/viz/bullet"
Type:

Object

DevExtreme widgets are integrated with many popular libraries and frameworks. See the Installation section (for JavaScript libraries) or the Prerequisites and Installation section (for ASP.NET MVC framework) to find details on setting up DevExtreme with a particular library or framework.

The following code shows how to create the Bullet widget using every supported library and framework. For more details on working with widgets in these libraries and frameworks, see the Widget Basics topic for jQuery, Angular, AngularJS, Knockout or ASP.NET MVC.

jQuery
JavaScript
HTML
$(function () {
    $("#bullet").dxBullet({
        startScaleValue: 0,
        endScaleValue: 35,
        value: 27,
        target: 24 
    });
});
<div id="bullet"></div>
Angular
HTML
TypeScript
<dx-bullet
    [startScaleValue]="0"
    [endScaleValue]="35"
    [value]="27"
    [target]="24">
</dx-bullet>
import { DxBulletModule } from "devextreme-angular";
// ...
export class AppComponent {
    // ...
}
@NgModule({
    imports: [
        // ...
        DxBulletModule
    ],
    // ...
})
AngularJS
HTML
<div dx-bullet="{
    startScaleValue: 0,
    endScaleValue: 35,
    value: 27,
    target: 24
}"></div>
Knockout
HTML
<div data-bind="dxBullet: {
    startScaleValue: 0,
    endScaleValue: 35,
    value: 27,
    target: 24 
}"></div>
ASP.NET MVC Controls
Razor C#
Razor VB
@(Html.DevExtreme().Bullet()
    .ID("bullet")
    .StartScaleValue(0)
    .EndScaleValue(35)
    .Value(27)
    .Target(24)
)
@(Html.DevExtreme().Bullet() _
    .ID("bullet") _
    .StartScaleValue(0) _
    .EndScaleValue(35) _
    .Value(27) _
    .Target(24)
)

View Demo Watch Video

See Also

Configuration

An object that specifies configuration options for the Bullet widget.

Name Description
color

Specifies a color for the bullet bar.

disabled

Specifies whether the widget responds to the user interaction.

elementAttr

Specifies the attributes to be attached to the widget's root element.

endScaleValue

Specifies an end value for the invisible scale.

margin

Generates space around the widget.

onDisposing

A function that is executed before the widget is disposed of.

onDrawn

A function that is executed when the widget's rendering has finished.

onExported

A function that is executed after the widget is exported.

onExporting

A function that is executed before the widget is exported.

onFileSaving

A function that is executed before a file with exported widget is saved to the user's local storage.

onIncidentOccurred

A function that is executed when an error or warning occurs.

onInitialized

A function that is executed only once, after the widget is initialized.

onOptionChanged

A function that is executed after a widget option is changed.

onTooltipHidden

A function that is executed when a tooltip becomes hidden.

onTooltipShown

A function that is executed when a tooltip appears.

pathModified

Notifies the widget that it is embedded into an HTML page that uses a tag modifying the path.

rtlEnabled

Switches the widget to a right-to-left representation.

showTarget

Specifies whether or not to show the target line.

showZeroLevel

Specifies whether or not to show the line indicating zero on the invisible scale.

size

Specifies the widget's size in pixels.

startScaleValue

Specifies a start value for the invisible scale.

target

Specifies the value indicated by the target line.

targetColor

Specifies a color for both the target and zero level lines.

targetWidth

Specifies the width of the target line.

theme

Sets the name of the theme the widget uses.

tooltip

Configures the tooltip.

value

Specifies the primary value indicated by the bullet bar.

Methods

This section describes the methods that can be used in code to manipulate objects related to the Bullet widget.

Name Description
beginUpdate()

Prevents the widget from refreshing until the endUpdate() method is called.

dispose()

Disposes of all the resources allocated to the Bullet instance.

element()

Gets the root widget element.

endUpdate()

Refreshes the widget after a call of the beginUpdate() method.

exportTo(fileName, format)

Exports the widget.

getInstance(element)

Gets the instance of a widget found using its DOM node.

getSize()

Gets the current widget size.

instance()

Gets the widget's instance. Use it to access other methods of the widget.

off(eventName)

Detaches all event handlers from a single event.

off(eventName, eventHandler)

Detaches a particular event handler from a single event.

on(eventName, eventHandler)

Subscribes to an event.

on(events)

Subscribes to events.

option()

Gets all widget options.

option(optionName)

Gets the value of a single option.

option(optionName, optionValue)

Updates the value of a single option.

option(options)

Updates the values of several options.

print()

Opens the browser's print window.

render()

Redraws the widget.

svg()

Gets the widget's SVG markup.

Events

This section describes events fired by this widget.

Name Description
disposing

Raised before the widget is disposed of.

drawn

Raised when the widget's rendering has finished.

exported

Raised after the widget is exported.

exporting

Raised before the widget is exported.

fileSaving

Raised before a file with exported widget is saved to the user's local storage.

incidentOccurred

Raised when an error or warning occurs.

initialized

Raised only once, after the widget is initialized.

optionChanged

Raised after a widget option is changed.

tooltipHidden

Raised when a tooltip becomes hidden.

tooltipShown

Raised when a tooltip appears.

See Also