Transformer class

Converts chart values to pixel positions and back for one y axis of a bar, line, scatter, candle or bubble chart.

Three matrices are applied in order: the value matrix from prepareMatrixValuePx, the touch matrix of the ViewPortHandler holding zoom and drag, and the offset matrix from prepareMatrixOffset. Functions without an output parameter change the passed array, path or rectangle in place. The charts call the prepare functions themselves; use BarLineChartBase.getTransformer to get the transformer of an axis.

Implementers

Constructors

Transformer(ViewPortHandler viewPortHandler)

Properties

hashCode → int
The hash code for this object.
no setterinherited
matrixOffset → Matrix
Matrix that moves the scaled values into the content rectangle and flips the y axis.
final
matrixValueToPx → Matrix
Matrix that scales chart values to unzoomed pixel distances.
final
offsetMatrix → Matrix
The offset matrix built by prepareMatrixOffset. Do not modify it.
no setter
pixelToValueMatrix → Matrix
The inverse of valueToPixelMatrix, mapping pixels to values. Returns a buffer that is overwritten on the next access; do not keep a reference to it.
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
valueMatrix → Matrix
The value matrix built by prepareMatrixValuePx. Do not modify it.
no setter
valueToPixelMatrix → Matrix
The combined value, touch and offset matrix that maps values to pixels. Returns a buffer that is overwritten on the next access; do not keep a reference to it.
no setter
viewPortHandler → ViewPortHandler
The viewport whose content rectangle and touch matrix this transformer maps into.
final

Methods

getPixelForValues(double x, double y) → MPPointD
Converts an x and y value to its pixel position.
getValuesByTouchPoint(double x, double y, [MPPointD? outputPoint]) → MPPointD
Converts a pixel position, for example a touch, to the x and y value at that point.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
pathValuesToPixel(List<Path> paths) → void
Converts several paths built from chart values to pixel space in place.
pathValueToPixel(Path path) → void
Converts a path built from chart values to pixel space in place.
pixelsToValue(Float32List pixels) → void
Converts pixel positions to chart values in place.
pointValuesToPixel(Float32List pts, [int? count]) → void
Converts chart values to pixel positions in place.
prepareMatrixOffset(bool inverted) → void
Builds the offset matrix from the current content offsets.
prepareMatrixValuePx(double xChartMin, double deltaX, double deltaY, double yChartMin) → void
Builds the value matrix from the visible value range and the content size.
rectToPixelPhase(MutableRect r, double phaseY) → void
Multiplies the top and bottom of r by the y animation phase, then converts it to pixel space in place. Used for vertical bars.
rectToPixelPhaseHorizontal(MutableRect r, double phaseY) → void
Multiplies the left and right of r by the y animation phase, then converts it to pixel space in place. Used for horizontal bars, where the value runs along the x axis.
rectValuesToPixel(List<MutableRect> rects) → void
Converts several rectangles in value space to pixel space in place.
rectValueToPixel(MutableRect r) → void
Converts a rectangle in value space to pixel space in place.
rectValueToPixelHorizontal(MutableRect r, [double? phaseY]) → void
Converts a rectangle in value space to pixel space in place. Same as rectValueToPixel.
toString() → String
A string representation of this object.
inherited
valueToPixelMatrix4(Float64List out) → bool
Writes the matrix that pathValueToPixel applies in one step, matrixOffset × matrixTouch × matrixValueToPx, into out as column-major 4×4 storage (the form ui.Path.transform takes) and returns true. Returns false and leaves out unchanged when one of the three matrices has skew or perspective.

Operators

operator ==(Object other) → bool
The equality operator.
inherited