RangeSelector

The dxRangeSelector is a widget that allows a user to select a range of values on a scale.

Included in: dx.chartjs.js, dx.all.js
RangeSelector interactive configuration
Copy Code
Copy to Codepen
$("#rangeselector").dxRangeSelector({
});

                    

This widget represents a scale (numeric or date-time) and two sliders. A user selects the required range by moving the sliders.

RangeSelector

You can create the widget using one of the following approaches.

  • jQuery
    Use the dxRangeSelector jQuery plug-in.

    HTML
    <div id="rangeSelectorContainer"></div>
    JavaScript
    $("#rangeSelectorContainer").dxRangeSelector({
        scale: {
            startValue: new Date(2011, 1, 1),
            endValue: new Date(2011, 6, 1),
            tickInterval: { days: 7 }
        }
    });
  • Knockout
    Add a div element and apply the dxRangeSelector binding to this element.

    HTML
    <div data-bind="dxRangeSelector: {
        scale: {
            startValue: new Date(2011, 1, 1),
            endValue: new Date(2011, 6, 1),
            tickInterval: { days: 7 }
        }
    }"></div>
  • AngularJS
    Add a div element and apply the dx-range-selector directive to this element.

    HTML
    <div dx-range-selector="{
        scale: {
            startValue: new Date(2011, 1, 1),
            endValue: new Date(2011, 6, 1),
            tickInterval: { days: 7 }
        }
    }"></div>

Note that DevExtreme widgets require you to link the jQuery and Globalize libraries to your application. If you use the Knockout or AngularJS approach, the Knockout or AngularJS library is also required. For detailed information on how to link the needed libraries, refer to the Installation article.

A chart can be displayed in the background of the dxRangeSelector widget. This allows end users to select the required range in a chart series. You can also integrate the dxRangeSelector widget with a stand-alone dxChart widget to emulate chart zooming and scrolling.

View Demo Watch Video

See Also

To learn the widget's concepts and overview features, refer to the Range Selector section within the Data Visualization Guides.

Configuration

An object that defines configuration options for the dxRangeSelector widget.

Name Description
background

Specifies the options for the range selector's background.

behavior

Specifies the dxRangeSelector's behavior options.

chart

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

containerBackgroundColor

Specifies the color of the parent page element.

dataSource

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

dataSourceField

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

indent

Range selector's indent options.

loadingIndicator

Specifies the appearance of the loading indicator.

margin

Specifies the blank space in pixels between the dxRangeSelector widget's extreme elements and the boundaries of the area provided for the widget (see size).

onDisposing

A handler for the disposing event.

onDrawn

A handler for the drawn event.

onIncidentOccurred

A handler for the incidentOccurred event.

onInitialized

A handler for the initialized event.

onOptionChanged

A handler for the optionChanged event.

onSelectedRangeChanged

A handler for the selectedRangeChanged event.

pathModified

Notifies a widget that it is embedded into an HTML page that uses a path modifier.

redrawOnResize

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

rtlEnabled

Specifies whether or not the widget supports right-to-left representation.

scale

Specifies options of the range selector's scale.

selectedRange

Specifies the range to be selected when displaying the dxRangeSelector.

selectedRangeColor

Specifies the color of the selected range.

shutter

Specifies range selector shutter options.

size

Specifies in pixels the size of the dxRangeSelector widget.

sliderHandle

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

sliderMarker

Defines the options of the range selector slider markers.

theme

Sets the name of the theme to be used in the widget.

title

Specifies a title for the range selector.

Methods

This section describes the methods that can be used in code to manipulate objects related to the dxRangeSelector.

Name Description
beginUpdate()

Prevents the component from refreshing until the endUpdate method is called.

element()

Returns the root HTML element of the widget.

endUpdate()

Enables the component to refresh after the beginUpdate method call.

getSelectedRange()

Returns the currently selected range.

hideLoadingIndicator()

Conceals the loading indicator.

instance()

Returns an instance of this component class.

off(eventName)

Detaches all event handlers from the specified event.

off(eventName, eventHandler)

Detaches a particular event handler from the specified event.

on(eventName, eventHandler)

Subscribes to a specified event.

on(events)

Subscribes to the specified events.

option()

Returns the configuration options of this component.

option(optionName)

Gets the value of the specified configuration option of the widget.

option(optionName, optionValue)

Sets a value to the specified configuration option of the widget.

option(options)

Sets one or more options of this component.

render(skipChartAnimation)

Redraws a widget.

setSelectedRange(selectedRange)

Sets a specified range.

showLoadingIndicator()

Displays the loading indicator.

svg()

Returns the widget's SVG markup.

Events

This section describes events fired by this widget.

Name Description
disposing

Fires when the widget is being removed.

drawn

Fires when the widget has finished drawing itself.

incidentOccurred

Fires when an error or warning appears in a widget.

initialized

Fires when the widget is initialized.

optionChanged

Fires after an option of the component is changed.

selectedRangeChanged

Fires when the selected range is changed.