JavaScript/jQuery RangeSelector Options
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 Control
@(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 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.
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
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 |
---|---|---|
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. |
|
fileName |
The name of the file to which the widget is about to be exported. |
|
cancel |
Allows you to prevent exporting. |
|
format |
The resulting file format. One of PNG, PDF, JPEG, SVG and GIF. |
onFileSaving
A function that is executed before a file with exported widget is saved to the user's local storage.
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. |
|
fileName |
The name of the file to be saved. |
|
format |
The format of the file to be saved. |
|
data |
Exported data as a BLOB. |
|
cancel |
Allows you to prevent file saving. |
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. |
You cannot access widget elements in this function because it is executed before they are ready. Use the onDrawn function instead.
onOptionChanged
Name | Type | Description |
---|---|---|
name |
The option's short name. |
|
model |
The model data. Available only if you use Knockout. |
|
element |
The widget's container. It is an HTML Element or a jQuery Element when you use jQuery. |
|
component |
The widget's instance. |
|
fullName |
The option's full name. |
|
value | any |
The option's new value. |
onSelectedRangeChanged
Use the onValueChanged property instead.
A function that is executed after the selected range 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. |
|
model |
The model data. Available only if you use Knockout. |
|
startValue | | |
The updated start range value. |
endValue | | |
The updated end range 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. |
|
model |
The model data. Available only if you use Knockout. |
|
value |
Two values that represent new start and end values. |
|
previousValue |
Two values that represent old 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
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.
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 Control. This enum accepts the following values: GenericLight
, GenericDark
, GenericContrast
, GenericCarmine
, GenericDarkMoon
, GenericSoftBlue
, GenericDarkViolet
, GenericGreenMist
, IOS7Default
, 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
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
- onValueChanged
- behavior.callValueChanged
If you have technical questions, please create a support ticket in the DevExpress Support Center.