(class)
An abstract class representing an axis within a LayeredChart.
Description
ChartAxis objects define the manner in which the plot area of a
LayeredChart is measured. They provide a two-way mapping from data to spatial coordinates. This mapping is implemented in
ChartAxis.get-position and
ChartAxis.get-value, although you will be more likely to use
ChartDataMapping and
ChartInverseDataMapping through
ChartLayer.get-data-mapping and
ChartLayer.get-inverse-data-mapping, respectively. These objects essentially wrap axis matching logic and calls to
ChartAxis.get-position and
ChartAxis.get-value.
ChartAxis is designed to be user-subclassable, but there are usually easier ways to customize the behavior of an axis. The following options are supported for
ChartAxis, or for some subset of the
ChartAxis classes:
The supplied implementations of
ChartAxis are:
You can use the default
ChartAxis factory to create an axis of the appropriate type for one or more
ChartDataSeries. See
ChartAxis.default#factory for more details.
Some of the functionality pertaining to label generation and spacing are delegated to
ChartAxis.label-group; see
ChartLabelGroup for information on how to affect label generation and positioning.
Notes
LayeredChart will attempt to automatically create appropriate X and Y axis for its contents, based on
ChartLayer.x-axis-data and
ChartLayer.y-axis-data. However, in some circumstances, you may wish to create your own axis object directly. See
LayeredChart for more information about the automatic axis generation process.
The
Shape hierarchy of a
ChartAxis is as follows:
| default: | Initialize a new ChartAxis class. |
| constructor
protected
| {ChartAxis.default label-group:ChartLabelGroup = {ChartLabelGroup}, axis-group:Shape = {ShapeGroup}, axis-line-group:Shape = {ShapeGroup}, major-tick-group:Shape = {ShapeGroup}, minor-tick-group:Shape = {ShapeGroup}, ... } |
field public constant ChartAxis.axis-group:
Shape
| axis-label: | The label or label factory for this ChartAxis. |
nonlocal option public ChartAxis.axis-label:
any
field public constant ChartAxis.axis-line-group:
Shape
| length: | The length of this axis. |
field public-get private-set ChartAxis.length:
Distance
nonlocal option public ChartAxis.major-tick-factory:#
TickFactory
field public constant ChartAxis.major-tick-group:
Shape
nonlocal option public ChartAxis.minor-tick-factory:#
TickFactory
field public constant ChartAxis.minor-tick-group:
Shape
field public-get private-set ChartAxis.position:
AxisPosition =AxisPosition.none
accessor public ChartAxis.style-element:
String
| tick-label-factory: | A factory procedure for the generation of tick labels within this ChartAxis. |
accessor public final ChartAxis.x-axis?:
bool
accessor public final ChartAxis.y-axis?:
bool Properties inherited from Shape:
as-Shape, border-color, color, draw-operation, option-parent, selection-context, shape-parent, shape-selectable, stroke-thickness, transformation, visible? Properties inherited from Visual:
_style-element, clonable-class?, completely-clonable-children?, cursor, data-source, display-context, dragee, font-size, input-method-enabled?, input-method-keyboard-mode, name, options, options-present-here, style-class, style-manager, style-options, test-description, test-name, test-parent?, test-type-name, test-visible?, tooltip, user-data
|
public
| {ChartAxis.clear-shapes}:void |
| detach: | Detach this shape from its parent. |
|
public
| {ChartAxis.detach}:void |
|
public abstract
| {ChartAxis.generate-axis-label}:#Shape |
|
protected
| {ChartAxis.generate-axis-line}:void |
|
public
| {ChartAxis.generate-major-tick value:any, tick-index:int, position:Distance = {self.get-position value} }:Shape |
|
protected abstract
| {ChartAxis.generate-major-ticks}:void |
|
public
| {ChartAxis.generate-minor-tick value:any, tick-index:int, position:Distance = {self.get-position value} }:Shape |
|
protected abstract
| {ChartAxis.generate-minor-ticks}:void |
|
public final
| {ChartAxis.get-axis-label}:#Shape |
|
public
| {ChartAxis.get-major-ticks-Iterator}:{Iterator-of ChartTick} |
|
public
| {ChartAxis.get-minor-ticks-Iterator}:{Iterator-of ChartTick} |
| get-position: | Calculate the spatial position corresponding to a data value. |
|
public abstract
| {ChartAxis.get-position-at-zero}:Distance |
|
public abstract
| {ChartAxis.get-relative-position value:any}:Fraction |
|
public
| {ChartAxis.get-tick-label-alignment rotation:Angle }:(halign:String, valign:String) |
| get-value: | Calculate the data value that corresponds with a position along this axis. |
| get-value-relative: | Calculate the data value that corresponds with a position along this axis. |
|
public abstract
| {ChartAxis.get-value-relative position:Fraction}:any |
|
public
| {ChartAxis.note-min-max-computation-changed}:void |
|
public
| {ChartAxis.regenerate-shapes}:void |
| update-layout: | Perform all required layout operations for the axis. |
Methods inherited from Shape:
apply-rotation, apply-scale, apply-transformation, apply-translation, apply-translation-in-parent, constrain-own-layout-bounds, constrain-shape-layout-bounds, contains-point?, find-graphical-ancestor, fire-crossing-event, fire-in-child, get-display-context, get-down-orientation-in-shape-parent, get-graphical-root, get-local-device-pixel-size, get-origin-in-graphical-ancestor, get-origin-in-root, get-origin-in-shape-parent, get-origin-in-shape-root, get-own-layout-bounds, get-right-orientation-in-shape-parent, get-shape-bounds, get-shape-bounds-in-shape-root, get-shape-layout-bounds, get-top-left-in-ancestor, get-transformation-to-shape-root, keyword-init-arg, option-change-notify, overdraw-for-selection, quantize-line-thickness, request-draw, request-draw-self, reset-transformation, set-rotation, set-scale, set-transformation, set-translation-in-parent, to-Graphic, transform-from-display-coordinates, transform-from-graphical-root-coordinates, transform-point-from-shape-root, transform-point-to-shape-root, transform-to-display-coordinates, transform-to-graphical-root-coordinates, transform-vector-from-shape-root, transform-vector-to-shape-root, transformation-changed, transformation-changing Methods inherited from ShapeContainerBase:
add, clear, draw-shape-child, draw-shape-children, get-all-children-at-point, get-child-at-point, get-leaf-at-point, get-shape-root, note-attached, note-detaching, notify-option-children, on-drag-enter, on-pointer-enter, on-pointer-envelope-event, register-options, remove, set-shape-index, set-shape-index-after, set-shape-index-before, shape-container-fire-inferior-crossing-event, shape-container-handle-crossing, shape-container-pick-child, shape-container-pointer-enter-occurred, shape-container-pointer-leave-occurred Methods inherited from Visual:
add-from-init-args, add-option, add-style-option, animate, change-cursor, clonable-appearance?, clone-appearance, clone-appearance-helper, find-test-children, get-focus-manager, get-layout-context, get-test-parent, get-test-property, get-text, get-view, maybe-fire-attach-event, maybe-fire-detach-event, non-keyword-init-arg, note-caret-position, on-drag-leave, on-pointer-leave, pop-cursor, prepare-test-object, prepare-test-parent, push-cursor, quantize-width, release-key-focus, remove-option, remove-style-option, request-key-focus, scroll-to-include, test-record, test-run, xy-offset-to Methods inherited from GuiEventTarget:
handle-event, on-action, on-cancel-mode, on-command-changed, on-commit, on-composition-change-event, on-composition-result-event, on-context-menu-event, on-current-record-change-request, on-current-record-changed, on-destroy-notify, on-destroy-requested, on-drag-over, on-drag-pointer, on-drag-started, on-drop, on-end-composition-event, on-focus-event, on-focus-in, on-focus-out, on-grab-release, on-gui-event, on-input-method-event, on-inspection, on-key-event, on-key-press, on-pointer-button, on-pointer-crossing, on-pointer-event, on-pointer-motion, on-pointer-press, on-pointer-release, on-pointer-scroll, on-raw-key-event, on-raw-key-press, on-raw-key-release, on-reset, on-selectable-added, on-selectable-removed, on-selection-changed, on-selection-context-activated, on-selection-context-deactivated, on-selection-event, on-start-composition-event, on-start-event, on-stop-event, on-view-activate, on-view-deactivate, on-window-close, remove-event-handlers-for-event-class Methods inherited from OptionListInterface:
change-option-parent-notify, clone-options, get-option, get-option-by-name, local-add-notify, local-remove-notify, name-to-option-key, new-option-item, option-changed, option-lookup, option-lookup-here, option-propagate-notify, option-set?, propagate-option-change, remove-styles, set-option-by-name, set-style-option-by-name, unset-option-by-name, unset-style-option-by-name
(constructor)
| protected
| {ChartAxis.default label-group:ChartLabelGroup = {ChartLabelGroup}, axis-group:Shape = {ShapeGroup}, axis-line-group:Shape = {ShapeGroup}, major-tick-group:Shape = {ShapeGroup}, minor-tick-group:Shape = {ShapeGroup}, ... } |
Initialize a new ChartAxis class.
...: Any of the arguments that
Shape accepts. These are primarily keyword arguments representing option initializations.
Description
Since
ChartAxis is abstract, only subclasses need to call this constructor. If you wish to create a
ChartAxis subclass automatically based on data, see
ChartAxis.default#factory.
(factory)
Create a ChartAxis based on one or more ChartDataSeries.
data: The first ChartDataSeries to be added to the ChartAxis created.
...: The rest arguments may consist of additional
ChartDataSeries to be added to the axis and initialization parameters for the
ChartAxis created; see
ChartAxis.default.
Returns
, A ChartAxis appropriate for the data provided.
Description
This factory examines the type of data present in
data and constructs the a subclass of
ChartAxis appropriate for that data type. The types that may be created are:
Example
(field)
public constant ChartAxis.axis-group:
Shape The Shape parent of the axis and tick Shapes.
Description
This object exists strictly for convenience; you can use it to set options that will affect all of its children, for instance. See
ChartAxis for an explanation of the
ChartAxis Shape hierarchy.
Example
The following example combines several interesting techniques. It creates axes using the default
ChartAxis factory, providing its own
ShapeGroup objects for
ChartAxis.axis-group. It then creates a
LineLayer. The example places event handlers on
LineLayer.series-shapes that change the color of the axis groups created earlier; it uses the
ChartLayoutChanged event to receive notification of when the contents of
LineLayer.series-shapes have changed.
The net effect is that, when you move the pointer over one of the plotted shapes, the Y axis for that plot is highlighted in red.
| Example:
Using ChartAxis.axis-group to change the axis and tick color |
 |
{import * from CURL.GUI.CHARTS}
{import * from CHARTS-DOC,
location = "../docstring-support/gui/charts-doc.scurl"
}
{let left-group:ShapeGroup =
{ShapeGroup
color = FillPattern.black
}
}
{let right-group:ShapeGroup =
{ShapeGroup
color = FillPattern.black
}
}
{LayeredChart
width = 15cm,
height = 7cm,
left-axis =
{ChartAxis
{ChartDataSeries sample-records, "Age"},
axis-group = left-group
},
right-axis =
{ChartAxis
{ChartDataSeries sample-records, "Wins"},
axis-group = right-group
},
{LineLayer
sample-records,
"Age",
"Wins",
x-axis-data =
{ChartDataSeries sample-records, "Name"},
stroke-thickness = 2pt,
{on ChartLayoutChanged at layer:LineLayer do
|| Assume that there are two data
|| series, and that they correspond
|| to the left and right axes,
|| respectively.
{layer.series-shapes[0].add-event-handler
{on PointerEnter do
set left-group.color = FillPattern.red
}
}
{layer.series-shapes[0].add-event-handler
{on PointerLeave do
set left-group.color = FillPattern.black
}
}
{layer.series-shapes[1].add-event-handler
{on PointerEnter do
set right-group.color = FillPattern.red
}
}
{layer.series-shapes[1].add-event-handler
{on PointerLeave do
set right-group.color = FillPattern.black
}
}
}
}
}
| |
(nonlocal option)
public ChartAxis.axis-label:
any The label or label factory for this ChartAxis.
Description
(field)
public constant ChartAxis.axis-line-group:
Shape The Shape parent of the axis line Shape.
Description
This object exists strictly for convenience; you can use it to set options that will affect all of its children, for instance. See
ChartAxis for an explanation of the
ChartAxis Shape hierarchy.
Notes
(field)
The LayeredChart, if any, that contains this ChartAxis.
Description
This property is set as soon as the ChartAxis is added to the LayeredChart.
(field)
The ChartLabelGroup responsible for containing and positioning the labels associated with this axis.
Description
This object is the
Shape parent for all tick labels and the axis label associated with this
ChartAxis. It is responsible for performing the actual calls required to generate labels (
ChartAxis.get-tick-label and
ChartAxis.get-axis-label) and for placing the results at the correct position and orientation.
(field)
public-get private-set ChartAxis.length:
Distance The length of this axis.
Description
This value is always positive, even though increasing data values generally correspond with decreasing positions for vertical axes.
Notes
(nonlocal option)
A factory procedure for the generation of ticks within this ChartAxis.
Description
(field)
public constant ChartAxis.major-tick-group:
Shape The Shape parent of the major tick Shapes for this axis.
Description
This object exists strictly for convenience; you can use it to set options that will affect all of its children, for instance. See
ChartAxis for an explanation of the
ChartAxis Shape hierarchy.
Notes
See
ChartAxis.axis-group for an example of using a similar object. If that example had used this object instead of
axis-group, then only the ticks would have changed colors.
(nonlocal option)
A factory procedure for the generation of ticks within this ChartAxis.
Description
(field)
public constant ChartAxis.minor-tick-group:
Shape The Shape parent of the minor tick Shapes for this axis.
Description
This object exists strictly for convenience; you can use it to set options that will affect all of its children, for instance. See
ChartAxis for an explanation of the
ChartAxis Shape hierarchy.
Notes
(field)
public-get private-set ChartAxis.position:
AxisPosition =AxisPosition.none
(accessor)
accessor public ChartAxis.style-element:
String The "element" or "type" of this Visual, for the purpose of styling.
Description
This implementation returns the value of
Visual._style-element but is normally overridden to return a constant value.
Overriding
If a subclass of
Visual should be stylable separately from other types of objects, this getter should be overridden to return an appropriate string. By convention, this string is the name of the class or the name of the markup that produces the object.
An override must return
self._style-element if it is not the empty string.
Introduced in:
version 6.0
(nonlocal option)
A factory procedure for the generation of tick labels within this ChartAxis.
Description
(accessor)
accessor public final ChartAxis.x-axis?:
bool true if this axis is currently in use as an X axis within a LayeredChart.
(accessor)
accessor public final ChartAxis.y-axis?:
bool true if this axis is currently in use as an Y axis within a LayeredChart.
(method)
| public
| {ChartAxis.clear-shapes}:void |
Clear the Shape contents of this axis.
Description
This does not remove the
Shape children of the axis. Instead, it clears the following objects of their
Shape children:
Notes
This method is only intended to be called from within
ChartAxis itself. Specifically,
ChartAxis.regenerate-shapes calls this method.
While you should never need to call this method, it may be useful to override it in a subclass to receive notification of when the clearing occurs.
(method)
| public
| {ChartAxis.detach}:void |
Detach this shape from its parent.
Description
This is semantically equivalent to calling
ShapeContainerBase.remove on this shape's parent.
Calling
detach on a shape with no parent has no effect.
(method)
| public abstract
| {ChartAxis.generate-axis-label}:#Shape |
Generate an axis label appropriate for this ChartAxis.
Returns
A
Shape representing the label, or
null if no label should be displayed.
Description
ChartAxis subclasses must define this method. You may also wish to override this method if you are subclassing an existing
ChartAxis class. See
ChartAxis.get-axis-label for a more complete discussion of controlling the appearance of the axis label.
The
Shape created need not be rotated or positioned, as
ChartLabelGroup will set its position and rotation directly as appropriate to the axis' position. If you wish to specify an offset with respect to that position, you can apply the desired transformation to the label shape and then embed it within a
ShapeGroup. The
ShapeGroup will be the object that is positioned by
ChartLabelGroup, and the child
Shape you embedded will be brought along with it. See
axis-label for an example that demonstrates this using scaling.
You must take care that the object generated is positioned well with respect to its origin. The origin will be placed in alignment with the center of the axis, close to the axis itself, and the rotation of the object will be 0 degrees or -90 degrees for the horizontal and vertical axes, respectively. For these reasons, you will need to position the shape you generate carefully to ensure it is where you want it to be (rather than, for instance, overlapping the axis and ticks).
See
axis-label for a discussion of how to ensure this using options like
halign or
horigin on objects like
TextShape.
Notes
(method)
| protected
| {ChartAxis.generate-axis-line}:void |
Generate the Shape or Shapes required to represent the axis line for this axis.
Description
You can override this method in
ChartAxis subclasses to modify the manner in which the axis line is generated. By default, this method generates a
AxisLineShape.
Generated objects should be added to
ChartAxis.axis-line-group. The origin of these objects will coincide with the origin of the axis itself.
(method)
| public
| {ChartAxis.generate-major-tick value:any, tick-index:int, position:Distance = {self.get-position value} }:Shape |
Generate a Shape representing a major tick.
tick-index: The zero-based index of this tick. This can be useful for features such as changing the color of alternating ticks.
position: The position along the axis at which the tick is to be placed. By default,
ChartAxis.get-position is called using
value to get the correct position. You only need pass a value using
position if you have already calculated it; this is an optimization only.
Returns
A Shape representing the tick.
Description
Notes
Unless you are subclassing
ChartAxis, setting
major-tick-factory is the recommended technique for controlling the appearance of major ticks.
(method)
| protected abstract
| {ChartAxis.generate-major-ticks}:void |
Generate all Shapes required to represent the major ticks along this axis.
Description
This is the method in which
ChartAxis implementations actually do the work of figuring out how many ticks to generate, where to place them, and actually doing so. This method is intended to be called from
ChartAxis.update-layout.
If you are implementing this method, you may find it useful to use
ChartAxis.generate-major-tick to create a standard tick shape. Generated
Shapes should be added to
ChartAxis.major-tick-group.
(method)
| public
| {ChartAxis.generate-minor-tick value:any, tick-index:int, position:Distance = {self.get-position value} }:Shape |
Generate a Shape representing a minor tick.
tick-index: The zero-based index of this tick. This can be useful for features such as changing the color of alternating ticks.
position: The position along the axis at which the tick is to be placed. By default,
ChartAxis.get-position is called using
value to get the correct position. You only need pass a value using
position if you have already calculated it; this is an optimization only.
Returns
A Shape representing the tick.
Description
Notes
Unless you are subclassing
ChartAxis, setting
minor-tick-factory is the recommended technique for controlling the appearance of major ticks.
Minor ticks are not created by default; to create them, you must create your own subclass of
ChartAxis or one of its implementations, and override
ChartAxis.generate-minor-ticks.
(method)
| protected abstract
| {ChartAxis.generate-minor-ticks}:void |
Generate all Shapes required to represent the minor ticks along this axis.
Description
(method)
Generate a tick label for the given tick.
tick: The
ChartTick for which the label is to be created.
Returns
A Shape representing the label, or null if no tick label should be displayed for this value.
Description
You may wish to override this method if you are subclassing an existing
ChartAxis class. See
ChartAxis.get-tick-label for a more complete discussion of controlling the appearance of the tick labels.
The
Shape created need not be positioned, as
ChartLabelGroup will set its position directly as appropriate to the axis' position. (Rotation and scale will not be affected.) If you wish to specify an offset with respect to that position, you can apply the desired transformation to the label shape and then embed it within a
ShapeGroup. The
ShapeGroup will be the object that is positioned by
ChartLabelGroup, and the child
Shape you embedded will be brought along with it. See
axis-label for an example that demonstrates a similar technique using scaling for an axis label.
You must take care that the object generated is positioned well with respect to its origin. The origin will be placed such that it is positioned at the tick, offset by
axis-label-group-spacing in the direction the tick points. You will need to position the shape you generate carefully to ensure it is where you want it to be (rather than, for instance, overlapping the axis and ticks).
See
tick-label-factory for a discussion of how to ensure this using options like
halign or
horigin on objects like
TextShape.
Notes
(method)
| public final
| {ChartAxis.get-axis-label}:#Shape |
Create a Shape appropriate for use as the label for this axis.
Returns
A Shape, or null if no axis label should be displayed.
Description
This method converts the
axis-label option into a
Shape, as required. By default,
axis-label is a procedure that calls
ChartAxis.generate-axis-label.
This structure is in place so that
ChartAxis implementations can override label generation in a way that makes sense for the axis without overriding a user-specified
axis-label option.
If you want to override label generation and you are subclassing
ChartAxis, then you should override
ChartAxis.generate-axis-label. Otherwise, you should set
axis-label.
Example
See
axis-label for a demonstration of using that option to control the axis label.
(method)
Describes the way in which a ChartAxis is defined.
Returns
An
AxisDataType describing the data or metric associated with this axis and a value describing that metric.
Description
This method is used by the
LayeredChart system that matches axes with data. For instance, if this axis is directly associated with a
ChartDataSeries, then it is appropriate to associate it with plots of that data series. So, this method would return
AxisDataType.data-series, along with the data series used within the axis.
The table below explains the type of value expected to be returned for each possible
AxisDataType.
| AxisDataType | Type of value | Description |
| AxisDataType.data-series | {Array-of ChartDataSeries} | This axis is directly associated with one or more ChartDataSeries, and those series are contained in the array returned. All data series must share the same Domain object. (This is the most commonly used type of axis by far.) |
| AxisDataType.record-field | {Array-of RecordField} | This axis is directly associated with one or more RecordFields. All fields must share the same Domain. Data will be matched to the axis if it uses the same field. The RecordFields used are returned in an array. |
| AxisDataType.field-name | {Array-of String} | In a manner very similar to AxisDataType.record-field, this axis is associated with one or more record fields by name. Data will be matched to this axis if it uses a field of the same name. The field names used are returned in an array. |
| AxisDataType.type | Type | The axis defines itself only as measuring a certain Type. NumericAxis-of is an example of this axis type. Failing a better match, any data that uses the same type will be matched to this axis. |
| AxisDataType.record-index | none (null) | This axis simply puts one Record after another, with no regard to the data. This axis type is only useful for X axes. It will match any data, but is the lowest priority kind of match. DefaultChartAxis and DefaultBarChartAxis are examples of this kind of axis. |
(method)
| public
| {ChartAxis.get-major-ticks-Iterator}:{Iterator-of ChartTick} |
Returns an Iterator-of useful for iterating through the ticks in this axis.
Returns
Description
This method is used internally for generating tick labels and grid lines. It could be useful in applications for similar tasks; for instance, an applet could present some user interface element that corresponded to each tick, such as an option to highlight values at that tick.
Notes
The returned iterator only returns generated ticks that also subclass
ChartTick. This will only matter if you change the ticks generated by subclassing
ChartAxis.generate-major-ticks or setting
major-tick-factory. Otherwise, all ticks will always be
ChartTicks.
If you do create your own tick objects, and they do not subclass from
ChartTick, then they will be absent here. As a result, no tick label or grid line will be generated for that tick. See
major-tick-factory for an example of ow to create your own
ChartTick subclass.
(method)
| public
| {ChartAxis.get-minor-ticks-Iterator}:{Iterator-of ChartTick} |
Returns an Iterator-of useful for iterating through the ticks in this axis.
Returns
Description
Notes
(method)
Calculate the spatial position corresponding to a data value.
value: A value whose expected type varies depending on the axis type. Passing an incompatible type will result in an error.
Returns
A
Distance, measured from the origin of the
ChartAxis along its length. Note that this will return decreasing (and, thus, negative) values for vertical axes, as the axis extends up -- that is, in the negative Y direction.
Description
Usually, it is easier to use a
ChartDataMapping obtained via
ChartLayer.get-data-mapping for this purpose. However, if you wish to look up an arbitrary value, rather than a particular
Record corresp, this method can be useful.
The expected
Type of
value varies based on the axis implementation. This can be broken down based on
AxisDataType, as obtained by
ChartAxis.get-data-type:
| AxisDataType | Expected type of value |
| AxisDataType.data-series | The Type of the data provided, i.e., ChartDataSeries.field.domain.type. |
| AxisDataType.record-field | {Array-of RecordField} | The Type of the field, i.e., RecordField.domain.type. |
| AxisDataType.field-name | {Array-of String} | Defined by the specific axis implementation. |
| AxisDataType.type | Type | The same Type returned by ChartAxis.get-data-type. |
| AxisDataType.record-index | none (null) | An int representing a zero-based record index. |
(method)
| public abstract
| {ChartAxis.get-position-at-zero}:Distance |
Get the spatial position along this axis corresponding with zero.
Description
This returns a value along this axis' length with the same behavior as
ChartAxis.get-position; see that method for details.
Notes
The concept of zero may not make sense for all axes. In particular,
GenericDataSeriesAxis and
EnumeratedBarChartAxis are ordinal axes, not continuous value-based axes, and so the concept of zero does not apply. Such axes always return
0m.
(method)
| public abstract
| {ChartAxis.get-relative-position value:any}:Fraction |
Calculate the spatial position corresponding to a data value.
value: A value whose expected type varies depending on the axis type. See
ChartAxis.get-position. Passing an incompatible type will result in an error.
Returns
A
Fraction indicating the position of the data value along the axis, ranging from
0 at the origin of the axis to
1 at the end of the axis.
Description
This is essentially the same as
ChartAxis.get-position without any notion of the direction or length of the axis. In fact, that method is implemented in terms of this one. See
ChartAxis.get-position for more information.
(method)
Create a Shape appropriate for use as the label for a tick.
tick: The
ChartTick for which the label is to be created.
Returns
A Shape representing the label, or null if no tick label should be displayed for this value.
Description
This method calls the procedure stored in the
tick-label-factory option and converts the result into a
Shape, as required. By default,
tick-label-factory is a procedure that calls
ChartAxis.generate-tick-label.
This structure is in place so that
ChartAxis implementations can override label generation in a way that makes sense for the axis without overriding a user-specified
tick-label-factory option.
If you want to override label generation and you are subclassing
ChartAxis, then you should override
ChartAxis.generate-tick-label. Otherwise, you should set
tick-label-factory.
Example
See
tick-label-factory for a demonstration of using that option to control the tick label.
(method)
| public
| {ChartAxis.get-tick-label-alignment rotation:Angle }:(halign:String, valign:String) |
Retrieve the default alignment for tick labels.
Returns
Two
Strings describing, respectively, horizontal and vertical alignments recommended for this axis' tick labels.
Description
This method returns alignment values suitable for objects like
TextShape or
Frame. These values are based on
ChartAxis.position and
rotation.
This method is primarily for internal use, although you may find it useful in implementing tick label factories. See
tick-label-factory for details on how to do so.
(method)
Calculate the data value that corresponds with a position along this axis.
position: The position along this axis. This should be between
0m and
ChartAxis.length (or
-ChartAxis.length, if this axis is vertical).
Returns
A value of the appropriate type for this axis. See
ChartAxis.get-position for a discussion of the appropriate
Types of values for different axes.
Description
(method)
| public abstract
| {ChartAxis.get-value-relative position:Fraction}:any |
Calculate the data value that corresponds with a position along this axis.
position: The position along this axis as a fraction. This should be between 0 and 1, inclusive.
Returns
A value of the appropriate type for this axis. See
ChartAxis.get-position for a discussion of the appropriate
Types of values for different axes.
Description
This is essentially the same as
ChartAxis.get-value without any notion of the direction or length of the axis. In fact, that method is implemented in terms of this one. See
ChartAxis.get-value for more information.
(method)
| public
| {ChartAxis.note-min-max-computation-changed}:void |
Notifies this ChartAxis of a change in some factor affecting the values returned by LayeredChart.compute-data-min-max.
Description
Typically, implementations that rely on
LayeredChart.compute-data-min-max will want to recompute their minimum and maximum and ensure that their layout has been invalidated.
DataSeriesAxis and all of its subclasses do this automatically. You should never need to call this method directly; it is called from
LayeredChart.note-min-max-computation-changed.
Please note that this method will
not be called when the data itself changes; for that, you should use
Observer.observe on the
ChartDataSeries.
Introduced in:
version 6.0
(method)
| public
| {ChartAxis.regenerate-shapes}:void |
Create all Shape objects required to represent this axis.
Description
Notes
This method is only ever expected to be called by
ChartAxis.update-layout. However, it may be useful to override in a subclass if you wish to receive notification of when this occurs.
(method)
Transforms a point from the LayeredChart's coordinate system into that of this ChartAxis.
Returns
point, in local coordinates.
Description
Notes
This method can be useful for converting a position from chart coordinates for the purpose of calling
ChartAxis.get-value.
(method)
Transforms a point from this ChartAxis' local coordinate system to that of the containing LayeredChart.
Returns
point, in LayeredChart coordinates.
Description
Notes
This method can be useful when you want to add or move objects at the chart level based on, for instance, the results of
ChartAxis.get-position.
(method)
Perform all required layout operations for the axis.
Description
ChartAxis.update-layout regenerates all generated
Shapes associated with this axis. To do this, it calls
ChartAxis.clear-shapes and
ChartAxis.regenerate-shapes.
This method is called by
LayeredChart.update-layout during the chart layout process. It should never be necessary for you to call it directly; however, it may be useful to override this method in subclasses to perform operations immediately before or after the axis performs layout.