YAxisRenderer class
Draws a y axis of charts with axes: the labels along the left or right edge (inside or outside the content
rectangle), horizontal grid lines, the zero line, the axis line and horizontal limit lines. Assign a subclass
to chart.rendererLeftYAxis or chart.rendererRightYAxis to change the drawing.
- Inheritance
-
- Object
- Renderer
- AxisRenderer
- YAxisRenderer
- Implementers
Constructors
- YAxisRenderer(ViewPortHandler viewPortHandler, YAxis yAxis, Transformer? transformer)
-
Creates a renderer for
yAxis;transformerconverts axis values to pixels.
Properties
- axis → AxisBase
-
The axis this renderer draws.
finalinherited
- computeAxisPoint1 → MPPointD
-
Reused for the value at the top edge of the content rectangle, so a draw pass allocates nothing.
finalinherited
- computeAxisPoint2 → MPPointD
-
Reused for the value at the bottom edge of the content rectangle.
finalinherited
- drawZeroLinePath → Path
-
Path reused for the zero line.
final
- getTransformedPositionsBuffer ↔ Float32List
-
Buffer reused by getTransformedPositions; resized to twice the entry count of the axis.
getter/setter pair
- gridClippingRect → MutableRect
-
The content rectangle widened vertically by the grid line width, in pixels, so grid lines at the edges are
not cut in half.
no setter
- gridClippingRectBuffer → MutableRect
-
Backing rectangle of gridClippingRect.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- limitLineClippingRect → MutableRect
-
Clip rectangle for the limit line being drawn, the content rectangle widened by the line width.
final
- limitLinePaint → ChartPaint
-
Paint for the limit lines and their labels; restyled per
LimitLinewhile drawing.finalinherited - paintAxisLabels → ChartPaint
-
Paint for the axis labels; typeface, text size (dp) and color are copied from the axis on every draw.
finalinherited
- paintAxisLine → ChartPaint
-
Paint for the axis line; color and line width (dp) are copied from the axis on every draw.
finalinherited
- paintGrid → ChartPaint
-
Paint for the grid lines; color, line width (dp) and dash effect are copied from the axis on every draw.
finalinherited
- renderGridLinesPath → Path
-
Path reused for drawing grid lines.
final
- renderLimitLinesBuffer → Float32List
-
Buffer for the pixel position of the limit line being drawn.
final
- renderLimitLinesPath → Path
-
Path reused for drawing limit lines.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- transformer → Transformer?
-
Converts axis values to pixels and back; null for the radar chart axes, which are placed by the chart
instead.
finalinherited
- viewPortHandler → ViewPortHandler
-
Holds the content rectangle and the current zoom and translation of the chart, in pixels.
finalinherited
- yAxis → YAxis
-
The y axis this renderer draws.
final
- zeroLineClippingRect → MutableRect
-
Clip rectangle for the zero line, the content rectangle widened by the zero line width.
final
- zeroLinePaint → ChartPaint
-
Paint for the line at the value 0; color and width (dp) are copied from the axis when it is drawn.
final
Methods
-
computeAxis(
double min, double max, bool inverted) → void -
Computes the label values of the axis for the value range
mintomax. When the chart is zoomed in, the range is replaced by the values at the top and bottom edge of the content rectangle so that labels are only computed for what is visible.inherited -
computeAxisValues(
double min, double max) → void -
Fills the axis with evenly spaced label values between
minandmax(axis values) and stores them in itsentries,entryCount,centeredEntriesanddecimals. Honors the label count, granularity, forced label count, centered labels and minimumInterval. Leaves the axis without entries when the range is zero or infinite.inherited -
drawYLabels(
Canvas c, double fixedPosition, Float32List positions, double offset) → void -
Draws the axis labels at the horizontal pixel position
fixedPosition, plus the label x offset of the axis, rotated by the label rotation angle of the axis. Skips the first or last entry when the axis disables drawing the bottom or top label. -
drawZeroLine(
Canvas c) → void - Draws a horizontal line over the content width at the pixel position of the value 0, with the zero line color and width (dp) of the axis. Does nothing without a transformer.
-
getTransformedPositions(
) → Float32List -
Returns the pixel positions of all axis entries as x, y pairs. Only the y values are filled; the x values are
unspecified (as in Kotlin, the reused array keeps the converted x values of the previous call, which are
converted again and grow from call to call). The y values stay valid because the transformer's matrices have no
skew and
Matrix.mapPointsthen maps each axis on its own, as Android'sSkMatrixdoes; a subclass that maps through a skewed matrix must set the x values first. The array is reused between calls. -
linePath(
Path p, int i, Float32List positions) → Path -
Builds the grid line of the entry at pair index
iofpositions(pixel x, y pairs) intopand returns it. The line runs from the left chart offset to the right edge of the content rectangle. -
minimumInterval(
double range) → double -
Smallest interval in axis values the labels may use, so that neighbouring labels do not overlap.
0, the default, places no limit.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
renderAxisLabels(
Canvas c) → void -
Draws the axis labels onto
c. Does nothing when the axis or its labels are disabled.override -
renderAxisLine(
Canvas c) → void -
Draws the axis line onto
c. Does nothing when the axis or its line is disabled.override -
renderGridLines(
Canvas c) → void -
Draws one horizontal grid line per axis entry, clipped to gridClippingRect, and then the zero line when the
axis enables it.
override
-
renderLimitLines(
Canvas c) → void -
Draws each enabled limit line as a horizontal line at the pixel y of its limit value and its label at the
left or right of the content rectangle, above or below the line. A label that would stick out of the content
rectangle is moved inside it; the label of a line outside the content rectangle is not drawn.
override
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited