Bullet Configuration

An object that specifies configuration options for the dxBullet widget.

color

Specifies a color for the bullet bar.

Type: String
Default Value: '#e8c267'

This option supports the following colors.

  • hexadecimal colors
  • RGB colors
  • RGBA colors (not supported in Internet Explorer 8)
  • predefined/cross-browser color names
  • predefined SVG colors (not supported in Internet Explorer 8)

To specify a color for the target and zero level lines, use the targetColor option.

Show Example:
jQuery

In this example, the bullet bar color is changed to powderblue using the color option.

<div id="bulletContainer" style="height:30px;max-width:300px;margin:0 auto;margin-top:55px"></div>
$(function () {
    $("#bulletContainer").dxBullet({
        startScaleValue: 0,
        endScaleValue: 100,
        target: 68,
        value: 42,
        color: 'powderblue'
    });
})

endScaleValue

Specifies an end value for the invisible scale.

Type: Number
Default Value: undefined

The main, target and zero values of the dxBullet widget are held within a range. This range is represented by an invisible scale. To specify the boundary values of this scale, set the startScaleValue and endScaleValue options.

Specify the same start and end scale values for bullets when you display them in a column so that they can be compared visually.

Show Example:
jQuery

In this example, the scale is defined using the startScaleValue and endScaleValue options.

<div id="bulletContainer" style="height:30px;max-width:300px;margin:0 auto;margin-top:55px"></div>
$(function () {
    $("#bulletContainer").dxBullet({
        startScaleValue: 0,
        endScaleValue: 100,
        target: 54,
        value: 59,
        color: 'greenyellow'
    });
})

margin

Specifies the blank space between the widget's extreme elements and the boundaries of the area provided for the widget in pixels.

Type: Object

Set the required values for the left, right, top and bottom margins using the corresponding options of the margin object.

pathModified

Notifies a widget that it is embedded into the HTML page that uses a path modifier.

Type: Boolean
Default Value: false
Accepted Values: true|false

If you place a widget on a page that uses a path modifier, notify the widget about it by setting the pathModified option to true. As an example of such modifiers, the base HTML tag can be considered. Also, we recommend you to enable this option if you place the widget inside the <iframe> tag.

showTarget

Specifies whether or not to show the target line.

Type: Boolean
Default Value: true
Accepted Values: true | false

If the target line is visible, you can adjust its color and width using the targetColor and targetWidth options respectively.

Show Example:
jQuery

Toggle the check box below to show/hide the bullet target line.

<div id="bulletContainer" style="height:30px;max-width:300px;margin:0 auto;margin-top:55px"></div>
<div id="checkboxContainer" style="height:20px;max-width:200px;margin:5px auto;font-family:'Trebuchet MS',Arial,sans-serif;font-size:14px;text-align:center">
    <input type="checkbox" id="showTargetCheckbox" checked> Show the Target Line
</div>
$(function () {
    $("#bulletContainer").dxBullet({
        startScaleValue: 0,
        endScaleValue: 100,
        target: 86,
        value: 94
    });

    $('#showTargetCheckbox').change(function () {
        var bullet = $('#bulletContainer').dxBullet('instance');
        bullet.option({
            showTarget: this.checked
        });
    });
})

showZeroLevel

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

Type: Boolean
Default Value: true
Accepted Values: true | false

If the zero level line is visible, its color is defined by the targetColor option.

NOTE: If zero does not belong to the range set by the startScaleValue and endScaleValue options, the zero line is not visible even if the showZeroLevel option is set to true.

Show Example:
jQuery

Toggle the check box below to show/hide the bullet zero level line.

<div id="bulletContainer" style="height:30px;max-width:300px;margin:0 auto;margin-top:55px"></div>
<div id="checkboxContainer" style="height:20px;max-width:200px;margin:5px auto;font-family:'Trebuchet MS',Arial,sans-serif;font-size:14px;text-align:center">
    <input type="checkbox" id="showZeroLevelCheckbox" checked> Show the Zero Level Line
</div>
$(function () {
    $("#bulletContainer").dxBullet({
        startScaleValue: 0,
        endScaleValue: 100,
        target: 68,
        value: 75,
        color: 'plum'
    });

    $('#showZeroLevelCheckbox').change(function () {
        var bullet = $('#bulletContainer').dxBullet('instance');
        bullet.option({
            showZeroLevel: this.checked
        });
    });
})

size

Specifies the size of the widget.

Type: Object

By default, the widget occupies the entire area of the parent container (division). If the container width or height is set to zero, the widget is not displayed.

If you need to set a particular size for the widget, different from the container's size, use the size configuration object. Assign a height and width in pixels to the height and width options of the size object.

NOTE: The size configuration object reserves space for the main widget elements, while displaying a tooltip may require extra space. Refer to the tooltip object description to find ways to resolve this issue.

Show Example:
jQuery

In this example, the size of the widget differs from the container size.

<div id="bulletContainer" style="height:60px;max-width:700px;margin:0 auto;border:1px solid skyblue"></div>
$(function () {
    $("#bulletContainer").dxBullet({
        startScaleValue: 0,
        endScaleValue: 100,
        target: 68,
        value: 42,
        color: 'rosybrown',
        tooltip: { enabled: false },
        size: {
            height: 35,
            width: 400
        }
    });
})

startScaleValue

Specifies a start value for the invisible scale.

Type: Number
Default Value: 0

The main, target and zero values of the dxBullet widget are contained within a range. This range is represented by an invisible scale. To specify the boundary values of this scale, set the startScaleValue and endScaleValue options.

Specify the same start and end scale values for bullets when you display them in a column so that they can be comparable visually.

Show Example:
jQuery

In this example, the scale is defined using the startScaleValue and endScaleValue options.

<div id="bulletContainer" style="height:30px;max-width:300px;margin:0 auto;margin-top:55px"></div>
$(function () {
    $("#bulletContainer").dxBullet({
        startScaleValue: 0,
        endScaleValue: 100,
        target: 54,
        value: 34,
        color: 'cornflowerblue'
    });
})

target

Specifies the value indicated by the target line.

Type: Number
Default Value: 0

Show Example:
jQuery

In this example, the target value is specified using the target option.

<div id="bulletContainer" style="height:30px;max-width:300px;margin:0 auto;margin-top:55px"></div>
$(function () {
    $("#bulletContainer").dxBullet({
        startScaleValue: 0,
        endScaleValue: 1000,
        target: 459,
        value: 694,
        color: 'tomato'
    });
})

targetColor

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

Type: String
Default Value: '#666666'

This option supports the following colors.

  • hexadecimal colors
  • RGB colors
  • RGBA colors (not supported in Internet Explorer 8)
  • predefined/cross-browser color names
  • predefined SVG colors (not supported in Internet Explorer 8)

To specify a color for the bullet bar, use the color option.

Show Example:
jQuery

In this example, the color of the target and zero lines is changed to firebrick using the targetColor option.

<div id="bulletContainer" style="height:30px;max-width:300px;margin:0 auto;margin-top:55px"></div>
$(function () {
    $("#bulletContainer").dxBullet({
        startScaleValue: 0,
        endScaleValue: 1000,
        target: 459,
        value: 694,
        targetColor: 'firebrick'
    });
})

targetWidth

Specifies the width of the target line.

Type: Number
Default Value: 4

Show Example:
jQuery

In this example, the target line width is changed using the targetWidth option.

<div id="bulletContainer" style="height:30px;max-width:300px;margin:0 auto;margin-top:55px"></div>
$(function () {
    $("#bulletContainer").dxBullet({
        startScaleValue: -100,
        endScaleValue: 700,
        target: 600,
        value: 584,
        targetColor: 'green',
        //targetWidth: 8,
        showZeroLevel: true
    });
})

theme

Specifies the name of the theme to be applied.

Type: String
Default Value: 'desktop'

Use this option to specify the name of the theme that should be applied to the widget. For information on customizing and implementing themes, refer to the Themes topic.

Show Example:
jQuery

In this example, a green theme is implemented on the base of the default theme. This theme is applied to the dxBullet widget using the theme option.

<div id="bulletContainer" style="height:30px;max-width:300px;margin:0 auto;margin-top:55px"></div>
var myTheme = {
    name: 'bulletGreenTheme',
    bullet: {
        color: 'lightgreen',
        targetColor: 'forestgreen',
        tooltip: {
            color: 'limegreen'
        }
    }
};
DevExpress.viz.core.registerTheme(myTheme, 'default');
$(function () {
    $("#bulletContainer").dxBullet({
        theme: 'bulletGreenTheme',
        startScaleValue: 5,
        endScaleValue: 100,
        target: 68,
        value: 50
    });
})

tooltip

Specifies tooltip options.

Type: Object

A tooltip is a small pop-up rectangle that displays information about a widget when it is hovered over. You can enable or disable a tooltip, change its default appearance and format or customize the displayed text using the options of the tooltip configuration object.

NOTE: A tooltip is displayed outside the widget's container. If you plan to use the tooltip, make sure there is enough space around your widget to display it. For example, you can apply a margin to the widget's container to reserve the area around the widget for the tooltip.

Show Example:
jQuery

In this example, several tooltip options are altered. The tooltip is colored in 'seashell' using the color option. The main and target values are displayed in the 'fixedPoint' format with a precision of 2. In addition, tooltip font options are changed.

<div id="bulletContainer" style="height:30px;max-width:300px;margin:0 auto;margin-top:55px"></div>
$(function () {
    $("#bulletContainer").dxBullet({
        startScaleValue: 0,
        endScaleValue: 100,
        target: 68.9513,
        value: 79.441,
        color: 'powderblue',
        tooltip: {
            color: 'seashell',
            format: 'fixedPoint',
            precision: 2,
            font: {
                color: 'crimson',
                size: 10,
                family: 'Zapf-Chancery, cursive',
                opacity: 0.75,
                weight: 400
            }
        }
    });
})

value

Specifies the value indicated by the bullet bar.

Type: Number
Default Value: 0

Show Example:
jQuery

In this example, you can change the value indicated by the bullet bar using the button below. If this value is greater than the target value, the bullet bar becomes red. Otherwise, it is colored in blue.

<div id="bulletContainer" style="height:30px;max-width:300px;margin:0 auto"></div>
<div id="controlContainer" style="height:20px;max-width:300px;margin:5px auto;font-family:'Trebuchet MS',Arial,sans-serif;font-size:14px;text-align:center">
    <input type="button" id="changeValueButton" value="Change the Bullet Value by 1">
</div>
$(function () {
    $("#bulletContainer").dxBullet({
        startScaleValue: 0,
        endScaleValue: 100,
        target: 68,
        value: 0,
        tooltip: { enabled: false },
        color: 'blue'
    });

    var moveAscending = true;
    $('#changeValueButton').click(function () {
        var bullet = $('#bulletContainer').dxBullet('instance');
        var val = bullet.option('value');
        var scaleStart = bullet.option('startScaleValue');
        var scaleEnd = bullet.option('endScaleValue');
        var targetValue = bullet.option('target');
        if (val == scaleStart) { moveAscending = true };
        if (val == scaleEnd) { moveAscending = false };
        if (val == targetValue) {
            moveAscending ? bullet.option('color', 'red') : bullet.option('color', 'blue');
        };
        moveAscending ? val++ : val--;
        bullet.option('value', val);
    });
})