React RangeSelector Props
See Also
- Configure a Widget: Angular | Vue | React | jQuery | AngularJS | Knockout | ASP.NET MVC 5 | ASP.NET Core
background
A background is an area that is painted in a specified color. You can change this color by setting the background's color property and by displaying an image specified by the image configuration object. In addition, you can superimpose a chart on a background by specifying the chart configuration object. The chart will be shown with the specified background color. To show the chart without a background, set the background's visible property to false.
chart
The RangeSelector widget can be created with a chart as the background. In this instance, the range selector can be used for selecting the required range on the chart. At the same time, the Chart widget can be displayed near the range selector and zoomed or scrolled according to the range selected in the range selector. For details on how to synchronize these two widgets, refer to the Zooming and Scrolling topic.
To provide a data source for the chart located in the background, set the dataSource property of the rangeSelectorOptions root configuration object and define the series within the chart configuration object. Set the chart series' argumentField and valueField properties to the corresponding data source fields. The argument field will also be used to create the range selector's scale.
The color specified for the range selector's background will also be visible in the chart's background by default. You can change it using the color property of the background configuration object. To prohibit the display of the background color, set the background's visible property to false.
View Chart on Background Demo View Customized Chart on Background Demo
dataSource
Specifies a data source for the scale values and for the chart at the background.
Use this property in the following cases:
- to initialize a scale with data from one of the data source fields. Set the dataSourceField property to specify which field to use as the source for scale values.
- to plot a chart using data from the data source fields. In this case, define the chart series by setting their argumentField and valueField properties. The range selector's scale will represent the chart's argument axis. It is created using data from the field specified by the chart's argumentField property.
The maximum and minimum values of the field specified by the argumentField/dataSourceField property are used as the scale's start and end values. The major tick interval is determined automatically. You can also set the interval using the scale's tickInterval and minorTickInterval properties.
For details on how to configure a data source, refer to the Data Binding topic.
See Also
elementAttr
Specifies the attributes to be attached to the widget's root element.
jQuery
$(function(){ $("#rangeSelectorContainer").dxRangeSelector({ // ... elementAttr: { id: "elementId", class: "class-name" } }); });
Angular
<dx-range-selector ... [elementAttr]="{ id: 'elementId', class: 'class-name' }"> </dx-range-selector>
import { DxRangeSelectorModule } from "devextreme-angular"; // ... export class AppComponent { // ... } @NgModule({ imports: [ // ... DxRangeSelectorModule ], // ... })
ASP.NET MVC Controls
@(Html.DevExtreme().RangeSelector() .ElementAttr("class", "class-name") // ===== or ===== .ElementAttr(new { @id = "elementId", @class = "class-name" }) // ===== or ===== .ElementAttr(new Dictionary<string, object>() { { "id", "elementId" }, { "class", "class-name" } }) )
@(Html.DevExtreme().RangeSelector() _ .ElementAttr("class", "class-name") ' ===== or ===== .ElementAttr(New With { .id = "elementId", .class = "class-name" }) ' ===== or ===== .ElementAttr(New Dictionary(Of String, Object) From { { "id", "elementId" }, { "class", "class-name" } }) )
export
These features allow a user to export your widget into a document or print it. When exporting is enabled, the "Exporting/Printing" button appears in the widget. A click on it invokes a drop-down menu that lists exporting and printing commands. The following formats are supported for exporting into: PNG, PDF, JPEG, SVG and GIF.
See Also
indent
The indent is used to precisely align scales of several widgets arranged vertically. This is the distance between the container edge and the range selector's scale (see the image below).
Note that if the indent is set very small, the Scale Labels will be cut.
loadingIndicator
When the widget is bound to a remote data source, it can display a loading indicator while data is loading.
To enable the automatic loading indicator, set the enabled option to true.
If you want to change the loading indicator's visibility, use the show option or the showLoadingIndicator() and hideLoadingIndicator() methods.
margin
jQuery
$(function() { $("#rangeSelectorContainer").dxRangeSelector({ // ... margin: { top: 20, bottom: 20, left: 30, right: 30 } }); });
Angular
<dx-range-selector ... > <dxo-margin [top]="20" [bottom]="20" [left]="30" [right]="30"> </dxo-margin> </dx-range-selector>
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 { DxRangeSelectorModule } from 'devextreme-angular'; @NgModule({ declarations: [ AppComponent ], imports: [ BrowserModule, DxRangeSelectorModule ], providers: [ ], bootstrap: [AppComponent] }) export class AppModule { }
Vue
<template> <DxRangeSelector ... > <DxMargin :top="20" :bottom="20" :left="30" :right="30" /> </DxRangeSelector> </template> <script> import 'devextreme/dist/css/dx.common.css'; import 'devextreme/dist/css/dx.light.css'; import DxRangeSelector, { DxMargin } from 'devextreme-vue/range-selector'; export default { components: { DxRangeSelector, DxMargin }, // ... } </script>
React
import React from 'react'; import 'devextreme/dist/css/dx.common.css'; import 'devextreme/dist/css/dx.light.css'; import RangeSelector, { Margin } from 'devextreme-react/range-selector'; class App extends React.Component { render() { return ( <RangeSelector ... > <Margin top={20} bottom={20} left={30} right={30} /> </RangeSelector> ); } } export default App;
onDisposing
A function that is executed before the widget is disposed of.
Name | Type | Description |
---|---|---|
component |
The widget's instance. |
|
element |
The widget's container. It is an HTML Element or a jQuery Element when you use jQuery. |
|
model |
The model data. Available only if you use Knockout. |
onDrawn
Name | Type | Description |
---|---|---|
component |
The widget's instance. |
|
element |
The widget's container. It is an HTML Element or a jQuery Element when you use jQuery. |
|
model |
The model data. Available only if you use Knockout. |
onExported
Name | Type | Description |
---|---|---|
component |
The widget's instance. |
|
element |
The widget's container. It is an HTML Element or a jQuery Element when you use jQuery. |
|
model |
The model data. Available only if you use Knockout. |
onExporting
Name | Type | Description |
---|---|---|
cancel |
Allows you to prevent exporting. |
|
component |
The widget's instance. |
|
element |
The widget's container. It is an HTML Element or a jQuery Element when you use jQuery. |
|
fileName |
The name of the file to which the widget is about to be exported. |
|
format |
The resulting file format. One of PNG, PDF, JPEG, SVG and GIF. |
|
model |
The model data. Available only if you use Knockout. |
onFileSaving
A function that is executed before a file with exported widget is saved to the user's local storage.
Name | Type | Description |
---|---|---|
cancel |
Allows you to prevent file saving. |
|
component |
The widget's instance. |
|
data |
Exported data as a BLOB. |
|
element |
The widget's container. It is an HTML Element or a jQuery Element when you use jQuery. |
|
fileName |
The name of the file to be saved. |
|
format |
The format of the file to be saved. |
onIncidentOccurred
Name | Type | Description |
---|---|---|
component |
The widget's instance. |
|
element |
The widget's container. It is an HTML Element or a jQuery Element when you use jQuery. |
|
model |
The model data. Available only if you use Knockout. |
|
target | any |
Information on the occurred incident. |
The widget 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 option 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 widget that produced the error or warning. - version
The used DevExtreme version.
onInitialized
Name | Type | Description |
---|---|---|
component |
The widget's instance. |
|
element |
The widget's container. It is an HTML Element or a jQuery Element when you use jQuery. |
onOptionChanged
Name | Type | Description |
---|---|---|
model |
The model data. Available only if you use Knockout. |
|
fullName |
The path to the modified option that includes all parent options. |
|
element |
The widget's container. It is an HTML Element or a jQuery Element when you use jQuery. |
|
component |
The widget's instance. |
|
name |
The modified option if it belongs to the first level. Otherwise, the first-level option it is nested into. |
|
value | any |
The modified option's new value. |
onValueChanged
A function that is executed after the widget's value is changed.
Name | Type | Description |
---|---|---|
component |
The widget's instance. |
|
element |
The widget's container. It is an HTML Element or a jQuery Element when you use jQuery. |
|
event | Event (jQuery or EventObject) |
The event that caused the function to execute. It is a dxEvent or a jQuery.Event when you use jQuery. |
model |
The model data. Available only if you use Knockout. |
|
previousValue |
Two values that represent old start and end values. |
|
value |
Two values that represent new start and end values. |
The onValueChanged function can be called when a user moves a slider or after he/she has stopped moving it. To specify the required mode, use the behavior.callValueChanged option.
See Also
- Handle Events: Angular | Vue | React | jQuery | AngularJS | Knockout | ASP.NET MVC 5 | ASP.NET Core
- selectedRangeUpdateMode
pathModified
redrawOnResize
Specifies whether to redraw the widget when the size of the parent browser window changes or a mobile device rotates.
When this option is set to true, the widget will be redrawn automatically in case the size of its parent window changes.
rtlEnabled
When this option is set to true, the widget 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.
DevExpress.config({ rtlEnabled: true });
scale
To divide a scale, either set the dataSource property or the startValue and endValue properties. In the former case, the start and end values will be calculated based on the values provided by the data source field that is set by the dataSourceField property.
The scale's ticks are arranged automatically, based on the start and end values, so that the tick labels do not overlap each other. You can set a custom tick interval, add minor ticks and format tick labels. These and other scale options are available in the scale configuration object.
selectedRangeUpdateMode
Specifies how the selected range should behave when data is updated. Applies only when the RangeSelector is bound to a data source.
The following modes are available:
"shift"
The selected range moves to the scale's end. The range's length does not change."reset"
The selected range is set to be equal to the data range."keep"
The selected range does not change."auto"
The applied mode changes depending on the selected range's position on the scale:- at the start or middle, then "keep";
- at the end, then "shift";
- if set to view the data range, then "reset" (the selected range remains equal to the data range).
See Also
size
The widget occupies its container's entire area by default. Use the size object to specify the widget's size if it should be different from that of its container. Assign 0 to size object's height and width options to hide the widget.
jQuery
$(function() { $("#rangeSelectorContainer").dxRangeSelector({ // ... size: { height: 300, width: 600 } }); });
Angular
<dx-range-selector ... > <dxo-size [height]="300" [width]="600"> </dxo-size> </dx-range-selector>
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 { DxRangeSelectorModule } from 'devextreme-angular'; @NgModule({ declarations: [ AppComponent ], imports: [ BrowserModule, DxRangeSelectorModule ], providers: [ ], bootstrap: [AppComponent] }) export class AppModule { }
Vue
<template> <DxRangeSelector ... > <DxSize :height="300" :width="600" /> </DxRangeSelector> </template> <script> import 'devextreme/dist/css/dx.common.css'; import 'devextreme/dist/css/dx.light.css'; import DxRangeSelector, { DxSize } from 'devextreme-vue/range-selector'; export default { components: { DxRangeSelector, DxSize }, // ... } </script>
React
import React from 'react'; import 'devextreme/dist/css/dx.common.css'; import 'devextreme/dist/css/dx.light.css'; import RangeSelector, { Size } from 'devextreme-react/range-selector'; class App extends React.Component { render() { return ( <RangeSelector ... > <Size height={300} width={600} /> </RangeSelector> ); } } export default App;
sliderHandle
The range selector's sliders consist of a slider marker and a slider handle. You can drag a marker or a handle to change the selected range. To set the appearance options of the slider handles, use the sliderHandle configuration object. To customize the slider markers, use the sliderMarker configuration object.
sliderMarker
When moving a slider, its marker displays the currently selected scale value. Use the sliderMarker object to set the required options for the range selector slider markers. For instance, you can format the markers' text, change the text font, or make the markers invisible.
theme
A theme is a widget configuration that gives the widget a distinctive appearance. Use can use one of the predefined themes or create a custom one. Changing the option values in the widget's configuration object overrides the theme's corresponding values.
Use the VizTheme
enum to specify this option when the widget is used as an ASP.NET MVC 5 Control or a DevExtreme-Based ASP.NET Core Control. This enum accepts the following values: GenericLight
, GenericDark
, GenericContrast
, GenericCarmine
, GenericDarkMoon
, GenericSoftBlue
, GenericDarkViolet
, GenericGreenMist
, MaterialBlueLight
, MaterialLimeLight
, MaterialOrangeLight
, MaterialPurpleLight
, MaterialTealLight
.
title
The widget's title is a short text that usually indicates what is visualized. If you need to specify the title's text only, assign it directly to the title option. Otherwise, set this option to an object with the text and other fields specified.
The title can be accompanied by a subtitle elaborating on the visualized subject using the title.subtitle object.
value
The selected range (initial or current). Equals the entire scale when not set.
This option accepts one of the following:
A two-item array
Specifies the range's start and end. The array can contain a pair of numeric, string, or date-time values, depending on the scale's valueType. You can also set one of the array values to null to specify an open-ended range.
value: [50, 70] // Open-ended range value: [null, 70]
An object with the startValue and endValue fields
An alternative to the two-item array.
value: { startValue: 50, endValue: 70 } // Open-ended range value: { startValue: null, endValue: 70 }
An object with the length and a startValue or endValue field
Specifies the range using a start or end value and length.
value: { startValue: 50, length: 20 } // ===== or ===== value: { endValue: 70, length: 20 }
An object with the length field
Sets the range of the specified length using the last scale value as the end value.
value: { length: 20 }
See Also
If you have technical questions, please create a support ticket in the DevExpress Support Center.