Constructor
new Axis(range, render_start, render_end, labelopt, ticksopt, styleopt, stroke_widthopt)
Creates a new Axis with the given range and label.
Name | Type | Attributes | Description |
---|---|---|---|
range | ClosedInterval | The range of the axis. | |
render_start | Point2D | The minimum coordinates of the axis when rendered. | |
render_end | Point2D | The maximum coordinates of the axis when rendered. | |
label | VectorObjectBuilder | | <optional> | The label of the axis. |
ticks | Array.<Tick> | | <optional> | The ticks of the axis. |
style | Style | | <optional> | The style of the axis. |
stroke_width | number | | <optional> | The stroke width of the axis. |
- Source
Classes
Members
label
Returns the label of the axis.
- Source
num_ticks
Returns the number of ticks on the axis.
- Source
range
Returns the range of the axis.
- Source
render_end
Returns the maximum x-coordinate of the axis when rendered.
- Source
render_start
Returns the minimum x-coordinate of the axis when rendered.
- Source
style
Returns the style of the axis.
- Source
ticks
Returns the ticks of the axis.
- Source
Methods
clone() → {Axis}
Clones the axis.
- Source
- Type:
- Axis
coord_to_point(num) → {Point2D}
Gets the coordinates of a point in the axis.
Name | Type | Description |
---|---|---|
num | number |
- Source
The coordinates of the point in the axis.
- Type:
- Point2D
point_to_coord(point) → {number}
Gets the value of a point in the axis.
Name | Type | Description |
---|---|---|
point | Point2D |
- Source
The value of the point in the axis.
- Type:
- number
tick(num) → {Tick|undefined}
Returns the tick at the given number.
Name | Type | Description |
---|---|---|
num | number | The number coo |
- Source
The tick at the given number.
- Type:
- Tick |
undefined
vector_object_builder(label_directionopt, label_offsetopt, tick_label_directionopt, tick_label_offsetopt, add_labelopt) → {VectorObjectBuilder}
Gets the VectorObjectBuilder such that when built and rendered, the axis is drawn.
Name | Type | Attributes | Description |
---|---|---|---|
label_direction | Point2D | | <optional> | The direction of the label. The default is (1, 0). |
label_offset | number | | <optional> | The offset of the label. The default is 20.0. |
tick_label_direction | Point2D | | <optional> | The direction of the tick label. The default is (0, 1). |
tick_label_offset | number | | <optional> | The offset of the tick label. The default is 10.0. |
add_label | boolean | | <optional> | Whether to add the axis label. The default is true. |
- Source
A vector object builder with the axis.
- Type:
- VectorObjectBuilder
with_tip_at_the_end(tip_shape, label_directionopt, label_offsetopt, tick_label_directionopt, tick_label_offsetopt) → {VectorObjectBuilder}
Returns the VectorObjectBuilder with the axis and tip at the end.
Name | Type | Attributes | Description |
---|---|---|---|
tip_shape | VectorObjectBuilder | The shape of the tip. The shape must be pointing to the right and centered to (0, 0), this function will rotate and move it to the correct angle. | |
label_direction | Point2D | | <optional> | The direction of the label. The default is (1, 0). |
label_offset | number | | <optional> | The offset of the label. The default is 20.0. |
tick_label_direction | Point2D | | <optional> | The direction of the tick label. The default is (0, 1). |
tick_label_offset | number | | <optional> | The offset of the tick label. The default is 10.0. |
- Source
A VectorObjectBuilder with the axis and tip at the end.
- Type:
- VectorObjectBuilder
with_tips_at_both_ends(tip_shape, label_directionopt, label_offsetopt, tick_label_directionopt, tick_label_offsetopt) → {VectorObjectBuilder}
Returns the VectorObjectBuilder with the axis and tips at both ends.
Name | Type | Attributes | Description |
---|---|---|---|
tip_shape | VectorObjectBuilder | The shape of the tip. The shape must be pointing to the right, this function will rotate and move it to the correct angle. | |
label_direction | Point2D | | <optional> | The direction of the label. The default is (1, 0). |
label_offset | number | | <optional> | The offset of the label. The default is 20.0. |
tick_label_direction | Point2D | | <optional> | The direction of the tick label. The default is (0, 1). |
tick_label_offset | number | | <optional> | The offset of the tick label. The default is 10.0. |
- Source
A VectorObjectBuilder with the axis and tips at both ends.
- Type:
- VectorObjectBuilder