plot_twist library

Composable, extensible charts for Flutter.

A Chart is a stack in data space: series, real widgets and behaviors are ordinary children that share one coordinate snapshot (a ChartView) per frame. Panning and zooming move things during layout and paint — widgets are never rebuilt because the view changed.

Classes

AnimatedChartData
Animates between data sets.
BandScale
A band (category) scale: band i is centred on the value i and is one unit wide.
BandTicks
Ticks at whole numbers, for band (category) scales.
BarSeries
Bars, one per row of a ChartData.
BarSeriesPainter
Paints a BarSeries. Built entirely on the public ChartSeriesPainter contract.
CandlestickSeries
Candlesticks, one per row of a ChartData that has a value column each for the open, high, low and close.
CandlestickSeriesPainter
Paints a CandlestickSeries. Built entirely on the public ChartSeriesPainter contract.
Chart
A chart: a plot area whose children share one data-space coordinate system, surrounded by optional docks for axes and other chrome.
ChartAnchor
Where one coordinate of a positioned child comes from.
ChartAppear
Animates the series below it into view when they are first shown: bars grow, a line is uncovered.
ChartAppearScope
Tells the series layers below it how far they have appeared.
ChartAxis
An axis: a line, tick marks and one label widget per tick.
ChartAxisExtent
How thick an axis is across its direction.
ChartAxisMarker
Pins a widget to a data value on a ChartAxis — a value pill, a crosshair badge, a "now" flag.
ChartCandle
The four prices of one candle.
ChartController
The handle to a chart's state: its scales, its series and what the user is pointing at.
ChartCrosshair
Tracks what the user points at and draws a crosshair there.
ChartCrosshairBadge
A widget pinned to the focused value on a ChartAxis — the badge that shows the crosshair's value on the axis.
ChartData
Column-oriented storage for the data of one series: an x column plus one or more value columns, held in typed arrays.
ChartDataBounds
The data extent of a series: an optional range per dimension.
ChartDataLabels
Writes the value of every visible data point next to it.
ChartDockScope
Tells a widget docked beside the plot which side it is on.
ChartEndAnchor
An anchor a number of pixels from the end edge of the plot.
ChartFocus
The data position a user is pointing at — what a crosshair shows.
ChartFractionAnchor
An anchor at a fraction of the plot.
ChartGestureDetector
Listens to gestures over a whole chart — plot and gutters — from anywhere in its children.
ChartGestureShield
Keeps the chart's behaviors (panning, crosshair, ...) away from gestures that start on child.
ChartGrid
Grid lines at the ticks of the chart's scales.
ChartGutterGroup
Keeps the axes of several charts equally thick, so their plots line up.
ChartHit
One data point found by a hit query.
ChartHitQuery
A request to find the data under (or near) a position.
ChartHitSet
A list of hits with data-point equality, so tooltip builders rebuild only when the pointed-at data changes — not when it merely moves on screen.
ChartLayoutBuilder<T>
Builds widgets from the chart's view, at layout time, and rebuilds them only when a value selected from the view changes.
ChartLegend
A legend: the colour and the label of every series of a chart.
ChartLimits
How far a scale may be panned and zoomed.
ChartLoader
Loads more data when the user scrolls towards the edge of what is loaded.
ChartNeedle
The needle of a gauge: a pointer from the centre of a polar chart to a value of its angle scale.
ChartPaint
A layer of a chart painted by a ChartPainter.
ChartPaintContext
What a ChartPainter paints with.
ChartPainter
Paints one layer of a chart, like a CustomPainter that knows the chart's coordinate system.
ChartPanZoom
Lets the user pan and zoom a chart.
ChartPanZoomEndDetails
The end of a pan/zoom gesture.
ChartPanZoomGestureRecognizer
Recognizes one-finger pans and two-finger pinches as a single gesture, the way a chart needs them.
ChartPanZoomStartDetails
Details of the first movement of a pan/zoom gesture.
ChartPanZoomUpdateDetails
One step of a pan/zoom gesture. All amounts are relative to the previous update, so they can be applied directly.
ChartPixelAnchor
An anchor a number of pixels from the start edge of the plot.
ChartPointerEvent
A pointer event delivered to chart behaviors, with chart context.
ChartPointerHandler
Receives pointer events from the chart's pointer hub.
ChartPointerHub
Routes pointer events from the chart's root to its behaviors.
ChartPolar
How a polar chart lays its two scales out on a circle: the angle scale runs around it, the radius scale from the centre outwards.
ChartPolarAxis
The labels of one scale of a polar chart, painted in the plot.
ChartPolarGrid
The grid of a polar chart: a ring at every tick of the radius scale and a spoke at every tick of the angle scale.
ChartPolarPositioned
Places a widget in a polar chart from an angle and a radius.
ChartPolarScope
Tells the widgets of a polar chart how its scales lie on the circle.
ChartPolarView
A ChartPolar laid out in one frame of a chart: where the circle is, and the pixel of every value.
ChartPositioned
Places a widget in a chart from data coordinates.
ChartRange
A closed interval [min, max] of data values.
ChartRangeContext
What a ChartRangePolicy or ChartLimits can ask about the data plotted on its scale.
ChartRangePolicy
Decides which window a scale shows while it is in automatic mode.
ChartReferenceLine
A line across the plot at one value of a scale: a threshold, a target, an average, "now".
ChartScale
One dimension of a chart: how values map to positions, which window is shown by default, how far it can be moved, and where its ticks go.
ChartScaleController
The live state of one scale: which window is visible.
ChartScaleView
The state of one scale for one frame: its visible window and how values map to pixels along the plot.
ChartScope
Gives everything below a Chart access to that chart.
ChartSector
A part of a ring: what a slice of a pie or a bar of a gauge covers on screen.
ChartSeries
A series registered with a chart: everything legends, tooltips, crosshairs and auto-ranging need to know about it.
ChartSeriesEntry
A part of a series that has a name and a colour of its own: a slice of a pie. A legend shows one item for each instead of one for the series.
ChartSeriesPainter
A ChartPainter that draws data.
ChartStack
A stack over the plot area of a chart.
ChartTheme
Applies a ChartThemeData to the charts below it.
ChartThemeData
Colours and text styles used by the built-in chart widgets.
ChartTick
One mark on a scale: a data value and its default text label.
ChartTickContext
What a tick provider needs to know to place ticks.
ChartTicks
Decides where ticks go and what their default labels say.
ChartTickSet
A list of ticks with value equality, so layout builders rebuild only when the set of ticks actually changes.
ChartTooltip
Shows a widget next to the data the user points at.
ChartValueAnchor
An anchor at a data value.
ChartView
The immutable coordinate snapshot every layer of a chart shares for one frame.
ChartViewBuilder
Builds widgets from the chart's ChartView, rebuilding on every change of the view (every pan or zoom frame).
ChartViewChannel
Carries the current ChartView from a chart to every chart-aware render object below it.
FitBandsRange
Fits whole bands on a band scale: from half a band before the first category to half a band after the last, whatever the series draw.
FitDataRange
Fits all data plotted on the scale.
FitVisibleRange
Fits the data that is visible in the other dimension.
FixedRange
Always shows [min, max].
FixedTicks
Ticks at fixed values.
FollowRange
Shows the most recent span units of data.
LinearScale
A linear scale.
LinearTicks
"Nice" ticks for a linear scale: multiples of 1, 2, 2.5 or 5 × 10ⁿ.
LineSeries
A line (and optionally an area under it) through the rows of a ChartData.
LineSeriesPainter
Paints a LineSeries. Built entirely on the public ChartSeriesPainter contract.
LogScale
A logarithmic scale.
LogTicks
Ticks at powers of the base for a logarithmic scale.
PieSeries
A pie or a doughnut: one slice per row of a ChartData, as wide as its value.
PieSeriesPainter
Paints a PieSeries. Built entirely on the public ChartSeriesPainter contract.
PolarChart
A chart on a circle: pies and doughnuts, gauges and radar charts.
RadarSeries
A line around the centre of a polar chart: the outline of a radar chart.
RadarSeriesPainter
Paints a RadarSeries. Built entirely on the public ChartSeriesPainter contract.
RadialBarSeries
Bars bent around the centre of a polar chart: a gauge, a progress ring, or one ring per row of a ChartData.
RadialBarSeriesPainter
Paints a RadialBarSeries. Built entirely on the public ChartSeriesPainter contract.
ScatterSeries
A dot per row of a ChartData. Rows need not be sorted.
ScatterSeriesPainter
Paints a ScatterSeries. Built entirely on the public ChartSeriesPainter contract.
TimeScale
A time scale. Values are milliseconds since the Unix epoch.
TimeTicks
Calendar-aware ticks for a time scale whose values are milliseconds since the Unix epoch.

Enums

CandleStyle
How a CandlestickSeries draws a candle.
ChartAppearEffect
How a series is drawn while it appears. See ChartAppear.
ChartDataLabelPosition
Where a ChartDataLabels layer puts the label of a data point.
ChartHitMode
How a pointer position is matched to data points.
ChartOverflow
What happens to a positioned child that leaves the plot area.
ChartPolarGridShape
The shape of the rings of a ChartPolarGrid.
ChartPositionedFit
How a positioned child is kept inside the plot.
ChartRegion
The part of a chart a pointer is over.
ChartSide
A side of the plot area that can hold docked widgets such as axes.
ChartTimeUnit
The calendar unit a TimeTicks step is expressed in.
ChartWheelAction
What the mouse wheel does over a chart.
LineCurve
How consecutive points of a LineSeries are joined.

Mixins

ChartViewDependent
A render object that depends on the chart's ChartView.

Extensions

ChartDateTime on DateTime
Converts between DateTime and time-scale values.

Constants

kChartAngle → const Object
Identifies the angle scale of a polar chart.
kChartRadius → const Object
Identifies the radius scale of a polar chart.
kChartX → const Object
Identifies the default horizontal scale of a chart.
kChartY → const Object
Identifies the default vertical scale of a chart.

Typedefs

ChartAxisValueResolver = double? Function(ChartView view)
Computes the data value a marker sits at. Return null to hide the marker.
ChartBarColor = Color? Function(int index, double x, double y)
Picks the colour of one bar from its row: its index, its x and its value y, whichever way the bars point.
ChartLegendEntryBuilder = Widget Function(BuildContext context, ChartSeries series, ChartSeriesEntry entry)
Builds the legend item of one entry of series, such as a slice of a pie.
ChartLegendItemBuilder = Widget Function(BuildContext context, ChartSeries series)
Builds the legend item of series.
ChartPointerFilter = bool Function(ChartPointerEvent event)
Decides whether the pointer that produced event is offered to a detector's gesture recognizers.
ChartPositionResolver = Offset? Function(ChartView view)
Computes a plot-local position from the current view. Return null to hide the child.
ChartShaderBuilder = Shader Function(ChartView view)
Creates a shader for a series from the current view — for example a gradient whose stops sit at data values.
ChartSliceColor = Color? Function(int index, double value)
Picks the colour of one slice from the index of its row and its value. Return null for the colour of the palette.
ChartTickFormatter = String Function(ChartTick tick)
Turns a tick into the text of its label.
ChartTickLabelBuilder = Widget Function(BuildContext context, ChartTick tick)
Builds the widget shown for one tick of an axis.
ChartTimeFormatter = String Function(DateTime time, ChartTimeUnit unit, bool isBoundary)
Formats a tick on a time scale.
ChartTooltipBuilder = Widget Function(BuildContext context, List<ChartHit> hits)
Builds the content of a tooltip for the data points the user points at.
ChartValueFormatter = String Function(double value)
Formats a tick value for display.