XAxisRenderer class
Draws the x axis of charts with axes: the labels above or below the content rectangle, vertical grid lines,
the axis line along the top or bottom edge and vertical limit lines. Assign a subclass to
chart.rendererXAxis to change the drawing.
- Inheritance
-
- Object
- Renderer
- AxisRenderer
- XAxisRenderer
- Implementers
Constructors
- XAxisRenderer(ViewPortHandler viewPortHandler, XAxis xAxis, Transformer? transformer)
-
Creates a renderer for
xAxis;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
- gridClippingRect → MutableRect
-
The content rectangle widened horizontally 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
- renderGridLinesBuffer ↔ Float32List
-
Pixel positions of the grid lines as x, y pairs; resized to twice the entry count of the axis.
getter/setter pair
- renderGridLinesPath → Path
-
Path reused for drawing grid lines.
final
- renderLimitLinesBuffer → Float32List
-
Buffer for the pixel position of the limit line being drawn.
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
- xAxis → XAxis
-
The x axis this renderer draws.
final
Methods
-
computeAxis(
double min, double max, bool inverted) → void -
Like AxisRenderer.computeAxis, but along x: when zoomed in horizontally the range is taken from the left and
right edge of the content rectangle.
override
-
computeAxisValues(
double min, double max) → void -
Computes the label values and the label size with computeSize. The size is measured first as well, because
the interval between two labels is kept at least as wide as a label.
override
-
computeSize(
) → void - Measures the longest label of the axis with its typeface and text size and stores the plain and rotated label width and height (pixels) on the axis, which the chart uses to reserve space for the labels.
-
drawGridLine(
Canvas c, double x, double y, Path gridLinePath) → void -
Draws one vertical grid line at the pixel position
xover the content height, usinggridLinePathas a scratch path.yis not used here. -
drawLabel(
Canvas c, String formattedLabel, double x, double y, MPPointF anchor, double angleDegrees) → void -
Draws one label with paintAxisLabels at the pixel position (
x,y), rotated byangleDegreesaroundanchor(fractions of the label size). -
drawLabels(
Canvas c, double pos, MPPointF anchor) → void -
Draws all axis labels inside the visible x range at the vertical pixel position
pos. When the axis avoids first and last clipping, the outer labels are shifted inwards so they stay inside the chart. -
minimumInterval(
double range) → double -
Keeps the labels at least one label width apart, so that neighbouring labels do not overlap.
override
-
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 vertical grid line per axis entry, clipped to gridClippingRect.
override
-
renderLimitLineLabel(
Canvas c, LimitLine limitLine, Float32List position, double yOffset) → void -
Draws the label of
limitLinenext to its line, at the corner given by its label position, moved sideways where needed so it stays inside the content rectangle. Does nothing for an empty label. -
renderLimitLineLine(
Canvas c, LimitLine limitLine, Float32List position) → void -
Draws the line of
limitLineover the content height with its color, width (dp) and dash effect. -
renderLimitLines(
Canvas c) → void -
Draws each enabled limit line as a vertical line at the pixel x of its limit value and, while the line is
inside the content rectangle, its label at the top or bottom of the content rectangle.
override
-
setupGridPaint(
) → void - Copies the grid color, grid line width (dp) and dash effect of the axis into paintGrid.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited