TinyBarChart class
A Widget that paints a simple bar chart.
It is ideal for sparkline charts.
The chart can be TinyBarChart.single or TinyBarChart.stacked. For stacked, it is also possible to pass the data in raw vectors by using TinyBarChart.stackedFromDataVectors.
The chart is rendered with a series of bars each representing the y value of each element dataPoints. The bars are sorted by the x values.
The bars are rendered side by side (stacked).
The width of each bar represents the percentage of space occupied by the
data point value in a data space between zero and the "max" value.
The "max" value is equal to options.max
or, when null, the sum of all
bar values.
If both width and height are passed, the chart will try to keep aspect ratio.
See also:
- TinyBarChart.single to build a bar chart that represents only one value.
- TinyBarChart.stacked To build a bar chart of stacked bars.
- TinyBarChart.stackedFromDataVectors To build a stacked bar chart from
raw
Vector2
. - TinyBarChartOptions for more details on options.
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatelessWidget
- TinyBarChart
Constructors
- TinyBarChart.single({Key? key, required double value, required double max, Color? color, double? width, double? height})
-
Creates a TinyBarChart that represents the percentage of
value
in relation tomax
.factory -
TinyBarChart.stacked({Key? key, required Iterable<
double> data, TinyBarChartOptions? options, double? width, double? height}) -
Creates a TinyBarChart that represents the bars defined by
data
.factory -
TinyBarChart.stackedFromDataVectors({Key? key, required Iterable<
Vector2> dataPoints, TinyBarChartOptions? options, double? width, double? height}) -
Just like TinyBarChart.stacked except the data is represented by a
list of
Vector2
.const
Properties
-
dataPoints
→ Iterable<
Vector2> -
The set of vectors that represents the bars data.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- height → double?
-
If non-null, require the chart to have this height.
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- options → TinyBarChartOptions
-
A set of options to customize the chart display, defaults to
kDefaultBarChartOptions when null on construction.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- width → double?
-
If non-null, require the chart to have this width.
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