React RangeSelector Props

An object that defines configuration options for the RangeSelector widget.

See Also

background

Specifies the options for the range selector's 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 option only when the range selector displays an image or chart. If not, use the selectedRangeColor and tick to customize the appearance of your widget.

View Demo

behavior

Specifies the RangeSelector's behavior options.

Type:

Object

chart

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

Type:

Object

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.

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.

View Chart on Background Demo View 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 widget responds to the user interaction.

Type:

Boolean

Default Value: false
Cannot be used in themes.

elementAttr

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

Type:

Object

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
    ],
    // ...
})
ASP.NET MVC Controls
Razor C#
Razor VB
@(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

Configures the exporting and printing features.

Type:

Object

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.

NOTE
Safari on Mac OS does not implement an API for saving files. Therefore, exporting in these browsers requires setting up a server-side proxy. For details, refer to the proxyUrl option description.
See Also

indent

Range selector's indent options.

Type:

Object

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

RangeSelectorMargin ChartJS

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

loadingIndicator

Configures the loading indicator.

Type:

Object

When the widget 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 option to true.

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

margin

Generates space around the widget.

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.common.css';
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.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.

Type:

Function

Function parameters:
e:

Object

Information about the event.

Object structure:
Name Type Description
component

RangeSelector

The widget's instance.

element

HTMLElement | jQuery

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

model

Object

The model data. Available only if you use Knockout.

Default Value: null

onDrawn

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

Type:

Function

Function parameters:
e:

Object

Information about the event.

Object structure:
Name Type Description
component

RangeSelector

The widget's instance.

element

HTMLElement | jQuery

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

model

Object

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 widget is exported.

Type:

Function

Function parameters:
e:

Object

Information about the event.

Object structure:
Name Type Description
component

RangeSelector

The widget's instance.

element

HTMLElement | jQuery

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

model

Object

The model data. Available only if you use Knockout.

Default Value: null

onExporting

A function that is executed before the widget 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 widget's instance.

element

HTMLElement | jQuery

The widget'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 widget is about to be exported.

format

String

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

model

Object

The model data. Available only if you use Knockout.

Default Value: null

onFileSaving

A function that is executed before a file with exported widget 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 widget's instance.

data

BLOB

Exported data as a BLOB.

element

HTMLElement | jQuery

The widget'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 widget's instance.

element

HTMLElement | jQuery

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

model

Object

The model data. Available only if you use Knockout.

target any

Information on the occurred incident.

Default Value: null

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

A function used in JavaScript frameworks to save the widget instance.

Type:

Function

Function parameters:
e:

Object

Information about the event.

Object structure:
Name Type Description
component

RangeSelector

The widget's instance.

element

HTMLElement | jQuery

The widget'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 widget option is changed.

Type:

Function

Function parameters:
e:

Object

Information about the event.

Object structure:
Name Type Description
model

Object

The model data. Available only if you use Knockout.

fullName

String

The path to the modified option that includes all parent options.

element

HTMLElement | jQuery

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

component

RangeSelector

The widget's instance.

name

String

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.

Default Value: null

onValueChanged

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

Type:

Function

Function parameters:
e:

Object

Information about the event.

Object structure:
Name Type Description
component

RangeSelector

The widget's instance.

element

HTMLElement | jQuery

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

Object

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

View Demo

See Also

pathModified

Notifies the widget 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 widget on a page that uses a tag modifying the path (<base>, <iframe>, etc.), some of the widget elements may get mixed up or disappear. To solve this problem, set the pathModified option to true.

See Also

redrawOnResize

Specifies whether to redraw the widget 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 option is set to true, the widget will be redrawn automatically in case the size of its parent window changes.

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

rtlEnabled

Switches the widget to a right-to-left representation.

Type:

Boolean

Default Value: false
Cannot be used in themes.

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.

JavaScript
DevExpress.config({
    rtlEnabled: true
});

scale

Specifies options of the range selector's 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 options 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 options.

Type:

Object

Shutters are used in the RangeSelector widget 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 widget's size in pixels.

Type:

Object

Default Value: undefined

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
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 '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
App.js
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

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

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

sliderMarker

Defines the options of the range selector slider markers.

Type:

Object

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.

View Demo

theme

Sets the name of the theme the widget 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 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.

NOTE
The following themes were deprecated or renamed: 'android5.light', ios7.default, 'win8.white', 'win8.black', 'win8.light', 'win8.dark', 'win10.white', 'win10.black', 'win10.light', 'win10.dark'. In new applications, use themes listed in the accepted 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

Configures the widget's title.

Type:

Object

|

String

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.

Type:

Array<Number | String | Date>

|

Object

Raised Events: onValueChanged
Cannot be used in themes.

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