React Bullet Props

An object that specifies configuration properties for the Bullet UI component.

color

Specifies a color for the bullet bar.

Type:

String

Default Value: '#e8c267'

This property supports the following colors:

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

disabled

Specifies whether the UI component responds to user interaction.

Type:

Boolean

Default Value: false
Cannot be used in themes.

elementAttr

Specifies the global attributes to be attached to the UI component's container element.

Selector: ElementAttr
Type:

Object

Default Value: {}

jQuery
$(function(){
    $("#bulletContainer").dxBullet({
        // ...
        elementAttr: {
            id: "elementId",
            class: "class-name"
        }
    });
});
Angular
HTML
TypeScript
<dx-bullet ...
    [elementAttr]="{ id: 'elementId', class: 'class-name' }">
</dx-bullet>
import { DxBulletModule } from "devextreme-angular";
// ...
export class AppComponent {
    // ...
}
@NgModule({
    imports: [
        // ...
        DxBulletModule
    ],
    // ...
})
Vue
App.vue
<template>
    <DxBullet ...
        :element-attr="bulletAttributes">
    </DxBullet>
</template>

<script>
import DxBullet from 'devextreme-vue/bullet';

export default {
    components: {
        DxBullet
    },
    data() {
        return {
            bulletAttributes: {
                id: 'elementId',
                class: 'class-name'
            }
        }
    }
}
</script>
React
App.js
import React from 'react';

import Bullet from 'devextreme-react/bullet';

class App extends React.Component {
    bulletAttributes = {
        id: 'elementId',
        class: 'class-name'
    }

    render() {
        return (
            <Bullet ...
                elementAttr={this.bulletAttributes}>
            </Bullet>
        );
    }
}
export default App;

endScaleValue

Specifies an end value for the invisible scale.

Type:

Number

Default Value: undefined
Cannot be used in themes.

The primary, target and zero values of the Bullet UI component 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 properties.

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

margin

Generates space around the UI component.

Selector: Margin
Type: viz/core/base_widget:BaseWidgetMargin

WidgetMargin DevExtreme ChartJS

jQuery
index.js
$(function() {
    $("#bulletContainer").dxBullet({
        // ...
        margin: {
            top: 20,
            bottom: 20,
            left: 30,
            right: 30
        }
    });
});
Angular
app.component.html
app.component.ts
app.module.ts
<dx-bullet ... >
    <dxo-margin
        [top]="20"
        [bottom]="20"
        [left]="30"
        [right]="30">
    </dxo-margin>
</dx-bullet>
import { Component } from '@angular/core';

@Component({
    selector: 'app-root',
    templateUrl: './app.component.html',
    styleUrls: ['./app.component.css']
})
export class AppComponent {
    // ...
}
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppComponent } from './app.component';

import { DxBulletModule } from 'devextreme-angular';

@NgModule({
    declarations: [
        AppComponent
    ],
    imports: [
        BrowserModule,
        DxBulletModule
    ],
    providers: [ ],
    bootstrap: [AppComponent]
})
export class AppModule { }
Vue
App.vue
<template>
    <DxBullet ... >
        <DxMargin
            :top="20"
            :bottom="20"
            :left="30"
            :right="30"
        />
    </DxBullet>
</template>

<script>
import 'devextreme/dist/css/dx.light.css';

import DxBullet, {
    DxMargin 
} from 'devextreme-vue/bullet';

export default {
    components: {
        DxBullet,
        DxMargin
    },
    // ...
}
</script>
React
App.js
import React from 'react';

import 'devextreme/dist/css/dx.light.css';

import Bullet, {
    Margin 
} from 'devextreme-react/bullet';

class App extends React.Component {
    render() {
        return (
            <Bullet ... >
                <Margin
                    top={20}
                    bottom={20}
                    left={30}
                    right={30}
                />
            </Bullet>
        );
    }
}
export default App;

onDisposing

A function that is executed before the UI component is disposed of.

Type:

Function

Function parameters:

Information about the event.

Object structure:
Name Type Description
element

HTMLElement | jQuery

The UI component's container. It is an HTML Element or a jQuery Element when you use jQuery.

component

Bullet

The UI component's instance.

Default Value: null

onDrawn

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

Type:

Function

Function parameters:

Information about the event.

Object structure:
Name Type Description
element

HTMLElement | jQuery

The UI component's container. It is an HTML Element or a jQuery Element when you use jQuery.

component

Bullet

The UI component's instance.

Default Value: null
Cannot be used in themes.

onExported

A function that is executed after the UI component is exported.

Type:

Function

Function parameters:

Information about the event.

Object structure:
Name Type Description
element

HTMLElement | jQuery

The UI component's container. It is an HTML Element or a jQuery Element when you use jQuery.

component

Bullet

The UI component's instance.

Default Value: null

onExporting

A function that is executed before the UI component is exported.

Type:

Function

Function parameters:

Information about the event.

Object structure:
Name Type Description
format

String

The resulting file format. One of PNG, PDF, JPEG, SVG and GIF.

fileName

String

The name of the file to which the UI component is about to be exported.

element

HTMLElement | jQuery

The UI component's container. It is an HTML Element or a jQuery Element when you use jQuery.

component

Bullet

The UI component's instance.

Default Value: null

onFileSaving

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

Type:

Function

Function parameters:

Information about the event.

Object structure:
Name Type Description
format

String

The format of the file to be saved.
Possible Values: 'PNG' | 'PDF' | 'JPEG' | 'SVG' | 'GIF'

fileName

String

The name of the file to be saved.

element

HTMLElement | jQuery

The UI component's container. It is an HTML Element or a jQuery Element when you use jQuery.

data

BLOB

Exported data as a BLOB.

component

Bullet

The UI component's instance.

cancel

Boolean

Allows you to prevent file saving.

Default Value: null

onIncidentOccurred

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

Type:

Function

Function parameters:

Information about the event.

Object structure:
Name Type Description
target any

Information on the occurred incident.

element

HTMLElement | jQuery

The UI component's container. It is an HTML Element or a jQuery Element when you use jQuery.

component

Bullet

The UI component's instance.

Default Value: null

The UI component notifies you of errors and warnings by passing messages to the browser console. Each message contains the incident's ID, a brief description, and a link to the Errors and Warnings section where further information about this incident can be found.

The onIncidentOccurred function allows you to handle errors and warnings the way you require. The object passed to it contains the target field. This field provides information about the occurred incident and contains the following properties:

  • id
    The incident's ID. The full list of IDs can be found in the Errors and Warnings section.
  • type
    The incident's type: "error" or "warning".
  • args
    The argument of the incident's message. Depends on the incident. For example, it may be the name of the data source field that was specified incorrectly, or the name of the property that was not set properly.
  • text
    The text passed to the browser's console. Includes the args content, if there is any.
  • widget
    The name of the UI component that produced the error or warning.
  • version
    The used DevExtreme version.

onInitialized

A function used in JavaScript frameworks to save the UI component instance.

Type:

Function

Function parameters:

Information about the event.

Object structure:
Name Type Description
element

HTMLElement | jQuery

The UI component's container. It is an HTML Element or a jQuery Element when you use jQuery.

component

Bullet

The UI component's instance.

Default Value: null

Angular
app.component.html
app.component.ts
<dx-bullet ...
    (onInitialized)="saveInstance($event)">
</dx-bullet>
import { Component } from "@angular/core";
import Bullet from "devextreme/ui/data_grid";
// ...
export class AppComponent {
    bulletInstance: Bullet;
    saveInstance (e) {
        this.bulletInstance = e.component;
    }
}
Vue
App.vue (Options API)
App.vue (Composition API)
<template>
    <div>
        <DxBullet ...
            @initialized="saveInstance">
        </DxBullet>
    </div>
</template>

<script>
import DxBullet from 'devextreme-vue/bullet';

export default {
    components: {
        DxBullet
    },
    data: function() {
        return {
            bulletInstance: null
        };
    },
    methods: {
        saveInstance: function(e) {
            this.bulletInstance = e.component;
        }
    }
};
</script>
<template>
    <div>
        <DxBullet ...
            @initialized="saveInstance">
        </DxBullet>
    </div>
</template>

<script setup>
import DxBullet from 'devextreme-vue/bullet';

let bulletInstance = null;

const saveInstance = (e) => {
    bulletInstance = e.component;
}
</script>
React
App.js
import Bullet from 'devextreme-react/bullet';

class App extends React.Component {
    constructor(props) {
        super(props);

        this.saveInstance = this.saveInstance.bind(this);
    }

    saveInstance(e) {
        this.bulletInstance = e.component;
    }

    render() {
        return (
            <div>
                <Bullet onInitialized={this.saveInstance} />
            </div>
        );
    }
}
See Also
jQuery
  • Get a UI component Instance in jQuery
Angular
  • Get a UI component Instance in Angular
Vue
  • Get a UI component Instance in Vue
React
  • Get a UI component Instance in React

onOptionChanged

A function that is executed after a UI component property is changed.

Type:

Function

Function parameters:

Information about the event.

Object structure:
Name Type Description
value any

The modified property's new value.

previousValue any

The UI component's previous value.

name

String

The modified property if it belongs to the first level. Otherwise, the first-level property it is nested into.

fullName

String

The path to the modified property that includes all parent properties.

element

HTMLElement | jQuery

The UI component's container. It is an HTML Element or a jQuery Element when you use jQuery.

component

Bullet

The UI component's instance.

Default Value: null

The following example shows how to subscribe to component property changes:

jQuery
index.js
$(function() {
    $("#bulletContainer").dxBullet({
        // ...
        onOptionChanged: function(e) {
            if(e.name === "changedProperty") {
                // handle the property change here
            }
        }
    });
});
Angular
app.component.html
app.component.ts
app.module.ts
<dx-bullet ...
    (onOptionChanged)="handlePropertyChange($event)"> 
</dx-bullet>
import { Component } from '@angular/core'; 

@Component({ 
    selector: 'app-root', 
    templateUrl: './app.component.html', 
    styleUrls: ['./app.component.css'] 
}) 

export class AppComponent { 
    // ...
    handlePropertyChange(e) {
        if(e.name === "changedProperty") { 
            // handle the property change here
        }
    }
}
import { BrowserModule } from '@angular/platform-browser'; 
import { NgModule } from '@angular/core'; 
import { AppComponent } from './app.component'; 
import { DxBulletModule } from 'devextreme-angular'; 

@NgModule({ 
    declarations: [ 
        AppComponent 
    ], 
    imports: [ 
        BrowserModule, 
        DxBulletModule 
    ], 
    providers: [ ], 
    bootstrap: [AppComponent] 
}) 

export class AppModule { }  
Vue
App.vue
<template> 
    <DxBullet ...
        @option-changed="handlePropertyChange"
    />            
</template> 

<script>  
import 'devextreme/dist/css/dx.light.css'; 
import DxBullet from 'devextreme-vue/bullet'; 

export default { 
    components: { 
        DxBullet
    }, 
    // ...
    methods: { 
        handlePropertyChange: function(e) {
            if(e.name === "changedProperty") {
                // handle the property change here
            }
        }
    } 
} 
</script> 
React
App.js
import React from 'react';  
import 'devextreme/dist/css/dx.light.css'; 

import Bullet from 'devextreme-react/bullet'; 

const handlePropertyChange = (e) => {
    if(e.name === "changedProperty") {
        // handle the property change here
    }
}

export default function App() { 
    return ( 
        <Bullet ...
            onOptionChanged={handlePropertyChange}
        />        
    ); 
} 

onTooltipHidden

A function that is executed when a tooltip becomes hidden.

Type:

Function

Function parameters:

Information about the event.

Object structure:
Name Type Description
element

HTMLElement | jQuery

The UI component's container. It is an HTML Element or a jQuery Element when you use jQuery.

component

Bullet

The UI component's instance.

Default Value: null
Cannot be used in themes.

onTooltipShown

A function that is executed when a tooltip appears.

Type:

Function

Function parameters:

Information about the event.

Object structure:
Name Type Description
element

HTMLElement | jQuery

The UI component's container. It is an HTML Element or a jQuery Element when you use jQuery.

component

Bullet

The UI component's instance.

Default Value: null
Cannot be used in themes.

pathModified

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

Type:

Boolean

Default Value: false
Cannot be used in themes.

If you place the UI component on a page that uses a tag modifying the path (<base>, <iframe>, etc.), some of the UI component elements may get mixed up or disappear. To solve this problem, set the pathModified property to true.

See Also

rtlEnabled

Switches the UI component to a right-to-left representation.

Type:

Boolean

Default Value: false
Cannot be used in themes.

When this property is set to true, the UI component text flows from right to left, and the layout of elements is reversed. To switch the entire application/site to the right-to-left representation, assign true to the rtlEnabled field of the object passed to the DevExpress.config(config) method.

JavaScript
DevExpress.config({
    rtlEnabled: true
});
NOTE
In a right-to-left representation, SVG elements have the direction attribute with the rtl value. This might cause problems when rendering left-to-right texts. Use this property if you have only right-to-left texts.

showTarget

Specifies whether or not to show the target line.

Type:

Boolean

Default Value: true

showZeroLevel

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

Type:

Boolean

Default Value: true

size

Specifies the UI component's size in pixels.

Selector: Size
Type: viz/core/base_widget:BaseWidgetSize
Default Value: {height: 30, width: 300}

You can specify a custom width and height for the component:

Fixed Relative
Assign values to the size object's height and width properties or specify a container for the component. Specify a container for the component. The component occupies the container area on initialization. If a container's size changes, the component's size does not change. If you want to update the size, call the render method.
NOTE
  • The size object has priority over the container.

  • The size configuration object reserves space for the main UI component elements, while displaying a tooltip may require extra space. To reserve the area around the UI component for the tooltip, you can apply a margin to the UI component's container.

jQuery
index.js
$(function() {
    $("#bulletContainer").dxBullet({
        // ...
        size: {
            height: 300,
            width: 600
        }
    });
});
Angular
app.component.html
app.component.ts
app.module.ts
<dx-bullet ... >
    <dxo-size
        [height]="300"
        [width]="600">
    </dxo-size>
</dx-bullet>
import { Component } from '@angular/core';

@Component({
    selector: 'app-root',
    templateUrl: './app.component.html',
    styleUrls: ['./app.component.css']
})
export class AppComponent {
    // ...
}
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppComponent } from './app.component';

import { DxBulletModule } from 'devextreme-angular';

@NgModule({
    declarations: [
        AppComponent
    ],
    imports: [
        BrowserModule,
        DxBulletModule
    ],
    providers: [ ],
    bootstrap: [AppComponent]
})
export class AppModule { }
Vue
App.vue
<template>
    <DxBullet ... >
        <DxSize
            :height="300"
            :width="600"
        />
    </DxBullet>
</template>

<script>

import DxBullet, {
    DxSize
} from 'devextreme-vue/bullet';

export default {
    components: {
        DxBullet,
        DxSize
    },
    // ...
}
</script>
React
App.js
import React from 'react';

import Bullet, {
    Size
} from 'devextreme-react/bullet';

class App extends React.Component {
    render() {
        return (
            <Bullet ... >
                <Size
                    height={300}
                    width={600}
                />
            </Bullet>
        );
    }
}
export default App;

Alternatively, you can use CSS to style the UI component's container:

jQuery
index.js
styles.css
$(function() {
    $("#bullet").dxBullet({
        // ...
    });
});
#bullet {
    width: 85%;
    height: 70%;
}
Angular
app.component.html
app.styles.css
<dx-bullet ...
    id="bullet">
</dx-bullet>
#bullet {
    width: 85%;
    height: 70%;
}
Vue
App.vue
<template>
    <DxBullet ...
        id="bullet">
    </DxBullet>
</template>

<script>
import DxBullet from 'devextreme-vue/bullet';

export default {
    components: {
        DxBullet
    },
    // ...
}
</script>

<style>
#bullet {
    width: 85%;
    height: 70%;
}
</style>
React
App.js
styles.css
import React from 'react';

import Bullet from 'devextreme-react/bullet';

class App extends React.Component {
    render() {
        return (
            <Bullet ...
                id="bullet">
            </Bullet>
        );
    }
}
export default App;
#bullet {
    width: 85%;
    height: 70%;
}

startScaleValue

Specifies a start value for the invisible scale.

Type:

Number

Default Value: 0
Cannot be used in themes.

The main, target and zero values of the Bullet UI component 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 properties.

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

target

Specifies the value indicated by the target line.

Type:

Number

Default Value: 0
Cannot be used in themes.

targetColor

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

Type:

String

Default Value: '#666666'

This property supports the following colors:

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

targetWidth

Specifies the width of the target line.

Type:

Number

Default Value: 4

theme

Sets the name of the theme the UI component uses.

Type:

Theme

Default Value: 'generic.light'

A theme is a UI component configuration that gives the UI component a distinctive appearance. You can use one of the predefined themes or create a custom one. Changing the property values in the UI component's configuration object overrides the theme's corresponding values.

tooltip

Configures the tooltip.

Selector: Tooltip
Type: viz/sparklines/base_sparkline:BaseSparklineTooltip

A tooltip is a miniature rectangle displaying UI component data. The tooltip appears when the end-user hovers the cursor over the UI component. You can enable/disable the tooltip, change its appearance and format its text using fields of the tooltip configuration object.

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

value

Specifies the primary value indicated by the bullet bar.

Type:

Number

Default Value: 0
Cannot be used in themes.