React CircularGauge 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 CircularGauge 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 () { $("#circularGauge").dxCircularGauge({ scale: { startValue: 50, endValue: 150 }, rangeContainer: { ranges: [ { startValue: 50, endValue: 90 }, { startValue: 90, endValue: 130 }, { startValue: 130, endValue: 150 } ] }, value: 105 }); });
<div id="circularGauge"></div>
Angular
<dx-circular-gauge [value]="105"> <dxo-scale [startValue]="50" [endValue]="150"> </dxo-scale> <dxo-range-container> <dxi-range [startValue]="50" [endValue]="90"> </dxi-range> <dxi-range [startValue]="90" [endValue]="130"> </dxi-range> <dxi-range [startValue]="130" [endValue]="150"> </dxi-range> </dxo-range-container> </dx-circular-gauge>
import { DxCircularGaugeModule } from "devextreme-angular"; // ... export class AppComponent { // ... } @NgModule({ imports: [ // ... DxCircularGaugeModule ], // ... })
AngularJS
<div dx-circular-gauge="{ scale: { startValue: 50, endValue: 150 }, rangeContainer: { ranges: [ { startValue: 50, endValue: 90 }, { startValue: 90, endValue: 130 }, { startValue: 130, endValue: 150 } ] }, value: 105 }"></div>
Knockout
<div data-bind="dxCircularGauge: { scale: { startValue: 50, endValue: 150 }, rangeContainer: { ranges: [ { startValue: 50, endValue: 90 }, { startValue: 90, endValue: 130 }, { startValue: 130, endValue: 150 } ] }, value: 105 }"></div>
ASP.NET MVC Controls
@(Html.DevExtreme().CircularGauge() .ID("circularGauge") .Scale(scale => scale .StartValue(50) .EndValue(50) ) .RangeContainer(rc => rc .Ranges(ranges => { ranges.Add().StartValue(50).EndValue(90); ranges.Add().StartValue(90).EndValue(130); ranges.Add().StartValue(130).EndValue(150); }) ) .Value(105) )
@(Html.DevExtreme().CircularGauge() _ .ID("circularGauge") _ .Scale(Sub(scale) scale.StartValue(50) _ .EndValue(50) End Sub) _ .RangeContainer(Sub(rc) rc.Ranges(Sub(ranges) ranges.Add().StartValue(50).EndValue(90) ranges.Add().StartValue(90).EndValue(130) ranges.Add().StartValue(130).EndValue(150) End Sub) End Sub) _ .Value(105) )
See Also
Configuration
Name | Description |
---|---|
animation |
Specifies animation options. |
containerBackgroundColor |
Specifies the color of the parent page element. |
disabled |
Specifies whether the widget responds to the user interaction. |
elementAttr |
Specifies the attributes to be attached to the widget's root element. |
export |
Configures the exporting and printing features. |
geometry |
Specifies the options required to set the geometry of the CircularGauge widget. |
loadingIndicator |
Configures the loading indicator. |
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. |
rangeContainer |
Specifies gauge range container options. |
redrawOnResize |
Specifies whether to redraw the widget when the size of the parent browser window changes or a mobile device rotates. |
rtlEnabled |
Switches the widget to a right-to-left representation. |
scale |
Specifies a gauge's scale options. |
size |
Specifies the widget's size in pixels. |
subvalueIndicator |
Specifies the appearance options of subvalue indicators. |
subvalues |
Specifies a set of subvalues to be designated by the subvalue indicators. |
theme |
Sets the name of the theme the widget uses. |
title |
Configures the widget's title. |
tooltip |
Configures tooltips. |
value |
Specifies the main value on a gauge. |
valueIndicator |
Specifies the appearance options of the value indicator. |
Methods
Name | Description |
---|---|
beginUpdate() |
Prevents the widget from refreshing until the endUpdate() method is called. |
dispose() |
Disposes of all the resources allocated to the CircularGauge 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. |
subvalues() |
Gets subvalues. |
subvalues(subvalues) |
Updates subvalues. |
svg() |
Gets the widget's SVG markup. |
value() |
Gets the main value. |
value(value) |
Updates the main value. |
Events
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. |
Indicator Types
This section lists objects that define options used to configure value and subvalue indicators of specific types.
Name | Description |
---|---|
RangeBar |
An object that defines a gauge indicator of the rangeBar type. |
RectangleNeedle |
An object that defines a gauge indicator of the rectangleNeedle type. |
TextCloud |
An object that defines a gauge indicator of the textCloud type. |
TriangleMarker |
An object that defines a gauge indicator of the triangleMarker type. |
TriangleNeedle |
An object that defines a gauge indicator of the triangleNeedle type. |
TwoColorNeedle |
An object that defines a gauge indicator of the twoColorNeedle type. |
If you have technical questions, please create a support ticket in the DevExpress Support Center.