JSPlot Documentation: Graph axis options
- The plotting canvas
- Plotting data
- Plotting functions
- Vector graphics
- Graph plotting styles
- Graph options
- Graph axis options
- Vector graphics objects
Documentation lives here.
JSPlot_Axis class: API reference
Instances of the JSPlot_Axis class are used to configure the axes associated with a graph. You should never normally need to instantiate this class yourself, since axes are already instantiated by the JSPlot_Graph class. However, you can configure the settingsassociated with each axis by passing the appropriate settings to the JSPlot_Graph instance.
my_axis = new JSPlot_Axis(graph, axis_name, enabled, settings);
Argument | Allowed values | Description |
graph | JSPlot_Graph instance |
The graph that this axis is to be associated with. |
axis_name | String |
The name of this axis. Possibilities are x1, x2, y1, y2, z1 or z2. |
enabled | Boolean |
Boolean flag indicating whether this axis is in use. |
settings | Associative array | An associative array of configuration options. Allowed key values are listed below. |
Allowed configuration parameters within the settings array are as follows:
Field | Allowed values | Description |
arrowType | String | String indicating the kinds of arrowhead to place on the axis. Options are: none – No arrowhead (default), single – An arrow on the upper end of the axis, double – An arrow on both ends of the axis. |
atZero | Boolean | Not implemented. |
dataType | String | Indicates the type of data to be plotted along the axis – either numeric or timestamp. In the latter case, data should be supplied as (numeric) Unix timestamps, but will be rendered as dates and times. |
enabled | Boolean | Boolean indicating whether this axis is in use. |
label | String | The text label to write next to this axis. |
labelRotate | Number | A rotation to apply to the label written next to this axis (degrees). Default: 0 |
linkTo | Array of two strings | This setting is used to allow two axes – usually on different graphs, but on the same plotting canvas – to vary in lock-step. This is useful, for example, if two graphs are showing different data side-by-side, but need to have the same vertical scale. The first string in the array should be the name of the graph in the array of items in the canvas, and the second should be the name of the axis to link to within that graph. For an example, see here. |
log | Boolean | Boolean indicating whether this axis is logarithmically spaced. Default: false |
min | Number | The lower-limit for the range of this axis. If left null, the axis will automatically scale to fit the supplied data. |
max | Number | The upper-limit for the range of this axis. If left null, the axis will automatically scale to fit the supplied data. |
mirror | Boolean | Boolean indicating whether this axis should be duplicated on the opposite side of the graph. |
rangeReversed | Boolean | Boolean indicating whether this axis should have be flipped relative to its usual orientation, with higher values on the left/bottom of the axis. Default: false |
scrollEnabled | Boolean | Boolean indicating whether this axis should scroll when the user clicks and drags the graph (providing that the interactiveMode setting on the JSPlot_Graph instance is also set to pan). Default: false |
scrollMin | Number | The lower-limit for the possible range of this axis, when being scrolled by the user. If left null, the user will be able to scroll the axis indefinitely far to the left. |
scrollMax | Number | The upper-limit for the possible range of this axis, when being scrolled by the user. If left null, the user will be able to scroll the axis indefinitely far to the right. |
scrollSpan | Number | The span of this axis, from left to right, when being panned by the user. |
showLabels | Boolean | Boolean indicating whether this axis should have numerical labels placed along it. Default: true |
tickLabelRotation | Number | Specify an arbitrary rotation to apply to the tick labels written along this axis (degrees). Default: 0 |
ticksMinor | Assocative array | Configure the minor (small, unlabelled) tick markers placed along the axis. The allowed settings are listed below. |
ticks | Assocative array | Configure the major (larger, labelled) tick markers placed along the axis. The allowed settings are listed below. |
visible | Boolean | Boolean indicating whether this axis should be visible, or invisible. Default: true |
zoomEnabled | Boolean | Boolean indicating whether this axis should zoom when the user scrolls the scroll-wheel, or uses a pinch gesture on a touchscreen device. Default: true |
JSPlot_AxisTics class
The following configuration parameters can be passed in an associative array to the ticks and ticksMinor settings of JSPlot_Graph instances:
Field | Allowed values | Description |
ticDir | String | Not implemented |
tickList | Array of [Number, String] | An array of manually-placed ticks to render along this axis. Each tick is specified by an array containing the numerical position of the tick, followed by the label to place next to that tick. Set to null (default) to enabled automatic tick placement. |
tickMin | Number | The numerical value at which to place the leftmost tick along the axis. Set to null (default) to enabled automatic tick placement. |
tickMax | Number | The numerical value at which to place the rightmost tick along the axis. Set to null (default) to enabled automatic tick placement. |
tickStep | Number | The numerical spacing of the ticks along the axis. This should either be a linear spacing (linear axes) or a multiplicative spacing (logarithmic axes). Set to null (default) to enabled automatic tick placement. |