# Class: Axis
plotting.Axis
Component representing the two axes of a cartesian plot.
# Hierarchy
-
↳
Axis
# Table of contents
# Properties
- Defaults
- majorTicks
- minorTicks
- majorTickSize
- minorTickSize
- majorGridlines
- minorGridlines
- majorGridSize
- minorGridSize
- canvas
- draw
# Constructors
# Methods
- setMajorTicks
- setMinorTicks
- setMajorTickSize
- setMinorTickSize
- setMajorGridlines
- setMinorGridlines
- setMajorGridSize
- setMinorGridSize
# Properties
# Defaults
▪ Static Defaults: Object
| Name | Default value |
|---|---|
majorTicks | {x: false, y: false} |
minorTicks | {x: true, y: true} |
majorTickSize | {x: 5, y: 5} |
minorTickSize | {x: 1, y: 1} |
majorGridlines | {x: true, y: true} |
minorGridlines | {x: false, y: false} |
majorGridSize | {x: 5, y: 5} |
minorGridSize | {x: 1, y: 1} |
# Type declaration
| Name | Type |
|---|---|
majorTicks | { x: boolean = false; y: boolean = false } |
majorTicks.x | boolean |
majorTicks.y | boolean |
minorTicks | { x: boolean = true; y: boolean = true } |
minorTicks.x | boolean |
minorTicks.y | boolean |
majorTickSize | { x: number = 5; y: number = 5 } |
majorTickSize.x | number |
majorTickSize.y | number |
minorTickSize | { x: number = 1; y: number = 1 } |
minorTickSize.x | number |
minorTickSize.y | number |
majorGridlines | { x: boolean = true; y: boolean = true } |
majorGridlines.x | boolean |
majorGridlines.y | boolean |
minorGridlines | { x: boolean = false; y: boolean = false } |
minorGridlines.x | boolean |
minorGridlines.y | boolean |
majorGridSize | { x: number = 5; y: number = 5 } |
majorGridSize.x | number |
majorGridSize.y | number |
minorGridSize | { x: number = 1; y: number = 1 } |
minorGridSize.x | number |
minorGridSize.y | number |
# Defined in
plotting/Axis.ts:65 (opens new window)
# majorTicks
• majorTicks: Object = Axis.Defaults.majorTicks
Indicates whether major ticks will be displayed.
# Type declaration
| Name | Type |
|---|---|
x | boolean |
y | boolean |
# Defined in
plotting/Axis.ts:23 (opens new window)
# minorTicks
• minorTicks: Object = Axis.Defaults.minorTicks
Indicates whether minor ticks will be displayed.
# Type declaration
| Name | Type |
|---|---|
x | boolean |
y | boolean |
# Defined in
plotting/Axis.ts:27 (opens new window)
# majorTickSize
• majorTickSize: Object = Axis.Defaults.majorTickSize
Spacing between major ticks in plot units.
# Type declaration
| Name | Type |
|---|---|
x | number |
y | number |
# Defined in
plotting/Axis.ts:31 (opens new window)
# minorTickSize
• minorTickSize: Object = Axis.Defaults.minorTickSize
Spacing between minor ticks in plot units.
# Type declaration
| Name | Type |
|---|---|
x | number |
y | number |
# Defined in
plotting/Axis.ts:35 (opens new window)
# majorGridlines
• majorGridlines: Object = Axis.Defaults.majorGridlines
Indicates whether major gridlines will be displayed.
# Type declaration
| Name | Type |
|---|---|
x | boolean |
y | boolean |
# Defined in
plotting/Axis.ts:39 (opens new window)
# minorGridlines
• minorGridlines: Object = Axis.Defaults.minorGridlines
Indicates whether minor gridlines will be displayed.
# Type declaration
| Name | Type |
|---|---|
x | boolean |
y | boolean |
# Defined in
plotting/Axis.ts:43 (opens new window)
# majorGridSize
• majorGridSize: Object = Axis.Defaults.majorGridSize
Spacing between major gridlines in plot units.
# Type declaration
| Name | Type |
|---|---|
x | number |
y | number |
# Defined in
plotting/Axis.ts:47 (opens new window)
# minorGridSize
• minorGridSize: Object = Axis.Defaults.minorGridSize
Spacing between minor gridlines in plot units.
# Type declaration
| Name | Type |
|---|---|
x | number |
y | number |
# Defined in
plotting/Axis.ts:51 (opens new window)
# canvas
• canvas: ResponsiveCanvas
The canvas which the component is attached to.
# Inherited from
# Defined in
core/Component.ts:11 (opens new window)
# draw
• draw: (context: CanvasRenderingContext2D) => void
# Type declaration
▸ (context): void
Function which draws the component on the canvas.
# Parameters
| Name | Type |
|---|---|
context | CanvasRenderingContext2D |
# Returns
void
# Inherited from
# Defined in
core/Component.ts:15 (opens new window)
# Constructors
# constructor
• new Axis(canvas, options?)
# Parameters
| Name | Type | Description |
|---|---|---|
canvas | ResponsiveCanvas | The parent canvas. |
options | Partial<{ majorTicks: boolean | [boolean, boolean] ; minorTicks: boolean | [boolean, boolean] ; majorTickSize: number | [number, number] ; minorTickSize: number | [number, number] ; majorGridlines: boolean | [boolean, boolean] ; minorGridlines: boolean | [boolean, boolean] ; majorGridSize: number | [number, number] ; minorGridSize: number | [number, number] }> | Options for the axis. |
# Overrides
# Defined in
plotting/Axis.ts:80 (opens new window)
# Methods
# setMajorTicks
▸ setMajorTicks(...choices): void
Toggles the major ticks. Two values may be passed for x then y, or just a single value for both axes.
# Parameters
| Name | Type | Description |
|---|---|---|
...choices | [boolean, boolean] | [boolean] | Tick visibility. |
# Returns
void
# Defined in
plotting/Axis.ts:137 (opens new window)
# setMinorTicks
▸ setMinorTicks(...choices): void
Toggles the minor ticks. Two values may be passed for x then y, or just a single value for both axes.
# Parameters
| Name | Type | Description |
|---|---|---|
...choices | [boolean, boolean] | [boolean] | Tick visibility. |
# Returns
void
# Defined in
plotting/Axis.ts:146 (opens new window)
# setMajorTickSize
▸ setMajorTickSize(...sizes): void
Sets the spacing of the major ticks in plot units. Two values may be passed for x then y, or just a single value for both axes.
# Parameters
| Name | Type | Description |
|---|---|---|
...sizes | [number, number] | [number] | Tick spacing. |
# Returns
void
# Defined in
plotting/Axis.ts:155 (opens new window)
# setMinorTickSize
▸ setMinorTickSize(...sizes): void
Sets the spacing of the minor ticks in plot units. Two values may be passed for x then y, or just a single value for both axes.
# Parameters
| Name | Type | Description |
|---|---|---|
...sizes | [number, number] | [number] | Tick spacing. |
# Returns
void
# Defined in
plotting/Axis.ts:164 (opens new window)
# setMajorGridlines
▸ setMajorGridlines(...choices): void
Toggles the major gridlines. Two values may be passed for x then y, or just a single value for both axes.
# Parameters
| Name | Type | Description |
|---|---|---|
...choices | [boolean, boolean] | [boolean] | Gridline visibility. |
# Returns
void
# Defined in
plotting/Axis.ts:173 (opens new window)
# setMinorGridlines
▸ setMinorGridlines(...choices): void
Toggles the minor gridlines. Two values may be passed for x then y, or just a single value for both axes.
# Parameters
| Name | Type | Description |
|---|---|---|
...choices | [boolean, boolean] | [boolean] | Gridline visibility. |
# Returns
void
# Defined in
plotting/Axis.ts:182 (opens new window)
# setMajorGridSize
▸ setMajorGridSize(...sizes): void
Sets the spacing of the major gridlines in plot units. Two values may be passed for x then y, or just a single value for both axes.
# Parameters
| Name | Type | Description |
|---|---|---|
...sizes | [number, number] | [number] | Gridline spacing. |
# Returns
void
# Defined in
plotting/Axis.ts:191 (opens new window)
# setMinorGridSize
▸ setMinorGridSize(...sizes): void
Sets the spacing of the minor gridlines in plot units. Two values may be passed for x then y, or just a single value for both axes.
# Parameters
| Name | Type | Description |
|---|---|---|
...sizes | [number, number] | [number] | Gridline spacing. |
# Returns
void