Class JXG.Ticks
Extends
JXG.GeometryElement.
Ticks provides methods for creation and management
of ticks on an axis.
Defined in: Ticks.js.
Constructor Attributes | Constructor Name and Description |
---|---|
JXG.Ticks(line, ticks, attributes)
Creates ticks for an axis.
|
Field Attributes | Field Name and Description |
---|---|
The board the ticks line is drawn on.
|
|
Draw labels yes/no
|
|
Draw the zero tick, that lies at line.point1?
|
|
Equidistant ticks.
|
|
Array of fixed ticks.
|
|
If the distance between two ticks is too big we could insert new ticks.
|
|
User defined labels for special ticks.
|
|
The line the ticks belong to.
|
|
Total height of a major tick.
|
|
Maximum distance between two ticks, measured in pixels.
|
|
Total height of a minor tick.
|
|
The number of minor ticks between two major ticks.
|
|
Least distance between two ticks, measured in pixels.
|
|
Scale the ticks but not the tick labels.
|
|
A string that is appended to every tick, used to represent the scale
factor given in JXG.Ticks#scaleSymbol.
|
|
The default distance between two ticks.
|
|
A function calculating ticks delta depending on the ticks number.
|
- Fields borrowed from class JXG.GeometryElement:
- addEvent, ancestors, childElements, dash, descendants, draft, dump, elementClass, elType, eventHandlers, fillColor, fillOpacity, fixed, frozen, getAttribute, hasLabel, highlight, highlighted, highlightFillColor, highlightFillOpacity, highlightStrokeColor, highlightStrokeOpacity, highlightStrokeWidth, id, isDraggable, isReal, methodMap, mouseover, name, needsRegularUpdate, needsUpdate, notExistingParents, numTraces, quadraticform, removeEvent, scalable, shadow, snapToGrid, stdform, strokeColor, strokeOpacity, strokeWidth, subs, symbolic, trace, traceAttributes, traces, transformations, type, visible, visProp, withLabel
Method Attributes | Method Name and Description |
---|---|
(Re-)calculates the ticks coordinates.
|
|
hasPoint(x, y)
Checks whether (x,y) is near the line.
|
|
update()
Recalculate the tick positions and the labels.
|
|
Uses the boards renderer to update the arc.
|
- Methods borrowed from class JXG.GeometryElement:
- addChild, addRotation, addTransform, animate, bounds, clearTrace, cloneToBackground, createLabel, getAttributes, getLabelAnchor, getName, getParents, getProperty, getTextAnchor, getType, hideElement, labelColor, noHighlight, off, on, remove, resolveShortcuts, setArrow, setAttribute, setLabelText, setProperty, showElement, triggerEventHandlers
- 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}
drawLabels
Draw labels yes/no
Defined in: Options.js.
Defined in: Options.js.
- Default Value:
- false
{Boolean}
drawZero
Draw the zero tick, that lies at line.point1?
Defined in: Options.js.
Defined in: Options.js.
- Default Value:
- false
{Boolean}
equidistant
Equidistant ticks. Distance is defined by ticksFunction
{Array}
fixedTicks
Array of fixed ticks.
{Boolean}
insertTicks
If the distance between two ticks is too big we could insert new ticks. If insertTicks
is true, we'll do so, otherwise we leave the distance as is.
This option is ignored if equidistant is false.
Defined in: Options.js.
Defined in: Options.js.
- Default Value:
- false
{Array}
labels
User defined labels for special ticks. Instead of the i-th tick's position, the i-th string stored in this array
is shown. If the number of strings in this array is less than the number of special ticks, the tick's position is
shown as a fallback.
Defined in: Options.js.
Defined in: Options.js.
- Default Value:
- []
{JXG.Line}
line
The line the ticks belong to.
{Number}
majorHeight
Total height of a major tick. If negative the full height of the board is taken.
Defined in: Options.js.
Defined in: Options.js.
{int}
maxTicksDistance
Maximum distance between two ticks, measured in pixels. Is used only when insertTicks
is set to true.
- Deprecated:
- This value will be ignored.
- See:
- #insertTicks
{Number}
minorHeight
Total height of a minor tick. If negative the full height of the board is taken.
Defined in: Options.js.
Defined in: Options.js.
{Number}
minorTicks
The number of minor ticks between two major ticks.
Defined in: Options.js.
Defined in: Options.js.
{int}
minTicksDistance
Least distance between two ticks, measured in pixels.
{Number}
scale
Scale the ticks but not the tick labels.
Defined in: Options.js.
Defined in: Options.js.
- Default Value:
- 1
{String}
scaleSymbol
A string that is appended to every tick, used to represent the scale
factor given in JXG.Ticks#scaleSymbol.
Defined in: Options.js.
Defined in: Options.js.
- See:
- JXG.Ticks#scale
- Default Value:
- ''
{Boolean}
ticksDistance
The default distance between two ticks. Please be aware that this value does not have
to be used if JXG.Ticks#insertTicks is set to true.
Defined in: Options.js.
Defined in: Options.js.
- Default Value:
- 1
{Function}
ticksFunction
A function calculating ticks delta depending on the ticks number.
Method Detail
calculateTicksCoordinates()
(Re-)calculates the ticks coordinates.
{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.
update()
Recalculate the tick positions and the labels.
updateRenderer()
Uses the boards renderer to update the arc.