React RangeSelector - 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.
allowDecimals
Specifies whether to allow decimal values on the scale. When false, the scale contains integer values only.
breaks[]
Declares a scale break collection. Applies only if the scale's type is "continuous" or "logarithmic".
A scale break allows breaking off a part of the scale to improve the readability of a range selector with high amplitude values.
Each object in the breaks array configures a single scale break. Note that a scale break is visible only if its range exceeds the tick interval.
See Also
categories
If the data source field provides string values, the scale build on them will be discrete. Values on a discrete scale are called "categories". By default, categories have the same running order as values in the data source field. If this is does not meet your requirements, declare an array specifying a custom running order for categories. This array should contain category names. After that, assign this array to the scale's categories option.
If you do not use a data source, specify the categories array to generate a discrete scale.
label
Scale labels represent textual values for major scale ticks. The label object exposes properties that allow you to specify custom text for scale labels and properties that allow you to change the font for text.
logarithmBase
Specifies the value to be raised to a power when generating ticks for a logarithmic scale.
By default, ticks on a logarithmic scale are generated on a base of 10, i.e., 0.1, 1, 10, 100, 1000, etc. But you can specify a base you require using the logarithmBase option. For example, if you set this option to 5, the following ticks will be generated: 0.5, 5, 25, 125, 625, etc.
majorTickInterval
Use the tickInterval property instead.
Use this property to divide the scale by major ticks in a specified interval. If this property is not set, major ticks are arranged automatically.
In the case of a numeric scale, assign a numeric value to this property. If the scale is of the date-time type, assign one of the predefined string values. To set an interval to several days, hours, etc., assign an object with the corresponding field specified (days, hours or another field). Note that this object should contain only one of the fields described in this section.
marker
When a scale is of the date-time type, scale markers can be displayed. If a major tick interval is set in days, a marker will be displayed between the last day of the month and the first day of the new month. The marker will indicate the new month. The same logic for setting markers is used when a tick interval is set using other date-time units.
A marker consists of a separator and label that belongs to the separator. To set the visibility of the markers, and change their default location and appearance, use the properties of the marker configuration object.
maxRange
Use this property to set the maximum range that can be selected. When trying to move a slider from the other slider further than the specified maximum range, the marker will display the last possible value that can be set and change the font color to 'red'. You can set which color to use to indicate an invalid range. For this purpose, use the invalidRangeColor property of the sliderMarker configuration object.
In case of the numeric scale, assign a numeric value to this property. If the scale is of the date-time type, assign one of the predefined string values or an object to this property. The object's properties specify the number of days, hours, etc.
You can also set a minimum range that can be selected, using the minRange property.
minorTick
Major and minor ticks are calculated automatically based on the scale's startValue and endValue property values. Major ticks are made visible by default. You can make minor ticks visible as well, using their visible property. In addition, you can set a custom minor tick interval or add custom minor ticks using the tickInterval and customTickValues properties respectively. You can also specify the length, width and color of the minor ticks using corresponding properties.
minorTickCount
If you set both the minorTickCount property and the minorTickInterval property, the minorTickCount property value will be ignored.
minorTickInterval
In the case of a numeric scale, assign a numeric value to this property. If the scale is of the date-time type, assign one of the predefined string values. To set an interval to several days, hours, etc., assign an object with the corresponding field specified (days, hours or another field). Note that this object should contain only one of the fields described in this section.
When the snapToTicks property is set to true, sliders are docked to both major and minor ticks.
To prohibit the display of minor ticks, set the scale's showMinorTicks property to false.
To set a custom tick interval between major ticks, use the scale's tickInterval property.
When using the widget as an ASP.NET MVC Control, specify this option using the VizTimeInterval
enum. This enum accepts the same values, but they start with an upper-case letter, for example, 'day' becomes Day
.
minRange
Use this property to set the minimum range that can be selected. When moving a slider to a position near the other slider that is closer than the specified minimum range, the marker will display the last possible value that it can be set to, and change the font color to 'red'. You can set the color used to indicate an invalid range by using the invalidRangeColor property of the sliderMarker configuration object.
You can also set the maximum range that can be selected using the maxRange property.
placeholderHeight
The scale's height includes the space occupied by scale labels, markers, and the space between the scale labels and markers.
You may need to set this property when you need to know the exact size of the RangeSelector widget elements in vertical and horizontal directions. For instance, this may be required when displaying an image in the background in a stretched mode. To get the background height, subtract the scale's placeholder size and the slider markers' placeholder height from the RangeSelector's height.
setTicksAtUnitBeginning
This functionality is deprecated as redundant.
Indicates whether or not to set ticks of a date-time scale at the beginning of each date-time interval.
showCustomBoundaryTicks
Specifies whether or not to show ticks for the boundary scale values, when neither major ticks nor minor ticks are created for these values.
tickInterval
In the case of a numeric scale, assign a numeric value to this property. If the scale is of the date-time type, assign one of the predefined string values. To set an interval to several days, hours, etc., assign an object with the corresponding field specified (days, hours or another field). Note that this object should contain only one of the fields described in this section.
When using the widget as an ASP.NET MVC Control, specify this option using the VizTimeInterval
enum. This enum accepts the same values, but they start with an upper-case letter, for example, 'day' becomes Day
.
type
To decide on the scale type to use, check the type of values the scale contains.
The "continuous" type is used by default when the scale displays numeric or date-time values. Although it is divided into intervals automatically, you can specify custom intervals using the tickInterval and minorTickInterval properties.
The "logarithmic" type can be set for numeric values. A logarithmic axis is useful when you visualize a dataset of rapidly-growing values. Each scale tick represents a particular value that is raised to the next power in turn. This particular value is specified by the logarithmBase option. For example, if you set this option to 5, the following ticks will be generated: 50, 51, 52, 53, etc.
The scale will have the "discrete" type if it is built on string values. Values on this scale are called "categories". They can be generated automatically from the data source or you can specify them implicitly using the categories option.
In addition, RangeSelector provides a scale of the 'semidiscrete' type. Use it when you need to divide continuous data (numeric or date-time) into categories and allow the user to operate strictly with them. This scale type requires the minRange property to be set. For example, the following code builds a semidiscrete scale on date-time values. This scale is divided into months, and the user operates with them as if they were categories.
var rangeSelectorOptions = { // ... scale: { startValue: new Date(2015, 0, 1), endValue: new Date(2016, 0, 1), type: 'semidiscrete', minRange: 'month' } };
Another example: a semidiscrete scale built on numeric values. This time, the scale is divided into tens.
var rangeSelectorOptions = { // ... scale: { startValue: 0, endValue: 100, type: 'semidiscrete', minRange: 10 } };
When using the widget as an ASP.NET MVC Control, specify this option using the RangeSelectorAxisScaleType
enum. This enum accepts the following values: Discrete
, Continuous
, Logarithmic
and Semidiscrete
.
useTicksAutoArrangement
Use the overlappingBehavior property instead.
If this property is set to true, the major tick interval always changes automatically when labels overlap each other. For instance, when labels are large due to the formatting that is applied, the tick interval will increase. In addition, when you set a custom tick interval that is so small that labels overlap each other, the tick interval will increase. To prohibit the automatic arrangement of ticks, set the useTicksAutoArrangement property to false.
valueType
When the scale is built on values from a data source, scale values and data source values have the same type. For example, if numeric values are specified in the data source, scale values will also be of a numeric type. In some scenarios, you may need to convert data source values into another type if, for instance, numbers are stored as strings in your data source. In this case, use the valueType option to specify the type of scale values implicitly.
When using the widget as an ASP.NET MVC Control, specify this option using the ChartDataType
enum. This enum accepts the following values: Numeric
, DateTime
and String
.
workdaysOnly
Leaves only workdays on the scale: the work week days plus single workdays minus holidays. Applies only if the scale's valueType is "datetime".
workWeek
Specifies which days are workdays. The array can contain values from 0 (Sunday) to 6 (Saturday). Applies only if workdaysOnly is true.
If you have technical questions, please create a support ticket in the DevExpress Support Center.