React BarGauge API
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 BarGauge 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
$(function () { $("#barGauge").dxBarGauge({ startValue: 0, endValue: 100, values: [21.3, 54.1, 30.9, 45.2, 89.41] }); });
<div id="barGauge"></div>
Angular
<dx-bar-gauge [startValue]="0" [endValue]="100" [values]="[21.3, 54.1, 30.9, 45.2, 89.41]"> </dx-bar-gauge>
import { DxBarGaugeModule } from 'devextreme-angular'; // ... export class AppComponent { // ... } @NgModule({ imports: [ // ... DxBarGaugeModule ], // ... })
AngularJS
<div dx-bar-gauge="{ startValue: 0, endValue: 100, values: [21.3, 54.1, 30.9, 45.2, 89.41] }"></div>
Knockout
<div data-bind="dxBarGauge: { startValue: 0, endValue: 100, values: [21.3, 54.1, 30.9, 45.2, 89.41] }"></div>
ASP.NET MVC Controls
@(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 }) )
See Also
Configuration
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. Executed when the widget is removed from the DOM using the remove(), empty(), or html() jQuery methods only. |
onDrawn |
A function that is executed when the widget's rendering has finished. |
onExported |
A handler for the exported event. Executed after data from the widget is exported. |
onExporting |
A handler for the exporting event. Executed before data from the widget is exported. |
onFileSaving |
A handler for the fileSaving event. Executed before a file with exported data is saved on the user's local storage. |
onIncidentOccurred |
A handler for the incidentOccurred event. Executed when an error or warning appears in the widget. |
onInitialized |
A handler for the initialized event. Executed only once, after the widget is initialized. |
onOptionChanged |
A handler for the optionChanged event. Executed after an option of the widget is changed. |
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 |
Switches the widget to a right-to-left representation. |
size |
Specifies the widget's size in pixels. |
startValue |
Specifies a start value for the gauge's invisible scale. |
theme |
Sets the name of the theme the widget uses. |
title |
Configures the widget's 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 widget from refreshing until the endUpdate() method is called. |
dispose() |
Disposes of all the resources allocated to the BarGauge 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. |
hideLoadingIndicator() |
Hides the loading indicator. |
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. |
showLoadingIndicator() |
Shows the loading indicator. |
svg() |
Gets the widget's SVG markup. |
values() |
Gets all the values. |
values(newValues) |
Updates all the values. |
Events
Name | Description |
---|---|
disposing |
Raised when the widget is removed from the DOM using the remove(), empty(), or html() jQuery methods only. |
drawn |
Raised when the widget's rendering has finished. |
exported |
Raised after data from the widget is exported. |
exporting |
Raised before data from the widget is exported. |
fileSaving |
Raised before a file with exported data is saved on the user's local storage. |
incidentOccurred |
Raised when an error or warning appears in the widget. |
initialized |
Raised only once, after the widget is initialized. |
optionChanged |
Raised after a widget option is changed. |
tooltipHidden |
Fires when a bar's tooltip becomes hidden. |
tooltipShown |
Fires when a bar's tooltip appears. |
If you have technical questions, please create a support ticket in the DevExpress Support Center.