Attributes
Own
none
Inherited
Members
Own
(private) board : JXG.Board
- Description
The board the ticks line is drawn on.
- Type
- JXG.Board
- Overrides
- JXG.GeometryElement#board
- Source
- base/ticks.js, line 76
(private) equidistant : Boolean
- Description
Flag if the ticks are equidistant. If true, their distance is defined by ticksFunction.
- Type
- Boolean
- Source
- base/ticks.js, line 96
(private) fixedTicks : Array
- Description
Array of fixed ticks.
- Type
- Array
- Source
- base/ticks.js, line 89
(private) labelCounter : number
- Description
Used to ensure the uniqueness of label ids this counter is used.
- Type
- number
- Source
- base/ticks.js, line 153
(private) labels : Array
- Description
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.- Type
- Array
- Source
- base/ticks.js, line 146
(private) labelsData : Array
- Description
A list of labels which have to be displayed in updateRenderer.
- Type
- Array
- Source
- base/ticks.js, line 103
(private) line : JXG.Line
- Description
The line the ticks belong to.
- Type
- JXG.Line
- Source
- base/ticks.js, line 69
(private) ticks : Array
- Description
Stores the ticks coordinates
- Type
- Array
- Source
- base/ticks.js, line 131
Inherited
Methods
Own
_isInsideCanvas(x, y, mopt) → {Boolean}
Check if (parts of) the tick is inside the canvas. The tick intersects the boundary at two positions: [x[0], y[0]] and [x[1], y[1]] in screen coordinates.
Parameters
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
x |
Array | Array of length two |
||
y |
Array | Array of length two |
||
m |
Number |
<optional> |
0
|
Optional margin |
Returns
true if parts of the tick are inside of the canvas or on the boundary.
- Type
- Boolean
Details
- Source
- base/ticks.js, line 1111
beautifyScientificNotationLabel(labelText) → {String}
Formats label texts to make labels displayed in scientific notation look beautiful. For example, label 5.00e+6 will become 5•10⁶, label -1.00e-7 will become into -1•10⁻⁷
Parameters
| Name | Type | Description |
|---|---|---|
labelText |
String | The label that we want to convert |
Returns
If labelText was not in scientific notation, return labelText without modifications. Otherwise returns beautified labelText with proper superscript notation.
- Type
- String
Details
- Source
- base/ticks.js, line 1378
(private) calculateTicksCoordinates()
(Re-)calculates the ticks coordinates.
Details
- Source
- base/ticks.js, line 337
(private) createTickPath(coords, major) → {Array}
Parameters
| Name | Type | Description |
|---|---|---|
coords |
JXG.Coords | Coordinates of the tick on the line. |
major |
Boolean | True if tick is major tick. |
Returns
Array of length 3 containing path 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.
- Type
- Array
Details
- Source
- base/ticks.js, line 1132
(private) formatLabelText(value) → {String}
Format label texts. Show the desired number of digits and use utf-8 minus sign.
Parameters
| Name | Type | Description |
|---|---|---|
value |
Number | Number to be displayed |
Returns
The value converted into a string.
- Type
- String
Details
- Source
- base/ticks.js, line 1305
(private) generateEquidistantTicks(coordsZero, bounds)
Creates ticks coordinates and labels automatically. The frequency of ticks is affected by the values of JXG.Ticks#insertTicks, JXG.Ticks#minTicksDistance, and JXG.Ticks#ticksDistance
Parameters
| Name | Type | Description |
|---|---|---|
coordsZero |
JXG.Coords | coordinates of the point considered zero |
bounds |
Object | contains the lower and upper bounds for ticks placement |
Details
- Source
- base/ticks.js, line 714
(private) generateFixedTicks(coordsZero, bounds)
Creates ticks coordinates and labels based on JXG.Ticks#fixedTicks and JXG.Ticks#labels.
Parameters
| Name | Type | Description |
|---|---|---|
coordsZero |
JXG.Coords | Coordinates of the point considered zero |
bounds |
Object | contains the lower and upper bounds for ticks placement |
Details
- Source
- base/ticks.js, line 1002
(private) generateLabelData(labelText, tick, tickNumber) → {Object}
Create a tick label data, i.e. text and coordinates
Parameters
| Name | Type | Description |
|---|---|---|
labelText |
String | |
tick |
JXG.Coords | |
tickNumber |
Number |
Returns
with properties 'x', 'y', 't' (text), 'i' (tick number) or null in case of o label
- Type
- Object
Details
- Source
- base/ticks.js, line 1451
(private) generateLabelText(tick, zero, value) → {String}
Creates the label text for a given tick. A value for the text can be provided as a number or string
Parameters
| Name | Type | Description |
|---|---|---|
tick |
JXG.Coords | The Coords-object of the tick to create a label for |
zero |
JXG.Coords | The Coords-object of line's zero |
value |
Number | String | A predefined value for this tick |
Returns
- Type
- String
Details
- Source
- base/ticks.js, line 1425
(private) getDistanceFromZero(zero, point) → {Number}
Calculates the signed distance in user coordinates from zero to a given point. Sign is positive, if the direction from zero to point is the same as the direction zero to point2 of the line.
Parameters
| Name | Type | Description |
|---|---|---|
zero |
JXG.Coords | coordinates of the point considered zero |
point |
JXG.Coords | coordinates of the point to find out the distance |
Returns
distance between zero and point, including its sign
- Type
- Number
Details
- Source
- base/ticks.js, line 680
(private) getDistanceMajorTicks()
Calculates the distance between two major ticks in user units.
- If the attribute Ticks#insertTicks is false, the value of the attribute Ticks#ticksDistance is returned. The attribute Ticks#minTicksDistance is ignored in this case.
- If the attribute Ticks#insertTicks is true, the attribute Ticks#ticksDistance is ignored.
The distance between two major ticks is computed as \(a 10^i\), where \(a\) is one of \({1, 2, 5}\) and the number \(a 10^i\) is maximized such that there are approximately 6 major ticks and there are at least Ticks#minTicksDistance pixel between minor ticks. The latter restriction has priority over the number of major ticks.
Returns
Number
Details
- Source
- base/ticks.js, line 812
(private) getLowerAndUpperBounds(coordsZero) → {String|Object}
Calculate the lower and upper bounds for tick rendering. If JXG.Ticks#includeBoundaries is false, the boundaries will exclude point1 and point2.
Parameters
| Name | Type | Description |
|---|---|---|
coordsZero |
JXG.Coords |
Returns
-
[type] If type=='ticksdistance', the bounds are the intersection of the line with the bounding box of the board, respecting the value of the line attribute 'margin' and the width of arrow heads. Otherwise, it is the projection of the corners of the bounding box to the line - without the attribute 'margin' and width of arrow heads.
The first case is needed to determine which ticks are displayed, i.e. where to stop. The second case is to determine the distance between ticks in case of 'insertTicks:true'.- Type
- String
-
{lower: Number, upper: Number } containing the lower and upper bounds in user units.
- Type
- Object
Details
- Source
- base/ticks.js, line 541
(private) getXandYdeltas() → {Object}
Calculates the x and y distances in user coordinates between two units in user space. In essence, these are cosine and sine. The only work to be done is to determine the direction of the line.
Returns
- Type
- Object
Details
- Source
- base/ticks.js, line 1072
(private) getZeroCoordinates() → {JXG.Coords}
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
Coords object for the zero point on the line
- Type
- JXG.Coords
Details
- Source
- base/ticks.js, line 462
hasPoint(x, y) → {Boolean}
Checks whether (x,y) is near the line. Only available for line elements, not for ticks on curves.
Parameters
| Name | Type | Description |
|---|---|---|
x |
Number | Coordinate in x direction, screen coordinates. |
y |
Number | Coordinate in y direction, screen coordinates. |
Returns
True if (x,y) is near the line, False otherwise.
- Type
- Boolean
Details
- Overrides
- JXG.GeometryElement#hasPoint
- Source
- base/ticks.js, line 216
(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
| Name | Type | Description |
|---|---|---|
coordsZero |
JXG.Coords | coordinates of the point considered zero |
tickPosition |
Number | current tick position relative to zero |
ticksDelta |
Number | distance between two major ticks in user coordinates |
deltas |
Object | x and y distance between two major ticks |
Details
- Source
- base/ticks.js, line 937
setPositionDirectly(method, coords, oldcoords) → {JXG.Ticks}
Sets x and y coordinate of the tick.
Parameters
| Name | Type | Description |
|---|---|---|
method |
number | The type of coordinates used here. Possible values are JXG.COORDS_BY_USER and JXG.COORDS_BY_SCREEN. |
coords |
Array | coordinates in screen/user units |
oldcoords |
Array | previous coordinates in screen/user units |
Returns
this element
- Type
- JXG.Ticks
Details
- Overrides
- JXG.GeometryElement#setPositionDirectly
- Source
- base/ticks.js, line 297
(private) setTicksSizeVariables()
Sets the variables used to set the height and slope of each tick.
Details
- Source
- base/ticks.js, line 395
update() → {JXG.Ticks}
Recalculate the tick positions and the labels.
Returns
- Type
- JXG.Ticks
Details
- Overrides
- JXG.GeometryElement#update
- Source
- base/ticks.js, line 1481
updateRenderer() → {JXG.Ticks}
Uses the boards renderer to update the arc.
Returns
Reference to the object.
- Type
- JXG.Ticks
Details
- Overrides
- JXG.GeometryElement#updateRenderer
- Source
- base/ticks.js, line 1506
(private) updateRendererLabels() → {JXG.Ticks}
Updates the label elements of the major ticks.
Returns
Reference to the object.
- Type
- JXG.Ticks
Details
- Source
- base/ticks.js, line 1532
Inherited
Events
Own
none
Inherited
Parameters
| Name | Type | Description |
|---|---|---|
line |
Line | Reference to the axis the ticks are drawn on. |
ticks |
Number | Array | Number defining the distance between two major ticks or an array defining static ticks. |
attributes |
Object | Attributes |
Details
- See
- Source
- base/ticks.js, line 61