# JSXGraph 1.7.0 Reference

## JavaScript must be enabled in order for you to use JSXGraph and JSXGraph reference. However, it seems JavaScript is either disabled or not supported by your browser.

Class Index | File Index

Elements

Classes

- _global_
- Angle
- Arc
- Arrow
- Arrowparallel
- Axis
- Bisector
- Bisectorlines
- Boxplot
- Button
- Cardinalspline
- Chart
- Checkbox
- Circle
- Circumcenter
- Circumcircle
- CircumcircleArc
- CircumcircleSector
- Comb
- Conic
- Curve
- Curve3D
- CurveDifference
- CurveIntersection
- CurveUnion
- Derivative
- Ellipse
- ForeignObject
- Functiongraph
- Functiongraph3D
- Glider
- Grid
- Group
- Hatch
- Hyperbola
- Image
- ImplicitCurve
- Incenter
- Incircle
- Inequality
- Input
- Integral
- Intersection
- JXG
- JXG.AbstractRenderer
- JXG.Board
- JXG.Board.infobox
- JXG.C
- JXG.CA
- JXG.CanvasRenderer
- JXG.Chart
- JXG.Circle
- JXG.Complex
- JXG.Composition
- JXG.Coords
- JXG.CoordsElement
- JXG.Curve
- JXG.Curve3D
- JXG.Dump
- JXG.EventEmitter
- JXG.Expect
- JXG.ForeignObject
- JXG.GeometryElement
- JXG.GeometryElement3D
- JXG.GeonextParser
- JXG.Group
- JXG.Image
- JXG.JessieCode
- JXG.JSXGraph
- JXG.Legend
- JXG.Line
- JXG.Line3D
- JXG.Math
- JXG.Math.BoxQuadtree
- JXG.Math.Clip
- JXG.Math.Extrapolate
- JXG.Math.Geometry
- JXG.Math.ImplicitPlot
- JXG.Math.IntervalArithmetic
- JXG.Math.Metapost
- JXG.Math.Nlp
- JXG.Math.Numerics
- JXG.Math.Plot
- JXG.Math.Poly
- JXG.Math.Poly.Monomial
- JXG.Math.Poly.Polynomial
- JXG.Math.Poly.Ring
- JXG.Math.ProbFuncs
- JXG.Math.Quadtree
- JXG.Math.Statistics
- JXG.Math.Symbolic
- JXG.NoRenderer
- JXG.Options
- JXG.Plane3D
- JXG.Point
- JXG.Point3D
- JXG.Polygon
- JXG.PrefixParser
- JXG.Server
- JXG.Server.modules
- JXG.Surface3D
- JXG.SVGRenderer
- JXG.Text
- JXG.Ticks
- JXG.Transformation
- JXG.Turtle
- JXG.Util
- JXG.Util.Base64
- JXG.Util.Unzip
- JXG.Util.UTF8
- JXG.View3D
- JXG.VMLRenderer
- JXG.XML
- Label
- Legend
- Line
- Line3D
- Locus
- MajorArc
- MajorSector
- Measurement
- Metapostspline
- Midpoint
- MinorArc
- MinorSector
- mirrorelement
- Mirrorpoint
- NonReflexAngle
- Normal
- Orthogonalprojection
- OtherIntersection
- Parabola
- Parallel
- Parallelogram
- Parallelpoint
- ParametricSurface3D
- Perpendicular
- PerpendicularPoint
- PerpendicularSegment
- Point
- Point3D
- PolarLine
- PolePoint
- Polygon
- PolygonalChain
- RadicalAxis
- Reflection
- ReflexAngle
- RegularPolygon
- Riemannsum
- Sector
- Segment
- Semicircle
- Slider
- Slopefield
- Slopetriangle
- Smartlabel
- Spline
- Stepfunction
- Tangent
- Tapemeasure
- Text
- Ticks
- Tracecurve
- Transformation
- Turtle
- Vectorfield
- Vectorfield3D
- View3D

# Class Slider

JXG.CoordsElement,JXG.GeometryElement
↳ JXG.Point
↳ Glider
↳ Slider

A slider can be used to choose values from a given range of numbers.
Defined in: slider.js.
Extends Glider.

Class Summary
Constructor Attributes | Constructor Name and Description
--- | ---
| Slider(start,end,data)

Fields borrowed from class JXG.GeometryElement:
  _org_type, _pos, ancestors, baseElement, board, childElements, dash, dashScale, descendants, draft, dragToTopOfLayer, dump, elementClass, elType, fillColor, fillOpacity, fixed, frozen, gradient, gradientAngle, gradientCX, gradientCY, gradientEndOffset, gradientFR, gradientFX, gradientFY, gradientR, gradientSecondColor, gradientSecondOpacity, gradientStartOffset, hasLabel, highlight, highlighted, highlightFillColor, highlightFillOpacity, highlightStrokeColor, highlightStrokeOpacity, highlightStrokeWidth, id, inherits, isDraggable, isLabel, isReal, lastDragTime, layer, lineCap, methodMap, mouseover, name, needsRegularUpdate, needsUpdate, notExistingParents, numTraces, parents, priv, quadraticform, rendNode, rotatable, scalable, shadow, snapToGrid, stdform, strokeColor, strokeOpacity, strokeWidth, subs, symbolic, tabindex, trace, traceAttributes, traces, transformations, transitionDuration, transitionProperties, type, viewport, visible, visProp, visPropCalc
Fields borrowed from class JXG.CoordsElement:
  coords, groups, isConstrained, needsUpdateFromParent, onPolygon, position, slideObject, slideObjects

Field Summary
Field Attributes | Field Name and Description
--- | ---
| _smax End value of the slider range.
| _smin Start value of the slider range.
| baseline Attributes for the base line of the slider.
| digits The number of digits of the slider value displayed in the optional text.
| highline Attributes for the highlighting line of the slider.
| intl Internationalization support for slider labels.
| label Attributes for the slider label.
| moveOnUp If true, 'up' events on the baseline will trigger slider moves.
| point1 Attributes for first (left) helper point defining the slider position.
| point2 Attributes for second (right) helper point defining the slider position.
| postLabel If not null, this is appended to the value and to unitLabel in the slider label.
| precision The precision of the slider value displayed in the optional text.
| size Size of slider point.
| snapValueDistance If the difference between the slider value and one of the elements of snapValues is less than this number (in user coordinate units), the slider will snap to that value.
| snapValues List of values to snap to.
| snapWidth The slider only returns integer multiples of this value, e.g.
| suffixLabel If not null, this replaces the part "name = " in the slider label.
| ticks Attributes for the ticks of the base line of the slider.
| unitLabel If not null, this is appended to the value in the slider label.
| withLabel Show slider label.
| withTicks Show slider ticks.

Fields borrowed from class JXG.GeometryElement:
  _org_type, _pos, ancestors, baseElement, board, childElements, dash, dashScale, descendants, draft, dragToTopOfLayer, dump, elementClass, elType, fillColor, fillOpacity, fixed, frozen, gradient, gradientAngle, gradientCX, gradientCY, gradientEndOffset, gradientFR, gradientFX, gradientFY, gradientR, gradientSecondColor, gradientSecondOpacity, gradientStartOffset, hasLabel, highlight, highlighted, highlightFillColor, highlightFillOpacity, highlightStrokeColor, highlightStrokeOpacity, highlightStrokeWidth, id, inherits, isDraggable, isLabel, isReal, lastDragTime, layer, lineCap, methodMap, mouseover, name, needsRegularUpdate, needsUpdate, notExistingParents, numTraces, parents, priv, quadraticform, rendNode, rotatable, scalable, shadow, snapToGrid, stdform, strokeColor, strokeOpacity, strokeWidth, subs, symbolic, tabindex, trace, traceAttributes, traces, transformations, transitionDuration, transitionProperties, type, viewport, visible, visProp, visPropCalc
Fields borrowed from class JXG.CoordsElement:
  coords, groups, isConstrained, needsUpdateFromParent, onPolygon, position, slideObject, slideObjects

Method Summary
Method Attributes | Method Name and Description
--- | ---
| setMax(val) Sets the maximum value of the slider.
| setMin(val) Sets the minimum value of the slider.
| setValue(val) Sets the value of the slider.
| Value() Returns the current slider value.

Methods borrowed from class Glider:
  startAnimation, stopAnimation
Methods borrowed from class JXG.Point:
  face, hasPoint, isOn, makeIntersection, normalizeFace, setStyle, update, updateRenderer, updateTransform
Methods borrowed from class JXG.GeometryElement:
  _set, addChild, addDescendants, addParents, addParentsFromJCFunctions, addRotation, addTicks, addTransform, animate, bounds, clearTrace, cloneToBackground, countChildren, createGradient, createLabel, draggable, formatNumberLocale, fullUpdate, generatePolynomial, getAttribute, getAttributes, getLabelAnchor, getName, getParents, getProperty, getSnapSizes, getTextAnchor, getType, handleSnapToGrid, hide, hideElement, noHighlight, normalize, prepareUpdate, remove, removeAllTicks, removeChild, removeDescendants, removeTicks, resolveShortcuts, setArrow, setAttribute, setDash, setDisplayRendNode, setLabel, setLabelText, setName, setParents, setPosition, setPositionDirectly, setProperty, show, showElement, snapToPoints, updateVisibility, useLocale
Methods borrowed from class JXG.CoordsElement:
  _anim, addAnchor, addConstraint, Coords, Dist, findClosestSnapValue, free, handleAttractors, handleSnapToPoints, makeGlider, moveAlong, moveTo, popSlideObject, setGliderPosition, setPositionByTransform, updateConstraint, updateCoords, updateGlider, updateGliderFromParent, visit, X, XEval, Y, YEval, Z, ZEval

Events borrowed from class JXG.GeometryElement:
  attribute, attribute:key, down, drag, keydrag, mousedown, mousedrag, mousemove, mouseout, mouseover, mouseup, move, out, over, pendown, pendrag, penup, touchdown, touchdrag, touchup, up

Class Detail
Slider(start,end,data)

Parameters:
{Array_Array_Array} start,end,data
  The first two arrays give the start and the end where the slider is drawn on the board. The third array gives the start and the end of the range the slider operates as the first resp. the third component of the array. The second component of the third array gives its start value.

Throws:
{Exception}
  If the element cannot be constructed with the given parent objects an exception is thrown.

Examples:

    // Create a slider with values between 1 and 10, initial position is 5.
    var s = board.create('slider', [[1, 2], [3, 2], [1, 5, 10]]);

    // Create a slider taking integer values between 1 and 50. Initial value is 50.
    var s = board.create('slider', [[1, 3], [3, 1], [0, 10, 50]], {snapWidth: 1, ticks: { drawLabels: true }});

        // Draggable slider
        var s1 = board.create('slider', [[-3,1], [2,1],[-10,1,10]], {
            visible: true,
            snapWidth: 2,
            point1: {fixed: false},
            point2: {fixed: false},
            baseline: {fixed: false, needsRegularUpdate: true}
        });

        // Set the slider by clicking on the base line: attribute 'moveOnUp'
        var s1 = board.create('slider', [[-3,1], [2,1],[-10,1,10]], {
            snapWidth: 2,
            moveOnUp: true // default value
        });

    // Set colors
    var sl = board.create('slider', [[-3, 1], [1, 1], [-10, 1, 10]], {

      baseline: { strokeColor: 'blue'},
      highline: { strokeColor: 'red'},
      fillColor: 'yellow',
      label: {fontSize: 24, strokeColor: 'orange'},
      name: 'xyz', // Not shown, if suffixLabel is set
      suffixLabel: 'x = ',
      postLabel: ' u'

    });

Field Detail
{Number} _smax
End value of the slider range.

{Number} _smin
Start value of the slider range.

{Line} baseline
Attributes for the base line of the slider.
Defined in: options.js.

{Number} digits
The number of digits of the slider value displayed in the optional text.
Defined in: options.js.

Default Value:
  2

{Line} highline
Attributes for the highlighting line of the slider.
Defined in: options.js.

{object} intl
Internationalization support for slider labels.
Defined in: options.js.

    var s = board.create('slider', [[-2, 3], [2, 3], [0, 1, 360]], {
        name: 'α',
        snapWidth: 1,
        intl: {
            enabled: true,
            options: {
                style: 'unit',
                unit: 'degree',
            }
        }
    });

See:
  JXG.Board#intl
  Text#intl

{Label} label
Attributes for the slider label.
Defined in: options.js.

{Boolean} moveOnUp
If true, 'up' events on the baseline will trigger slider moves.
Defined in: options.js.

Default Value:
  true

{Point} point1
Attributes for first (left) helper point defining the slider position.
Defined in: options.js.

{Point} point2
Attributes for second (right) helper point defining the slider position.
Defined in: options.js.

{String} postLabel
If not null, this is appended to the value and to unitLabel in the slider label. Possible types: string, number or function.
Defined in: options.js.

See:
  JXG.Slider#suffixLabel
  JXG.Slider#unitLabel

Default Value:
  null

{Number} precision
The precision of the slider value displayed in the optional text. Replaced by the attribute "digits".
Defined in: options.js.

See:
  Slider#digits

Default Value:
  2

{Number} size
Size of slider point.
Defined in: options.js.

See:
  Point#size

Default Value:
  6

{Number} snapValueDistance
If the difference between the slider value and one of the elements of snapValues is less than this number (in user coordinate units), the slider will snap to that value.
Defined in: options.js.

See:
  Slider#snapValues

Default Value:
  0.0

{Array} snapValues
List of values to snap to. If the glider is within snapValueDistance (in user coordinate units) of one of these points, then the glider snaps to that point.
Defined in: options.js.

            var n = board.create('slider', [[-2, 3], [4, 3], [1, 5, 100]], {
                name: 'n',
                snapWidth: 1,
                snapValues: [1, 22, 77, 100],
                snapValueDistance: 5
            });

            var k = board.create('slider', [[-2, -1], [4, -1], [-4, 0, 4]], {
                name: 'k',
                snapWidth: 0.1,
                snapValues: [-3, -1, 1, 3],
                snapValueDistance: 0.4
            });

See:
  Slider#snapValueDistance

Default Value:
  empty

{Number} snapWidth
The slider only returns integer multiples of this value, e.g. for discrete values set this property to `1`. For continuous results set this to `-1`.
Defined in: options.js.

{String} suffixLabel
If not null, this replaces the part "name = " in the slider label. Possible types: string, number or function.
Defined in: options.js.

See:
  JXG.Slider#unitLabel
  JXG.Slider#postLabel

Default Value:
  null

{Ticks} ticks
Attributes for the ticks of the base line of the slider.
Defined in: options.js.

{String} unitLabel
If not null, this is appended to the value in the slider label. Possible types: string, number or function.
Defined in: options.js.

See:
  JXG.Slider#suffixLabel
  JXG.Slider#postLabel

Default Value:
  null

{Boolean} withLabel
Show slider label.
Defined in: options.js.

Default Value:
  true

{Boolean} withTicks
Show slider ticks.
Defined in: options.js.

Default Value:
  true

Method Detail
{Object} setMax(val)
Sets the maximum value of the slider.

Parameters:
{Number} val
  New maximum value

Returns:
  {Object} this object

{Object} setMin(val)
Sets the minimum value of the slider.

Parameters:
{Number} val
  New minimum value

Returns:
  {Object} this object

{Object} setValue(val)
Sets the value of the slider. This call must be followed by a board update call.

Parameters:
{Number} val
  New value

Returns:
  {Object} this object

{Number} Value()
Returns the current slider value.

Returns:
  {Number}

Documentation generated by JsDoc Toolkit 2.4.0 on Wed Feb 14 2024 15:53:29 GMT+0100 (heure normale d’Europe centrale)