React RangeSelector Props

An object that defines configuration properties for the RangeSelector UI component.

See Also

background

Specifies the properties for the range selector's background.

Selector: Background
Type:

Object

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.

NOTE
You can use this property only when the range selector displays an image or chart. If not, use the selectedRangeColor and tick to customize the appearance of your UI component.

View Demo

behavior

Specifies the RangeSelector's behavior properties.

Selector: Behavior
Type:

Object

chart

Specifies the properties required to display a chart as the range selector's background.

Selector: Chart
Type:

Object

The RangeSelector UI component 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 UI component 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 UI components, refer to the following help topic: Zooming and Panning Using the RangeSelector Component.

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.

NOTE
You may need to use the rangeValue1Field and rangeValue2Field properties instead of the valueField property if you define range-like series. For the candleStick and stock series types, specific properties should also be specified instead of the valueField property.

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.

Chart on Background Demo Customized Chart on Background Demo

containerBackgroundColor

Specifies the color of the parent page element.

Type:

String

Default Value: '#FFFFFF'

Set this property to the color of the parent page element. Certain RangeSelector elements will use this color to coordinate with the page. For instance, the RangeSelector's shutters use this color, but you can change this color to a custom color.

dataSource

Specifies a data source for the scale values and for the chart at the background.

Cannot be used in themes.

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

dataSourceField

Specifies the data source field that provides data for the scale.

Type:

String

Default Value: 'arg'

Use this property to initialize a scale with data from one of the data source's fields. Set the name of the required data source field to this 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.

Type: any
Default Value: {}

jQuery
$(function(){
    $("#rangeSelectorContainer").dxRangeSelector({
        // ...
        elementAttr: {
            id: "elementId",
            class: "class-name"
        }
    });
});
Angular
HTML
TypeScript
<dx-range-selector ...
    [elementAttr]="{ id: 'elementId', class: 'class-name' }">
</dx-range-selector>
import { DxRangeSelectorModule } from "devextreme-angular";
// ...
export class AppComponent {
    // ...
}
@NgModule({
    imports: [
        // ...
        DxRangeSelectorModule
    ],
    // ...
})
Vue
App.vue
<template>
    <DxRangeSelector ...
        :element-attr="rangeSelectorAttributes">
    </DxRangeSelector>
</template>

<script>
import DxRangeSelector from 'devextreme-vue/range-selector';

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

import RangeSelector from 'devextreme-react/range-selector';

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

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

export

Configures the exporting and printing features.

Selector: Export
Type:

Object

These features allow a user to export your UI component into a document or print it. When exporting is enabled, the "Exporting/Printing" button appears in the UI component. 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

Range selector's indent properties.

Selector: Indent
Type:

Object

The indent is used to precisely align scales of several UI components arranged vertically. This is the distance between the container edge and the range selector's scale (see the image below).

RangeSelectorMargin ChartJS

Note that if the indent is set very small, the Scale Labels will be cut.

loadingIndicator

Configures the loading indicator.

Selector: LoadingIndicator
Type:

Object

When the UI component is bound to a remote data source, it can display a loading indicator while data is loading.

DevExtreme Charts - Loading indicator

To enable the automatic loading indicator, set the enabled property to true.

If you want to change the loading indicator's visibility, use the show property or the showLoadingIndicator() and hideLoadingIndicator() methods.

margin

Generates space around the UI component.

Selector: Margin
Type:

Object

WidgetMargin DevExtreme ChartJS

jQuery
index.js
$(function() {
    $("#rangeSelectorContainer").dxRangeSelector({
        // ...
        margin: {
            top: 20,
            bottom: 20,
            left: 30,
            right: 30
        }
    });
});
Angular
app.component.html
app.component.ts
app.module.ts
<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
App.vue
<template>
    <DxRangeSelector ... >
        <DxMargin
            :top="20"
            :bottom="20"
            :left="30"
            :right="30"
        />
    </DxRangeSelector>
</template>

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

import DxRangeSelector, {
    DxMargin 
} from 'devextreme-vue/range-selector';

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

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 UI component is disposed of.

Type:

Function

Function parameters:
e:

Object

Information about the event.

Object structure:
Name Type Description
component

RangeSelector

The UI component's instance.

element

HTMLElement | jQuery

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

model any

Model data. Available only if you use Knockout.

Default Value: null

onDrawn

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

Type:

Function

Function parameters:
e:

Object

Information about the event.

Object structure:
Name Type Description
component

RangeSelector

The UI component's instance.

element

HTMLElement | jQuery

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

model any

The model data. Available only if you use Knockout.

Default Value: null
Cannot be used in themes.

onExported

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

Type:

Function

Function parameters:
e:

Object

Information about the event.

Object structure:
Name Type Description
component

RangeSelector

The UI component's instance.

element

HTMLElement | jQuery

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

model any

The model data. Available only if you use Knockout.

Default Value: null

onExporting

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

Type:

Function

Function parameters:
e:

Object

Information about the event.

Object structure:
Name Type Description
cancel

Boolean

Allows you to prevent exporting.

component

RangeSelector

The UI component's instance.

element

HTMLElement | jQuery

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

fileName

String

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

format

String

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

model any

The model data. Available only if you use Knockout.

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:
e:

Object

Information about the event.

Object structure:
Name Type Description
cancel

Boolean

Allows you to prevent file saving.

component

RangeSelector

The UI component's instance.

data

BLOB

Exported data as a BLOB.

element

HTMLElement | jQuery

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

fileName

String

The name of the file to be saved.

format

String

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

Default Value: null

onIncidentOccurred

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

Type:

Function

Function parameters:
e:

Object

Information about the event.

Object structure:
Name Type Description
component

RangeSelector

The UI component's instance.

element

HTMLElement | jQuery

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

model any

The model data. Available only if you use Knockout.

target any

Information on the occurred incident.

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:
e:

Object

Information about the event.

Object structure:
Name Type Description
component

RangeSelector

The UI component's instance.

element

HTMLElement | jQuery

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

Default Value: null

See Also

onOptionChanged

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

Type:

Function

Function parameters:
e:

Object

Information about the event.

Object structure:
Name Type Description
model any

Model data. Available only if you use Knockout.

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

RangeSelector

The UI component's instance.

name

String

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

value any

The modified property's new value.

Default Value: null

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

jQuery
index.js
$(function() {
    $("#rangeSelectorContainer").dxRangeSelector({
        // ...
        onOptionChanged: function(e) {
            if(e.name === "changedProperty") {
                // handle the property change here
            }
        }
    });
});
Angular
app.component.html
app.component.ts
app.module.ts
<dx-range-selector ...
    (onOptionChanged)="handlePropertyChange($event)"> 
</dx-range-selector>
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 { DxRangeSelectorModule } from 'devextreme-angular'; 

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

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

<script>  
import 'devextreme/dist/css/dx.light.css'; 
import DxRangeSelector from 'devextreme-vue/range-selector'; 

export default { 
    components: { 
        DxRangeSelector
    }, 
    // ...
    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 RangeSelector from 'devextreme-react/range-selector'; 

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

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

onValueChanged

A function that is executed after the UI component's value is changed.

Type:

Function

Function parameters:
e:

Object

Information about the event.

Object structure:
Name Type Description
component

RangeSelector

The UI component's instance.

element

HTMLElement | jQuery

The UI component'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 an EventObject or a jQuery.Event when you use jQuery. This field is undefined if the value is changed programmatically.

model any

The model data. Available only if you use Knockout.

previousValue

Array<Number | String | Date>

Two values that represent old start and end values.

value

Array<Number | String | Date>

Two values that represent new start and end values.

Default Value: null
Cannot be used in themes.

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 property.

View Demo

See Also

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

redrawOnResize

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

Type:

Boolean

Default Value: true
Cannot be used in themes.

When this property is set to true, the UI component will be redrawn automatically in case the size of its parent window changes.

NOTE
To redraw the UI component after the size of its container has changed, call the render() method of the UI component's instance.

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.

scale

Specifies properties of the range selector's scale.

Selector: Scale
Type:

Object

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 properties are available in the scale configuration object.

selectedRangeColor

Specifies the color of the selected range.

Type:

String

Default Value: '#606060'

selectedRangeUpdateMode

Specifies how the selected range should behave when data is updated. Applies only when the RangeSelector is bound to a data source.

Type:

String

Default Value: 'reset'
Accepted Values: 'auto' | 'keep' | 'reset' | 'shift'

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

shutter

Specifies range selector shutter properties.

Selector: Shutter
Type:

Object

Shutters are used in the RangeSelector UI component with the background (image or chart) to hide the non-selected range. When using shutters, the background area for a selected range is clearly visible, and the remaining area is hidden by the shutters.

size

Specifies the UI component's size in pixels.

Selector: Size
Type:

Object

Default Value: undefined

The UI component occupies its container's entire area by default. Use the size object to specify the UI component's size if it should be different from that of its container. Assign 0 to size object's height and width properties to hide the UI component.

jQuery
index.js
$(function() {
    $("#rangeSelectorContainer").dxRangeSelector({
        // ...
        size: {
            height: 300,
            width: 600
        }
    });
});
Angular
app.component.html
app.component.ts
app.module.ts
<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
App.vue
<template>
    <DxRangeSelector ... >
        <DxSize
            :height="300"
            :width="600"
        />
    </DxRangeSelector>
</template>

<script>

import DxRangeSelector, {
    DxSize
} from 'devextreme-vue/range-selector';

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

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;

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

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

<script>
import DxRangeSelector from 'devextreme-vue/range-selector';

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

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

import RangeSelector from 'devextreme-react/range-selector';

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

sliderHandle

Specifies the appearance of the range selector's slider handles.

Selector: SliderHandle
Type:

Object

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 properties of the slider handles, use the sliderHandle configuration object. To customize the slider markers, use the sliderMarker configuration object.

sliderMarker

Defines the properties of the range selector slider markers.

Selector: SliderMarker
Type:

Object

When moving a slider, its marker displays the currently selected scale value. Use the sliderMarker object to set the required properties for the range selector slider markers. For instance, you can format the markers' text, change the text font, or make the markers invisible.

View Demo

theme

Sets the name of the theme the UI component uses.

Type:

String

Default Value: 'generic.light'
Accepted Values: 'generic.dark' | 'generic.light' | 'generic.contrast' | 'generic.carmine' | 'generic.darkmoon' | 'generic.darkviolet' | 'generic.greenmist' | 'generic.softblue' | 'material.blue.light' | 'material.lime.light' | 'material.orange.light' | 'material.purple.light' | 'material.teal.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.

title

Configures the UI component's title.

Selector: Title
Type:

Object

|

String

The UI component'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 property. Otherwise, set this property 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.

Selector: Value
Type:

Array<Number | String | Date>

|

Object

Raised Events: onValueChanged
Cannot be used in themes.

This property 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