Sparkline class

A widget that draws a sparkline chart.

Represents the given data in a sparkline chart that spans the available space.

By default only the sparkline is drawn, with its looks defined by the lineWidth, lineColor, and lineGradient properties.

The corners between two segments of the sparkline can be made sharper by setting sharpCorners to true.

The area above or below the sparkline can be filled with the provided fillColor or fillGradient by setting the desired fillMode.

pointsMode controls how individual points are drawn over the sparkline at the provided data point. Their appearance is determined by the pointSize and pointColor properties.

By default, the sparkline is sized to fit its container. If the sparkline is in an unbounded space, it will size itself according to the given fallbackWidth and fallbackHeight.

Inheritance

Constructors

Sparkline({Key? key, required List<double> data, double lineWidth = 2.0, Color? lineColor = Colors.lightBlue, Gradient? lineGradient, PointsMode pointsMode = PointsMode.none, double pointSize = 4.0, Color pointColor = const Color(0xFF0277BD), bool sharpCorners = false, FillMode fillMode = FillMode.none, Color? fillColor = const Color(0xFF81D4FA), Gradient? fillGradient, double fallbackHeight = 100.0, double fallbackWidth = 300.0, bool enableGridLines = false, Color gridLineColor = Colors.grey, int gridLineAmount = 5, double gridLineWidth = 0.5, Color gridLineLabelColor = Colors.grey, String labelPrefix = "\$"})
Creates a widget that represents provided data in a Sparkline chart.

Properties

data List<double>
List of values to be represented by the sparkline.
final
enableGridLines bool
Enable or disable grid lines
final
fallbackHeight double
The height to use when the sparkline is in a situation with an unbounded height.
final
fallbackWidth double
The width to use when the sparkline is in a situation with an unbounded width.
final
fillColor Color?
The fill color used in the chart, as determined by fillMode.
final
fillGradient Gradient?
A gradient to use when filling the chart, as determined by fillMode.
final
fillMode FillMode
Determines the area that should be filled with fillColor.
final
gridLineAmount int
Number of grid lines
final
gridLineColor Color
Color of grid lines and label text
final
gridLineLabelColor Color
final
gridLineWidth double
Width of grid lines
final
hashCode int
The hash code for this object.
no setterinherited
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
labelPrefix String
Symbol prefix for grid line labels
final
lineColor Color?
The color of the sparkline.
final
lineGradient Gradient?
A gradient to use when coloring the sparkline.
final
lineWidth double
The width of the sparkline.
final
pointColor Color
The color used when drawing individual data points over the sparkline.
final
pointSize double
The size to use when drawing individual data points over the sparkline.
final
pointsMode PointsMode
Determines how individual data points should be drawn over the sparkline.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
sharpCorners bool
Determines if the sparkline path should have sharp corners where two segments intersect.
final

Methods

build(BuildContext context) Widget
Describes the part of the user interface represented by this widget.
override
createElement() StatelessElement
Creates a StatelessElement to manage this widget's location in the tree.
inherited
debugDescribeChildren() List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children.
inherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toDiagnosticsNode({String? name, DiagnosticsTreeStyle? style}) DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep.
inherited
toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) String
A string representation of this object.
inherited
toStringDeep({String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a string representation of this node and its descendants.
inherited
toStringShallow({String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a one-line detailed description of the object.
inherited
toStringShort() String
A short, textual description of this widget.
inherited

Operators

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