gui.charting.axis — Handles the charts’ axes
This module contains the Axis abstract base class and its subclasses
Abscissa, Ordinate, and SecondaryOrdinate, which
are responsible for drawing the axes of a Chart
and the associated dimension label, and for converting from values to x or
y positions and vice versa.
To access a Chart‘s axes, use its
abscissa,
ordinate, and
secondaryOrdinate properties.
A usage example can be found on the documentation page of the
gui.charting package.
The Axis Abstract Base Class
-
class gui.charting.axis.Axis
- The abstract base class for the classes in this module.
-
Axis.maxValue
- The greatest value shown on the axis. Must be at least 0.0001.
-
Axis.dimensionLabelText
- The text of the label that indicates the dimension represented on
the axis. Strings of the form 'numerator / denominator'
are displayed as a proper fraction. Pango Markup Language tags
are supported. If the value is None or '', no label will
be shown.
-
Axis.draw()
- Draws the axis on its Chart.
-
Axis.isInBounds(value)
- Indicates whether the given value falls within the range of values that
are displayed on the axis.
-
class gui.charting.axis.Abscissa(chart)
- Creates a new Axis that represents an abscissa shown on the given
Chart.
-
Abscissa.xFromValue(value)
- Returns the x position the given value can be found at.
-
Abscissa.valueFromX(position)
- Returns the value that can be found at the given x position.
-
class gui.charting.axis.Ordinate(chart)
- Creates a new Axis that represents a (primary) ordinate shown on
the given Chart.
-
Ordinate.yFromValue(value)
Returns the y position the given value can be found at.
The method accepts values outside the range shown on the axis,
in which case the return value is the value y position the
value would be shown at of the value were in the displayed
range, and values were shown at that position.
-
Ordinate.valueFromY(position)
- Returns the value that can be found at the given y position.
-
class gui.charting.axis.SecondaryOrdinate(chart)
- Creates a new Ordinate that is shown on the right side of the
given Chart, so that graphs using a
dimension other than that of the primary ordinate can be shown.
Constants
The following constants are provided:
Ticks
-
gui.charting.axis.MAJOR_TICK_LENGTH
- The length of a major tick, in pixels. This should be an odd number.
-
gui.charting.axis.MINOR_TICK_LENGTH
- The length of a minor tick, in pixels. This should be an odd number.
-
gui.charting.axis.MIN_TICK_DISTANCE
- The minimum distance between two ticks, in pixels.
Tick Labels
-
gui.charting.axis.ABSCISSA_MIN_TICK_LABEL_DISTANCE
- The minimum distance between two tick labels on abscissae, in pixels.
-
gui.charting.axis.ORDINATE_MIN_TICK_LABEL_DISTANCE
- The minimum distance between two tick labels on ordinates, in pixels.
-
gui.charting.axis.ABSCISSA_TO_LABEL_SPACING
- The distance between abscissae and their tick labels, in pixels.
-
gui.charting.axis.ORDINATE_TO_LABEL_SPACING
- The distance between the ordinates and their tick labels, in pixels.
Dimension Labels
-
gui.charting.axis.ABSCISSA_DIMENSION_LABEL_POSITION
- A tuple (xDistance, yDistance) of the distance between the end
of an abscissa and the top left corner of the dimension label, in pixels.
-
gui.charting.axis.ORDINATE_DIMENSION_LABEL_POSITION
- A tuple (xDistance, yDistance) of the distance between the end
of an ordinate and the bottom right corner of its dimension label, or the
end of a secondary ordinate and the bottom left corner of its dimension
label, in pixels.
- The distance the fraction bar of the dimension label exceeds the width
of the wider of numerator and denominator on each side, in pixels.
-
gui.charting.axis.FRACTION_BAR_SPACING
- The distance between the fraction bar of the dimension label and the
numerator and denominator, in pixels.