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


Class JXG.Ticks

JXG.GeometryElement
      ↳ JXG.Ticks

Ticks provides methods for creation and management of ticks on an axis.

Defined in: ticks.js.
Extends JXG.GeometryElement.

Class Summary
Constructor Attributes Constructor Name and Description
 
JXG.Ticks(line, ticks, attributes)
Creates ticks for an axis.
Fields borrowed from class JXG.GeometryElement:
_org_type, _pos, ancestors, baseElement, childElements, dash, descendants, draft, dump, elementClass, elType, fillColor, fillOpacity, fixed, frozen, hasLabel, highlight, highlighted, highlightFillColor, highlightFillOpacity, highlightStrokeColor, highlightStrokeOpacity, highlightStrokeWidth, id, isDraggable, isReal, lastDragTime, methodMap, mouseover, name, needsRegularUpdate, needsUpdate, notExistingParents, numTraces, parents, quadraticform, rendNode, scalable, shadow, snapToGrid, stdform, strokeColor, strokeOpacity, strokeWidth, subs, symbolic, trace, traceAttributes, traces, transformations, type, visible, visProp, withLabel
Field Summary
Field Attributes Field Name and Description
 
The board the ticks line is drawn on.
 
Equidistant ticks.
 
Array of fixed ticks.
 
To ensure the uniqueness of label ids this counter is used.
 
Array where the labels are saved.
 
A list of labels that are currently unused and ready for reassignment.
 
The line the ticks belong to.
 
Least distance between two ticks, measured in pixels.
 
Stores the ticks coordinates
 
Distance between two major ticks in user coordinates
 
A function calculating ticks delta depending on the ticks number.
Fields borrowed from class JXG.GeometryElement:
_org_type, _pos, ancestors, baseElement, childElements, dash, descendants, draft, dump, elementClass, elType, fillColor, fillOpacity, fixed, frozen, hasLabel, highlight, highlighted, highlightFillColor, highlightFillOpacity, highlightStrokeColor, highlightStrokeOpacity, highlightStrokeWidth, id, isDraggable, isReal, lastDragTime, methodMap, mouseover, name, needsRegularUpdate, needsUpdate, notExistingParents, numTraces, parents, quadraticform, rendNode, scalable, shadow, snapToGrid, stdform, strokeColor, strokeOpacity, strokeWidth, subs, symbolic, trace, traceAttributes, traces, transformations, type, visible, visProp, withLabel
Method Summary
Method Attributes Method Name and Description
<private>  
adjustTickDistance(ticksDelta, coordsZero, deltas, bounds)
Auxiliary method used by JXG.Ticks#generateEquidistantTicks to adjust the distance between two ticks depending on JXG.Ticks#minTicksDistance value
<private>  
(Re-)calculates the ticks coordinates.
<private>  
generateEquidistantTicks(coordsZero, bounds)
Creates ticks coordinates and labels automatically.
<private>  
generateFixedTicks(coordsZero, bounds)
Creates ticks coordinates and labels based on JXG.Ticks#fixedTicks and JXG.Ticks#labels.
<private>  
generateLabel(labelText, tick, tickNumber)
Create a tick label
<private>  
generateLabelText(tick, zero, value)
Creates the label text for a given tick.
<private>  
getDistanceFromZero(zero, point)
Calculates the distance in user coordinates from zero to a given point including its sign
<private>  
getLowerAndUpperBounds(coordsZero, type)
Calculate the lower and upper bounds for tick rendering If JXG.Ticks#includeBoundaries is false, the boundaries will exclude point1 and point2
<private>  
Calculates the x and y distance in pixel between two units in user space.
<private>  
Returns the coordinates of the point zero of the line.
 
hasPoint(x, y)
Checks whether (x,y) is near the line.
<private>  
Ticks function: determines the distance (in user units) of two major ticks.
<private>  
processTickPosition(coordsZero, tickPosition, ticksDelta, deltas)
Auxiliary method used by JXG.Ticks#generateEquidistantTicks to create a tick in the line at the given tickPosition.
<private>  
Removes the HTML divs of the tick labels before repositioning
 
setPositionDirectly(method, coords, oldcoords)
Sets x and y coordinate of the tick.
<private>  
Sets the variables used to set the height and slope of each tick.
<private>  
tickEndings(coords, major)
 
Recalculate the tick positions and the labels.
 
Uses the boards renderer to update the arc.
Methods borrowed from class JXG.GeometryElement:
_set, addChild, addDescendants, addParents, addRotation, addTransform, animate, bounds, clearTrace, cloneToBackground, countChildren, createGradient, createLabel, draggable, generatePolynomial, getAttribute, getAttributes, getLabelAnchor, getName, getParents, getProperty, getTextAnchor, getType, handleSnapToGrid, hideElement, labelColor, noHighlight, normalize, prepareUpdate, remove, removeChild, removeDescendants, resolveShortcuts, setArrow, setAttribute, setDash, setLabel, setLabelText, setName, setParents, setPosition, setProperty, showElement, snapToPoints
Events borrowed from class JXG.GeometryElement:
attribute, attribute:<attribute><attribute>, down, drag, mousedown, mousedrag, mousemove, mouseout, mouseover, mouseup, move, out, over, touchdown, touchdrag, touchup, up
Class Detail
JXG.Ticks(line, ticks, attributes)
Creates ticks for an axis.
Parameters:
{JXG.Line} line
Reference to the axis the ticks are drawn on.


{Number|Array} ticks
Number defining the distance between two major ticks or an array defining static ticks.


{Object} attributes
Properties


See:
JXG.Line#addTicks
Field Detail
{JXG.Board} board
The board the ticks line is drawn on.

{Boolean} equidistant
Equidistant ticks. Distance is defined by ticksFunction

{Array} fixedTicks
Array of fixed ticks.

labelCounter
To ensure the uniqueness of label ids this counter is used.

{Array} labels
Array where the labels are saved. There is an array element for every tick, even for minor ticks which don't have labels. In this case the array element contains just null.

labelsRepo
A list of labels that are currently unused and ready for reassignment.

{JXG.Line} line
The line the ticks belong to.

{int} minTicksDistance
Least distance between two ticks, measured in pixels.

ticks
Stores the ticks coordinates

ticksDelta
Distance between two major ticks in user coordinates

{Function} ticksFunction
A function calculating ticks delta depending on the ticks number.
Method Detail
<private> adjustTickDistance(ticksDelta, coordsZero, deltas, bounds)
Auxiliary method used by JXG.Ticks#generateEquidistantTicks to adjust the distance between two ticks depending on JXG.Ticks#minTicksDistance value
Parameters:
{Number} ticksDelta
distance between two major ticks in user coordinates
{JXG.Coords} coordsZero
coordinates of the point considered zero
{Object} deltas
x and y distance in pixel between two user units
{Object} bounds
upper and lower bound of the tick positions in user units.

<private> calculateTicksCoordinates()
(Re-)calculates the ticks coordinates.

<private> generateEquidistantTicks(coordsZero, bounds)
Creates ticks coordinates and labels automatically. The frequency of ticks is affected by the values of JXG.Ticks#insertTicks and JXG.Ticks#ticksDistance
Parameters:
{JXG.Coords} coordsZero
coordinates of the point considered zero
{Object} bounds
contains the lower and upper boundaries for ticks placement

<private> generateFixedTicks(coordsZero, bounds)
Creates ticks coordinates and labels based on JXG.Ticks#fixedTicks and JXG.Ticks#labels.
Parameters:
{JXG.Coords} coordsZero
Coordinates of the point considered zero
{Object} bounds
contains the lower and upper boundaries for ticks placement

<private> {JXG.Text} generateLabel(labelText, tick, tickNumber)
Create a tick label
Parameters:
{String} labelText
{JXG.Coords} tick
{Number} tickNumber
Returns:
{JXG.Text}

<private> {String} generateLabelText(tick, zero, value)
Creates the label text for a given tick. A value for the text can be provided as a number or string
Parameters:
{JXG.Coords} tick
The Coords-object of the tick to create a label for
{JXG.Coords} zero
The Coords-object of line's zero
{Number|String} value
A predefined value for this tick
Returns:
{String}

<private> {Number} getDistanceFromZero(zero, point)
Calculates the distance in user coordinates from zero to a given point including its sign
Parameters:
{JXG.Coords} zero
coordinates of the point considered zero
{JXG.Coords} point
coordinates of the point to find out the distance
Returns:
{Number} distance between zero and point, including its sign

<private> {String, Object} getLowerAndUpperBounds(coordsZero, type)
Calculate the lower and upper bounds for tick rendering If JXG.Ticks#includeBoundaries is false, the boundaries will exclude point1 and point2
Parameters:
{JXG.Coords} coordsZero
type
Returns:
{String} type (Optional) If type=='ticksdistance' the bounds are the intersection of the line with the bounding box of the board. Otherwise it is the projection of the corners of the bounding box to the line. The first case i s needed to automatically generate ticks. The second case is for drawing of the ticks.
{Object} contains the lower and upper bounds

<private> {Object} getXandYdeltas()
Calculates the x and y distance in pixel between two units in user space.
Returns:
{Object}

<private> {JXG.Coords} getZeroCoordinates()
Returns the coordinates of the point zero of the line. If the line is an Axis, the coordinates of the projection of the board's zero point is returned Otherwise, the coordinates of the point that acts as zero are established depending on the value of JXG.Ticks#anchor
Returns:
{JXG.Coords} Coords object for the Zero point on the line

{Boolean} hasPoint(x, y)
Checks whether (x,y) is near the line.
Parameters:
{Number} x
Coordinate in x direction, screen coordinates.
{Number} y
Coordinate in y direction, screen coordinates.
Returns:
{Boolean} True if (x,y) is near the line, False otherwise.

<private> {Function} makeTicksFunction(ticks)
Ticks function: determines the distance (in user units) of two major ticks. See above in constructor and in @see JXG.GeometryElement#setAttribute
Parameters:
{Number} ticks
Distance between two major ticks
Returns:
{Function} returns method ticksFunction

<private> processTickPosition(coordsZero, tickPosition, ticksDelta, deltas)
Auxiliary method used by JXG.Ticks#generateEquidistantTicks to create a tick in the line at the given tickPosition.
Parameters:
{JXG.Coords} coordsZero
coordinates of the point considered zero
{Number} tickPosition
current tick position relative to zero
{Number} ticksDelta
distance between two major ticks in user coordinates
{Object} deltas
x and y distance between two major ticks

<private> removeTickLabels()
Removes the HTML divs of the tick labels before repositioning

{JXG.Ticks} setPositionDirectly(method, coords, oldcoords)
Sets x and y coordinate of the tick.
Parameters:
{number} method
The type of coordinates used here. Possible values are JXG.COORDS_BY_USER and JXG.COORDS_BY_SCREEN.
{Array} coords
coordinates in screen/user units
{Array} oldcoords
previous coordinates in screen/user units
Returns:
{JXG.Ticks} this element

<private> setTicksSizeVariables()
Sets the variables used to set the height and slope of each tick.

<private> {Array} tickEndings(coords, major)
Parameters:
{JXG.Coords} coords
Coordinates of the tick on the line.
{Boolean} major
True if tick is major tick.
Returns:
{Array} Array of length 3 containing start and end coordinates in screen coordinates of the tick (arrays of length 2). 3rd entry is true if major tick otherwise false. If the tick is outside of the canvas, the return array is empty.

{JXG.Ticks} update()
Recalculate the tick positions and the labels.
Returns:
{JXG.Ticks}

{JXG.Ticks} updateRenderer()
Uses the boards renderer to update the arc.
Returns:
{JXG.Ticks}

Documentation generated by JsDoc Toolkit 2.4.0 on Tue Jul 05 2016 11:01:14 GMT+0200 (CEST)