BarGauge

The BarGauge widget contains several circular bars that each indicates a single value.

Included in: dx.viz.js, dx.viz-web.js, dx.all.js
Module: viz/bar_gauge
Export: default
BarGauge interactive configuration
Copy Code
Copy to Codepen
$("#bargauge").dxBarGauge({
});

                    

You can create the widget using one of the following approaches.

  • jQuery

    HTML
    JavaScript
    <div id="barGauge"></div>
    $(function () {
        $("#barGauge").dxBarGauge({
            startValue: 0,
            endValue: 100,
            values: [21.3, 54.1, 30.9, 45.2, 89.41]
        });
    });
  • Angular

    HTML
    <dx-bar-gauge
        [startValue]="0"
        [endValue]="100"
        [values]="[21.3, 54.1, 30.9, 45.2, 89.41]">
    </dx-bar-gauge>
  • AngularJS

    HTML
    <div dx-bar-gauge="{
        startValue: 0,
        endValue: 100,
        values: [21.3, 54.1, 30.9, 45.2, 89.41]
    }"></div>
  • Knockout

    HTML
    <div data-bind="dxBarGauge: {
        startValue: 0,
        endValue: 100,
        values: [21.3, 54.1, 30.9, 45.2, 89.41]
    }"></div>
  • ASP.NET MVC Wrappers

    Razor C#
    Razor VB
    @(Html.DevExtreme().BarGauge()
        .ID("barGauge")
        .StartValue(0)
        .EndValue(100)
        .Values(new [] { 21.3, 54.1, 30.9, 45.2, 89.41 })
    )
    @(Html.DevExtreme().BarGauge() _
        .ID("barGauge") _
        .StartValue(0) _
        .EndValue(100) _
        .Values({ 21.3, 54.1, 30.9, 45.2, 89.41 })
    )

Note that DevExtreme widgets require you to link the jQuery library to your application. If you use the Knockout or AngularJS approach, the Knockout or AngularJS library is also required. For detailed information on linking these libraries to your project, refer to the topics in the Installation section.

View Demo Watch Video

See Also

Configuration

An object that defines configuration options for the BarGauge widget.

Name Description
animation

Specifies animation options.

backgroundColor

Specifies a color for the remaining segment of the bar's track.

barSpacing

Specifies a distance between bars in pixels.

baseValue

Specifies a base value for bars.

elementAttr

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

endValue

Specifies an end value for the gauge's invisible scale.

export

Configures the exporting and printing features.

geometry

Defines the shape of the gauge's arc.

label

Specifies the options of the labels that accompany gauge bars.

loadingIndicator

Configures the loading indicator.

margin

Generates space around the widget.

onDisposing

A handler for the disposing event.

onDrawn

A handler for the drawn event.

onExported

A handler for the exported event.

onExporting

A handler for the exporting event.

onFileSaving

A handler for the fileSaving event.

onIncidentOccurred

A handler for the incidentOccurred event.

onInitialized

A handler for the initialized event. Executed only once, after the widget is initialized.

onOptionChanged

A handler for the optionChanged event.

onTooltipHidden

A handler for the tooltipHidden event.

onTooltipShown

A handler for the tooltipShown event.

palette

Sets the name of the palette or an array of colors to be used for coloring the gauge range container.

pathModified

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

redrawOnResize

Specifies whether to redraw the widget when the size of the parent browser window changes or a mobile device rotates.

relativeInnerRadius

Defines the radius of the bar that is closest to the center relatively to the radius of the topmost bar.

rtlEnabled

Specifies whether or not the widget supports right-to-left representation.

size

Specifies the size of the widget in pixels.

startValue

Specifies a start value for the gauge's invisible scale.

theme

Sets the name of the theme to be used in the widget.

title

Specifies the widget title.

tooltip

Configures tooltips.

values

Specifies the array of values to be indicated on a bar gauge.

Methods

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

Name Description
beginUpdate()

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

element()

Returns the root HTML element of the widget.

endUpdate()

Enables the component to refresh after the beginUpdate() method call.

exportTo(fileName, format)

Exports the widget into a document with a specified name and format.

hideLoadingIndicator()

Conceals the loading indicator.

instance()

Returns an instance of this component class.

off(eventName)

Detaches all event handlers from the specified event.

off(eventName, eventHandler)

Detaches a particular event handler from the specified event.

on(eventName, eventHandler)

Subscribes to a specified event.

on(events)

Subscribes to the specified events.

option()

Returns the configuration options of this component.

option(optionName)

Gets the value of the specified configuration option of this component.

option(optionName, optionValue)

Sets a value to the specified configuration option of this component.

option(options)

Sets one or more options of this component.

print()

Opens the browser's print window.

render()

Redraws the widget.

showLoadingIndicator()

Displays the loading indicator.

svg()

Returns the widget's SVG markup.

values()

Returns an array of gauge values.

values(newValues)

Updates the values displayed by a gauge.

Events

This section describes events fired by this widget.

Name Description
disposing

Fires when the widget is being removed.

drawn

Fires when the widget has finished drawing itself.

exported

Fires after data from the widget is exported.

exporting

Fires before data from the widget is exported.

fileSaving

Fires before a file with exported data is saved on the user's local storage.

incidentOccurred

Fires when an error or warning appears in a widget.

initialized

Raised only once, after the widget is initialized.

optionChanged

Fires after an option of the component is changed.

tooltipHidden

Fires when a bar's tooltip becomes hidden.

tooltipShown

Fires when a bar's tooltip appears.