Plot class

A widget that displays a Plot.

The plot will display the Graph objects specified

This sample shows a simple graph:

{@tool snippet}

Plot(
  graphs: [
    Graph(
      x: [0, 1, 2, 3, 4, 5],
      y: [0, 1, 2, 3, 4, 5],
      crosshairs: [
        Crosshair(
          label: 'Crosshair',
          active: true,
          yPadding: 10,
        )],
    )
],)

{@end-tool}

Navigate around the plot by using a mouse or toch pad. The Plot can be scaled with scrolling/panning a mouse or touchpad. The Plot can be scaled on x-axis only by pressing shift + scroll/panning. The Plot can be scaled on y-axis only by pressing ctrl + scroll/panning.

Inheritance

Constructors

Plot({Key? key, required List<Graph> graphs, Ticks? xTicks, Ticks? yTicks, PlotConstraints? constraints, dynamic onConstraintsChanged(PlotConstraints constraints, PlotConstraints extremes)?, double strokeWidth = 1, double padding = 0, double minimumScale = 0.25, double maximumScale = 50})
Creates a widget that displays a Plot
const

Properties

constraints PlotConstraints?
Initial Plot constraints. If xTicks or yTicks is logarithmic, it is expected that the constraints are in the log10 space.
final
graphs List<Graph>
The FlutterPlot graphs to paint.
final
hashCode int
The hash code for this object.
no setterinherited
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
maximumScale double
The maximum scale factor possible for scaling the plot.
final
minimumScale double
The minimum scale factor possible for scaling the plot.
final
onConstraintsChanged → dynamic Function(PlotConstraints constraints, PlotConstraints extremes)?
Function called every time the PlotConstraints changes. To optimize performance, do not use this feature! If xTicks or yTicks is logarithmic, the constraints and extremes are in the log10 space.
final
padding double
The padding to use around the plot borders
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
strokeWidth double
The width of the graph lines
final
xTicks Ticks?
The ticks which will annotate the x-axis.
final
yTicks Ticks?
The ticks which will annotate the y-axis.
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
isEqualConfigTo(Plot other) bool
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
toLog(bool xLog, bool yLog) → void
toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) String
A string representation of this object.
inherited
toStringDeep({String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) 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