Configuration

An object that defines configuration options for the RangeSelector widget.

Show Example:
jQuery

This example shows how to display the RangeSelector widget. The only option which is specifically set is the dataSource. The other option - the dataSourceField - thought required, does not have to be specified because it is set to 'arg' (a required data source field) by default.


                                    

                                    

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.
Show Example:
jQuery

In this example, the color of the background is changed to lightblue.


                                    

                                    

behavior

Specifies the RangeSelector's behavior options.

Type:

Object

Show Example:
jQuery

In this example, a number of options belonging to the behavior configuration object are changed. Particularly, the snapToTicks option is set to 'false', so the RangeSelector's sliders do not dock to the scale ticks. These sliders cannot swap their places as the allowSlidersSwap option is also set to 'false'. In addition, widget animation is disabled by setting the animationEnabled option to 'false'.


                                    

                                    

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

Show Example:
jQuery

In this example, a chart is displayed in the background of the RangeSelector widget.


                                    

                                    

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.

Show Example:
jQuery

In this example, the containerBackgroundColor option is set to 'aquamarine'.


                                    

                                    

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
Show Example:
jQuery

In this example, the dataSource field is used to set the data source for both the scale and the chart.


                                    

                                    

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.

Show Example:
jQuery

In this example, the 'x' field of the data source is set as the data source field for the scale using the dataSourceField option.


                                    

                                    

elementAttr

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

Type:

Object

Default Value: {}

You can configure this option in an ASP.NET MVC Control as follows:

Razor C#
Razor VB
@(Html.DevExtreme().WidgetName()
    .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().WidgetName() _
    .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
IE9 and Safari on Mac OS do 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

Watch Video

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.

Show Example:
jQuery

Move the sliders at the bottom to change the range selector's left and right indent values.


                                    

                                    

loadingIndicator

Configures the loading indicator.

Type:

Object

When the widget visualizes local data, loading is instant. But when the widget is bound to a remote data source, loading may takes a considerable amount of time. To keep the viewer's attention, the widget can display a loading indicator.

DevExtreme HTML5 Charts LoadingIndicator

To activate the loading indicator, assign true to the loadingIndicator.show option. Once data is loaded, the loading indicator will be hidden automatically.

See Also

margin

Generates space around the widget.

Type:

Object

WidgetMargin DevExtreme ChartJS

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.

Type:

function

Function parameters:
e:

Object

Information about the event.

Object structure:
component:

Object

element:

Element (jQuery or HTML)

The widget's container.

model:

Object

The model data. Available only if you use Knockout.

Default Value: null

onDrawn

A handler for the drawn event. Executed when the widget has finished drawing itself.

Type:

function

Function parameters:
e:

Object

Information about the event.

Object structure:
component:

Object

element:

Element (jQuery or HTML)

The widget's container.

model:

Object

The model data. Available only if you use Knockout.

Default Value: null
Cannot be used in themes.

onExported

A handler for the exported event. Executed after data from the widget is exported.

Type:

function

Function parameters:
e:

Object

Information about the event.

Object structure:
component:

Object

element:

Element (jQuery or HTML)

The widget's container.

model:

Object

The model data. Available only if you use Knockout.

Default Value: null

onExporting

A handler for the exporting event. Executed before data from the widget is exported.

Type:

function

Function parameters:
e:

Object

Information about the event.

Object structure:
component:

Object

element:

Element (jQuery or HTML)

The widget's container.

model:

Object

The model data. Available only if you use Knockout.

fileName:

String

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

cancel:

Boolean

Assign true to this field if you need to prevent exporting.

format:

String

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

Default Value: null

onFileSaving

A handler for the fileSaving event. Executed before a file with exported data is saved on the user's local storage.

Type:

function

Function parameters:
e:

Object

Information about the event.

Object structure:
component:

Object

element:

Element (jQuery or HTML)

The widget's container.

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'

data:

BLOB

Exported data as a BLOB.

cancel:

Boolean

Assign true to this field if you need to prevent the file from being saved.

Default Value: null

onIncidentOccurred

A handler for the incidentOccurred event. Executed when an error or warning appears in the widget.

Type:

function

Function parameters:
e:

Object

Information about the event.

Object structure:
component:

Object

element:

Element (jQuery or HTML)

The widget's container.

model:

Object

The model data. Available only if you use Knockout.

target: any

Information about the occurred incident.

Default Value: null

When an error or warning appears, the widget notifies you by passing a message to the browser console. This message contains the ID of the incident, a brief description, and a link to the Errors and Warnings section where further information about this incident can be found. However, you can handle errors and warnings in the way that you require. To do this, implement a callback function performing the required actions and assign it to the onIncidentOccurred option. Within this function, you can use information about the incident that occurred. This information can be accessed from the target field of the object passed to the callback function as a parameter. This information includes the following.

  • id
    Contains the ID of the incident. The full list of IDs can be found in the Errors and Warnings section.
  • type
    Contains the type of the incident. This field equals "error" for errors or "warning" for warnings.
  • args
    Contains the argument of the incident's message. The content of this field varies greatly, depending on the incident. For example, it may contain the name of the data source field that was not specified correctly, or the name of the option that was not set properly.
  • text
    Contains the text passed to the browser console. This text includes the content of the args field, if there are any.
  • widget
    Contains the name of the widget that produced the error or warning.
  • version
    Contains the currently used version of the DevExtreme library.

onInitialized

A handler for the initialized event. Executed only once, after the widget is initialized.

Type:

function

Function parameters:
e:

Object

Information about the event.

Object structure:
component:

Object

element:

Element (jQuery or HTML)

The widget's container.

Default Value: null

You cannot access elements in the widget because this handler is executed before they are ready. Use the onContentReady handler instead.

onOptionChanged

A handler for the optionChanged event. Executed after an option of the widget is changed.

Type:

function

Function parameters:
e:

Object

Information about the event.

Object structure:
component:

Object

name:

String

The option's short name.

fullName:

String

The option's full name.

value: any

The option's new value.

element:

Element (jQuery or HTML)

The widget's container.

model:

Object

The model data. Available only if you use Knockout.

Default Value: null

onSelectedRangeChanged

Deprecated

Use the onValueChanged option instead.

A handler for the selectedRangeChanged event.

Type:

function

Function parameters:
e:

Object

Information about the event.

Object structure:
component:

Object

element:

Element (jQuery or HTML)

The widget's container.

model:

Object

The model data. Available only if you use Knockout.

startValue:

Date

|

Number

The updated start range value.

endValue:

Date

|

Number

The updated end range value.

Default Value: null
Cannot be used in themes.

onValueChanged

A handler for the valueChanged event.

Type:

function

Function parameters:
e:

Object

Information about the event.

Object structure:
component:

Object

element:

Element (jQuery or HTML)

The widget's container.

model:

Object

The model data. Available only if you use Knockout.

value:

Array<Number | String | Date>

Two values that represent new start and end values.

previousValue:

Array<Number | String | Date>

Two values that represent old start and end values.

Default Value: null
Cannot be used in themes.

When implementing the handling function, use the object passed to it as the parameter. Among fields of this object, you can find old and new start and end range 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.

View Demo

See Also
Show Example:
jQuery

In this example, the function assigned to the onValueChanged field displays the selected range under the RangeSelector widget.


                                    

                                    

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.

Show Example:
jQuery

In this example, the scale is divided using the values assigned to the startValue and endValue fields, and major tick interval is set to 2 using the majorTickInteval option. In addition, minor ticks are hidden, because the showMinorTicks option is set to 'false'.


                                    

                                    

selectedRange

Deprecated

Use the value option instead.

Specifies the range to be selected when displaying the RangeSelector.

Type:

Object

selectedRangeColor

Specifies the color of the selected range.

Type:

String

Default Value: '#606060'

Show Example:
jQuery

Use the color box at the bottom to change the selectedRangeColor value.


                                    

                                    

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.

Show Example:
jQuery

In this example, the shutter's color and opacity options are changed.


                                    

                                    

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.

Show Example:
jQuery

In this example, the size of the RangeSelector widget is set smaller than the size of the container. The container border is displayed.


                                    

                                    

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.

Show Example:
jQuery

In this example, the slider handles are colored in 'brown' using the color option. In addition, the width and opacity options of the sliderHandle configuration object are changed.


                                    

                                    

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

Show Example:
jQuery

In this example, several options of the sliderMarker configuration object are changed.


                                    

                                    

theme

Sets the name of the theme the widget uses.

Type:

String

Default Value: 'generic.light'
Accepted Values: 'generic.light' | 'generic.dark' | 'generic.contrast' | 'generic.carmine' | 'generic.darkmoon' | 'generic.softblue' | 'generic.darkviolet' | 'generic.greenmist' | 'android5.light' | 'ios7.default'

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: 'desktop', 'desktop-dark', 'android', 'android-holo-light', 'ios', 'win8', 'win8-white', 'win8.white', 'win8.black'. In new applications, use themes listed in the accepted values.

When using the widget as an ASP.NET MVC Control, specify this option using the VizTheme enum. This enum accepts the following values: GenericLight, GenericDark, GenericContrast, GenericCarmine, GenericDarkMoon, GenericSoftBlue, GenericDarkViolet, GenericGreenMist, Android5Light, IOS7Default, Win10Black and Win10White.

Show Example:
jQuery

In this example, a custom theme is specified and applied to the range selector.


                                    

                                    

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.

Type:

Array<Number | String | Date>

Cannot be used in themes.

By default, the selected range is the entire scale. To specify a different range to be selected initially, assign an array of two values - start and end - to the value option. Depending on the scale type, these values should be of Numeric, String or Date type.

When using AngularJS/Knockout, bind a scope property/observable value to the value option if you need to get or set this option at runtime. With jQuery only, use the getValue() and setValue(value) methods for the same purpose.

See Also
Show Example:
jQuery

In this example, the [2, 5] range is set as the selected range after the RangeSelector widget is displayed.