HorizontalAxisDecoration class
Decoration for drawing horizontal lines on the chart, decoration can add horizontal axis legend
This can be used if you don't need anything from VerticalAxisDecoration, otherwise you might consider using GridDecoration
- Inheritance
-
- Object
- DecorationPainter
- HorizontalAxisDecoration
Constructors
-
HorizontalAxisDecoration({bool showValues = false, bool endWithChart = false, bool showTopValue = false, bool showLines = true, TextAlign valuesAlign = TextAlign.end, EdgeInsets? valuesPadding = EdgeInsets.zero, Color lineColor = Colors.grey, double lineWidth = 1.0, String? horizontalAxisUnit, List<
double> ? dashArray, AxisValueFromValue axisValue = defaultAxisValue, double axisStep = 1.0, double textScale = 1.0, HorizontalLegendPosition legendPosition = HorizontalLegendPosition.end, TextStyle? legendFontStyle = const TextStyle(fontSize: 12.0), ShowLineForValue? showLineForValue, bool asFixedDecoration = false}) - Constructor for horizontal axis decoration
Properties
- asFixedDecoration → bool
-
final
- axisStep → double
-
Step for lines
final
- axisValue → AxisValueFromValue
-
Generate horizontal axis legend from value steps
final
-
dashArray
→ List<
double> ? -
Dashed array for showing lines, if this is not set the line is solid
final
- endWithChart → bool
-
This decoration can continue beyond padding set by ChartState
setting this to true will stop drawing on padding, and will end
at same place where the chart will end
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- horizontalAxisUnit → String?
-
Label that is shown at the end of the chart on horizontal axis.
This is usually to show measure unit used for axis
final
- legendFontStyle → TextStyle?
-
Text style for axis legend
final
- legendPosition → HorizontalLegendPosition
-
Horizontal legend position
Default: HorizontalLegendPosition.end
Can be HorizontalLegendPosition.start or HorizontalLegendPosition.end
final
- lineColor → Color
-
Set color to paint horizontal lines with
final
- lineWidth → double
-
Set line width
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- showLineForValue → ShowLineForValue?
-
Function to have more fine grain control over when to show horizontal lines
If this is not null showLines will be ignored
final
- showLines → bool
-
Show horizontal lines
final
- showTopValue → bool
-
Should top horizontal value be shown? This will increase padding such that
text fits above the chart and adds top most value on horizontal scale.
final
- showValues → bool
-
Show axis legend values
final
- textScale → double
-
final
- valuesAlign → TextAlign
-
Align text on the axis legend
final
- valuesPadding → EdgeInsets?
-
Padding for the values in the axis legend
final
Methods
-
animateTo(
DecorationPainter endValue, double t) → HorizontalAxisDecoration -
Animate to next decoration state, each decoration should implement this.
This is just regular lerp function, but instead of static function where you pass start and
end state, here we start with current state and animate to
endValue
.override -
applyPaintTransform(
ChartState state, Size size) → Offset -
override
-
draw(
Canvas canvas, Size size, ChartState state) → void -
Draw decoration.
Decoration can be foreground or background decoration that will be drawn on the chart
decorations can ignore padding and can use whole available canvas to draw.
override
-
getRenderer(
ChartState state) → Widget -
inherited
-
initDecoration(
ChartState state) → void -
Init decoration is first thing called on decorations, it will pass current ChartState
so decoration can easily calculate needed stuff for their layout.
override
-
isSameType(
DecorationPainter other) → bool -
Used for animating, we just need to find matching type, don't actually check for equality since we want to animate
from one state to other. Some decorations may consider overriding this in case multiples are used
inherited
-
layoutSize(
BoxConstraints constraints, ChartState state) → Size -
override
-
marginNeeded(
) → EdgeInsets -
Get extra margin (not definable by the user). This makes sure that any decoration
that leaves original drawing window is not drawing outside of that window (This is not
enforced right now but it's unwanted behaviour)
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
paddingNeeded(
) → EdgeInsets -
Get extra padding (not definable by user, calculated by decoration if needed). This makes sure
that decoration will fit with the chart in wanted area.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited