RadarChart class

A chart type which plots the values in the form of a spider web or radar.

It takes the required values parameter which provides the data points (minimum 3 values are required) and required maxValue which defines the scale of the graph. E.g. The chart contains five levels, if maxValue = 10, then each level will have the value 2.

The other parameters are optional which define different behaviors for the chart like:

labels which will be shown in the graph, if not provided, will default to the value of data points. If provided, it's length should be same as that of values.

size which defines the canvas area defaults to Size.infinite and is constrained by the parent widget.

fillColor defines the background color of the plotted graph, if not provided, defaults to Colors.black26.

strokeColor defines the color of the chart outlines, defaults to Colors.black87.

labelColor defines the color of the chart labels, defaults to Colors.black.

maxHeight and maxWidth defines the maximum width and height of the chart when no parent constraints are applied, otherwise ignored.

textScaleFactor defines the factor by which the label's textSize increases with respect to the average of width and height of the enclosing parent widget, if not provided defaults to 0.04.

labelWidth defines the maximum width of the labels, if not provided, defaults to internally calculated value based on the size of the chart.

maxLinesForLabels defines the maximum lines for the label's text, if not provided, defaults to the hundredth part of the container height of the parent container. E.g. if height of the parent is 200, the [maxLinesForLabels] = 2

animate defines the animation toggle, if true, the chart will animate, else not. Defaults to true.

animationDuration defines the duration of the animation for the graph. If not provided, defaults to 1500 milliseconds.

curve defines the animation's progress style in a non-linear fashion.

chartRadiusFactor defines the factor by which the chart radius increases with respect to width or height (whatever is minimum). If not provided, defaults to 0.8 (80%).

Inheritance

Constructors

RadarChart({Key? key, required List<double> values, List<String>? labels, required double maxValue, Size size = Size.infinite, Color fillColor = Colors.black26, Color strokeColor = Colors.black87, Color labelColor = Colors.black, double maxWidth = 200, double maxHeight = 200, double textScaleFactor = 0.04, double? labelWidth, int? maxLinesForLabels, bool animate = true, Duration animationDuration = const Duration(milliseconds: 1500), Curve curve = Curves.easeIn, double chartRadiusFactor = 0.8})
Creates a chart which plots the values in the form of a spider web or radar.

Properties

animate bool
It is the animation toggle
final
animationDuration Duration
Defines the duration of the animation for the graph.
final
chartRadiusFactor double
Percent factor to chart's radius wrt to width or height (min of both)
final
curve Curve
It defines the animation style
final
fillColor Color
Defines the background color of the plotted graph
final
hashCode int
The hash code for this object.
no setterinherited
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
labelColor Color
Defines the color of the chart labels
final
labels List<String>?
Provides naming for the data points
final
labelWidth double?
Defines the maximum width of the labels
final
maxHeight double
Defines the maximum height of the chart
final
maxLinesForLabels int?
Defines the maximum lines for the label's text
final
maxValue double
Defines the scale of the graph
final
maxWidth double
Defines the maximum width of the chart
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
size Size
Defines the size of the canvas
final
strokeColor Color
Defines the color of the chart outlines
final
textScaleFactor double
Percent factor of text size wrt to Height and Width
final
values List<double>
Data points of the graph
final

Methods

createElement() StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() → _RadarChartState
Creates the mutable state for this widget at a given location in the tree.
override
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