Slider
New to Analytica 6.3
Use this function to create a slider control in a user input node or in an edit table cell.
A slider control has a horizontal track with one or more movable thumbs that are used to select a value, an interval, or multiple values. A slider can be continuous or discrete -- a discrete slider limits the thumb to a finite set of positions. Its Domain specifies the space of selectable values and thus determines whether it is continuous or discrete. A slider can also optionally include labels with tick marks.
Slider( val..., domain, styles, ..., resultIndex, returnRef )
has one thumb with the value 0.5 selected initially. It defaults to a Continuous(0,1) domain. When you move the slider, it changes the value that appears for the first parameter. When you evaluate it, it returns the value in its first parameter.
Slider(0.5,0.75) has two thumbs and is useful for selecting an interval. It also defaults to a Continuous(0,1) domain. When evaluated, it returns a 2-element list, e.g., [0.5, 0.75].
Similarly, you can have more than two thumbs by listing N values.
DOMAIN
The most common way to specify the domain for the slider by setting the Domain attribute for the variable that contains the slider. You can set the Domain to Continuous or Integer and specify the lower and upper bounds, or you can use Explicit Values or Copy-from-index.
Alternatively, you can specify the domain to the «domain» parameter of the function call, such as:
Slider( 'Good', domain:Discrete('Horrible','Bad','Neutral','Good','Excellent') )
When the domain is not specified in either place, in uses Continuous(0,1).
RETURN VALUE
A slider with one thumb returns its first parameter. E.g., Slider(0.7) returns 0.7.
A slider with two or more thumbs returns a list of the values, e.g., Slider(0.3, 0.7) returns the list [0.3, 0.7]. In some places, this is a problem. For example, if you have 2 or more interval sliders in the same table, each becomes a separate implicit index, which is not allowed. There are two alternatives -- you can either supply a «resultIndex», or you can have it return a reference to the selections by setting «returnRef» to true.
ORDERING
When a slider has 2 or more thumbs, the default is to constrain the ordering of the thumbs so that the left thumb cannot move past the right thumb. You can change this by including 'Unordered' in the «styles» parameter.
APPEARANCE
There are many style and color options available that alter the appearance sliders. In most cases, you'll want to adopt a consistent color and style scheme for all sliders in your model. To control these model-wide defaults, make sure no node is selected, then use the menus to navigate to
Definition / System variables / Settings / Slider style defaults / Edit table
Each individual slider can override these model-wide defaults by specifying styles in the «styles» parameter, or by specifying any of the color parameters, or the «trackHeight» parameter.
The «styles» parameter accepts these options: 'Needle', 'Circle', 'Rectangle', 'Diamond', 'Block', 'Line', 'NoThumb': The thumb shape 'RoundedEnds', 'FlatEnds': The track shape 'LabelsNone','LabelsBelow','LabelsAtEnds': Whether and where labels apppear 'ShowSelect','HideSelect': Whether the area to the left of a single thumb, or between 2 thumbs, uses «selectColor» 'Ordered', 'Unordered': Whether multiple thumbs can cross over each other
For example: Slider( 1, styles:'ShowSelect','Line','FlatEnds','LabelsAtEnds' )
Colors are specified either via a color integer using the 0xrrggbb or 0xaarrggbb notation, or by naming the color, e.g., Slider( 1, TrackColor: 0xff0000, ThumbColor:'Pink' )
You can specify multiple colors in the «thumbColor» parameter if you want each thumb in the same slider to have a different color, e.g., Slider(0.25,0.5,0.75,thumbColor:'green','yellow','red')
Enable comment auto-refresher