IntervalSlider

IntervalSlider[{xmin,xmax}]

represents a slider with setting {xmin,xmax} in the range 0 to 1.

IntervalSlider[Dynamic[int]]

takes the setting to be the dynamically updated current value of int, with the value of int being reset if the slider is moved.

IntervalSlider[int,{min,max}]

represents a slider with range min to max.

IntervalSlider[int,{min,max,dx}]

represents a slider that jumps in steps dx.

Details and Options

  • IntervalSlider[] displays in a notebook as a horizontal slider with three slider thumbs that can be manipulated interactively.
  • IntervalSlider[Dynamic[int]] will reset the value of int when the slider is moved; IntervalSlider[int] will not.
  • IntervalSlider[int,{min,max,dx}] jumps to integer positions if min and dx are integers.
  • The following options can be given:
  • AppearanceAutomaticthe overall appearance of the slider
    AutoActionFalsewhether to move the slider automatically when the mouse is over it
    BackgroundAutomaticthe background for the slider
    BaselinePositionAutomaticalignment relative to the surrounding text
    BaseStyle{}base style specifications for the slider
    ContinuousActionTruewhether to update continuously when the slider is moved
    EnabledAutomaticwhether the slider is enabled or grayed out
    ImageMarginsAutomaticmargins around the image of the displayed slider
    ImageSizeMediumthe overall image size of the displayed slider
    MethodAutomaticmethod by which the two endpoint slider thumbs interact
    MinIntervalSize0how close the two endpoints can be to each other
  • Possible settings for Appearance include Automatic, "Markers", "Generic", "Locator", and None.
  • If the Appearance setting includes "Vertical", a vertical slider will be displayed.
  • Appearance -> "Labeled" displays the current value of the slider as an editable label.
  • If the Appearance setting includes "ThumbAppearance"->{expr1,expr2,expr3}, the three interactive points on the slider will use the given expressions for their display. Nothing will be displayed for the interactive point if None is specified.
  • Possible settings for Method include "Free", "Push", and "Stop".
  • IntervalSlider[] is equivalent to IntervalSlider[{0.25, 0.75}].
  • The resulting slider can be finely manipulated by holding down the key (or on Macintosh) while dragging the mouse. This causes the slider to move at 1/20 the rate of the mouse. The slider can be even more finely manipulated by also holding the and/or keys.

Examples

open allclose all

Basic Examples  (2)

An interval from 0.2 to 0.5 in the default range 0 to 1:

A slider with its value updated dynamically:

Scope  (4)

Use the range to 10:

Use only integer variable values:

Use rational steps:

Use slider increments of :

Use a custom function when assigning new values:

Options  (11)

Appearance  (5)

Special arrow appearances:

Show no special slider thumbs:

Show the current interval values in an editable label:

Display a vertical slider:

Appearance can be set to a list:

Use any expression as slider thumbs:

Enabled  (2)

By default, IntervalSlider is enabled:

By setting Enabled->False, the slider is disabled but visible in its current state:

Method  (3)

When trying to drag one endpoint past the other, the default method will not stop you:

The "Push" method causes the dragging of one endpoint to push the other out of the way:

With the "Stop" method, you cannot drag one endpoint past the other:

MinIntervalSize  (1)

If the two thumbs must have different values, set MinIntervalSize to a positive number:

Applications  (1)

Get a detailed view of a financial dataset:

Properties & Relations  (1)

ControlType->IntervalSlider will create an IntervalSlider in Manipulate:

Possible Issues  (1)

By default, IntervalSlider does not force the first element to remain less than the second:

To prevent dragging the minimum greater than the maximum, use Method -> "Push" or "Stop":

Add a MinIntervalSize setting if the minimum should be strictly less than the maximum:

Neat Examples  (1)

Show the value of the endpoints directly on the slider thumbs:

Introduced in 2014
 (10.0)
 |
Updated in 2019
 (12.0)