plot_twist 0.2.1
plot_twist: ^0.2.1 copied to clipboard
Composable charts for Flutter: line, area, bar, scatter and candlestick series, real-time and time series data, large datasets, pan and zoom, any widget as a tooltip or marker.
0.2.1 #
No code changes. The description, the topics and the feature list at the top
of the README name what the package does in the words people search for:
real-time data, time series, large datasets, stacked and horizontal bars. The
topic charts replaces data-visualization.
0.2.0 #
Horizontal bars, stacked areas, data labels, a legend, an appear animation, reference lines, minor ticks and candle styles. A few parameters have new names; the old ones keep working until 0.3.0.
Breaking #
- The library no longer exports its render objects and their parent data:
RenderChartLayout,RenderChartStack,RenderChartAxis,RenderChartPaint,RenderChartLayoutBuilder,ChartLayoutParentData,ChartStackParentData,ChartAxisParentData,ChartPlacementandChartAxisChildKind. They were implementation details; the widgets that create them are unchanged. ChartController.scale(id)fails an assertion for a scale the chart does not have, once a chart uses the controller. It used to create that scale silently, which hid a mistypedxScaleoryScale. Before a chart uses the controller, scales are still created on demand.
Renamed #
The old names keep working and are marked as deprecated. They are removed in
0.3.0. After this, width always means a stroke width in logical pixels.
| Old | New |
|---|---|
BarSeries.width, CandlestickSeries.width |
widthFactor |
BarSeries.radius |
cornerRadius |
ScatterSeries.radius |
pointRadius |
Chart.scales |
Chart.yScales |
formatNumber, niceStep |
ChartTicks.formatNumber, ChartTicks.niceStep |
The painters of the three series are renamed in the same way.
Changed #
- A series without a
colortakes the colour the palette of the chart theme has for its place in the chart: the first series the first colour, the second the next, whether a series is visible or not. Until now every such series took the first colour, so a chart with several of them changes its colours. Give a series acolorto keep it. ChartController.serieslists the series in paint order. A series added in front of others on a rebuild used to come last.ChartSeries.colorof a series without a colour is its palette colour, also for aChartPaintwith a painter of your own, where it used to be null.colorofLineSeriesPainter,BarSeriesPainterandScatterSeriesPainteris optional and nullable. Null paints withChartPaintContext.seriesColor.ChartSeries, the view of a series that the controller hands out, has two new members,listedandvisitMarks.ChartHitModehas a third value,nearestY. Aswitchover the modes in a series of your own needs a case for it; a series whose rows run along x adds no hit there.- The default tooltip shows
ChartHit.value, which isyfor everything except horizontal bars.
Fixed #
- A dashed
LineSerieskeeps its dashes in place while it is panned. They used to jump along the line whenever a row left the window.
Gallery #
- A2 picks the nearest star in both dimensions, A11 grows its series in, A14
has minor ticks, A17 draws its threshold with
ChartReferenceLine, A19 lays its bars down and labels them, and A20 usesChartLegend.
New #
- Horizontal bars:
BarSeries(direction: Axis.horizontal). The rows run along the vertical scale and the values along the horizontal one; stacks, offsets, rounded ends and per-bar colours work as for columns. UseChartCrosshair(mode: ChartHitMode.nearestY)with it. With only y to pan,ChartWheelAction.panscrolls the rows. - Stacked areas:
LineSeries(baseColumn:)fills between the line and another value column, and takes the layers ofChartData.stackedasBarSeriesdoes. Such a series draws every visible row; it is not reduced to the extremes of each pixel column. ChartData.stacked(layers, diverging: true)stacks negative values downwards from zero, for stacks with gains and losses.ChartDataLabels: a layer that writes the value next to every visible data point of bars in both directions, lines, scatter plots and candlesticks, withformat,position(outside, inside or centred), overlap hiding and a limit (maxLabels, 250) above which it draws none. A series of your own gets labels by overridingChartSeriesPainter.visitMarks.ChartLegend: the colour and label of every series, for a side slot of the chart or anywhere else with the chart's controller. It is complete on the first frame, wraps, dims hidden series and reports taps (onSeriesTap), so your state keeps deciding which series is visible.ChartAppear: wrap a series or a whole chart, and its series grow, are uncovered or fade in when first shown (ChartAppearEffect.growY,growX,reveal,fade). Only the painting is animated: ranges and hits are final from the first frame, so the axes stand still, and a series of your own gets it too. It is skipped under reduced motion.ChartReferenceLine.y(value)and.x(value): a line across the plot at a threshold, a target or an average, with an optional dash pattern and a label widget that follows the line.includeInRangewidens automatic ranges to show it.- Minor ticks:
LinearTicks(minorCount:),LogTicks(minor:)andBandTicks(minor:). An axis draws a short mark at each (ChartAxis.minorTickLength), andChartGrid(minor: true)a fainter line. They are inChartScaleView.minorTicks; ticks of your own provide them by overridingChartTicks.generateMinor. CandlestickSeries(style:):CandleStyle.hollowoutlines the candles that close at or above their open,CandleStyle.ohlcdraws OHLC bars. Both are still two draw calls per frame.ChartCrosshair(mode:):ChartHitMode.nearestsnaps to the closest point in both dimensions, so a tooltip on a scatter plot shows the dot under the pointer.ChartHitMode.nearestYsnaps along y, for horizontal bars. The mode is stored inChartFocus.mode, andChartController.hitsFor(focus)returns the data points a focus stands for.snapDistancelimits how far the focus snaps.ChartTooltip(yScale:), for a focus measured on another vertical scale.dashonChartGridandChartCrosshair. For painters of your own,ChartPainter.dashPathcuts a path into dashes andChartPainter.drawDashedLinedraws a dashed straight line in one call.cliponBarSeries,ScatterSeriesandCandlestickSeries, as onLineSeries.
For series and painters of your own:
ChartPaintContext.seriesColor: the colour of the layer being painted, for painters of your own.ChartHit.base,ChartHit.valueAxis,ChartHit.valueandChartHit.argument. A bar's hit carries the value it starts from, so a tooltip can show the size of one layer of a stack.ChartPaint(listed: false), for a helper layer that counts for automatic ranges but is no series to a legend.ChartSeries.listedreports it.ChartController.seriesRepaint: notifies at once when a series changes what it shows, as therepaintof a painter that draws what the series show.
0.1.1 #
Fixes. Nothing is removed or renamed.
- Log scales: a log axis no longer gets stuck on the window 1 to 10 when the
data, a bar's baseline of 0 or
includeZerobrings in a value of zero or less. Such values are missing data: automatic ranges leave them out, lines break there, and bars and filled areas grow from the edge of the plot. The fitted window reaches to the next power of the base below the smallest value, so the smallest bar still has a length. - Infinite values are missing data as well. One of them used to send every automatic range to its fallback.
LineSeries: zoomed far into sparse data, a stepped line and its fill drew the first run at the wrong height. A smooth line changed shape at the plot edges while panning, was drawn straight between two rows that bracket the window, and did not matchvalueAt.LineSeries.dashis compared by value, so a list written inbuildno longer repaints the series on every rebuild.TimeTicks: steps of one and two weeks fall on Mondays instead of Thursdays. In local time, steps of several days stay at midnight and steps of 3, 6 and 12 hours stay on the clock grid across a daylight saving change.- Ticks set on a scale or an axis to change a spacing or a format keep what
the scale knows: UTC on a UTC
TimeScale, the base of aLogScale, the labels of aBandScale. ChartLoader: a failed load is reported to the newonError(or throughFlutterError.reportError) and tried again when the window or the data changes; it used to leave that side loading for good. A load that says there is more but adds nothing is no longer repeated without end. A change ofxScaleis followed.ChartPanZoomremoved while a finger is down releases its scales, which stayed marked as interacting, also on linked charts.AnimatedChartDatarespects reduced motion on first show too. Removing one that never animated no longer fails an assertion (seen on Flutter 3.41).- An axis gutter that grew during a gesture shrinks when the gesture ends.
ChartData.setValueupdates the min/max index instead of rebuilding it, which makes a live last candle cheap on large stores.FixedRange,FollowRange,LogScaleandChartLimitsassert configurations that cannot work, such as a range the wrong way round or a logarithm base of 1. In release builds such values no longer throw later.
New, for custom scales and series: ChartScale.domain,
ChartScale.resolveTicks, ChartData.valueExtent(within:) and
ChartData.xExtentWithin. A series' bounds should leave out values outside
the window it is given in each dimension, as the built-in ones now do.
0.1.0 #
First release.
Chart: one widget for every kind of chart. It has named scales, four side slots that take any widget, and a list of children that share one data-space view.ChartControllerandChartScaleController: the visible window per scale, readable, settable, animatable and listenable. Scale controllers and the crosshair focus can be shared between charts.- Scales: linear, logarithmic, time and band, with fit, fit-visible, fixed and
follow range policies. Custom scales subclass
ChartScale. - Widgets in data space:
ChartPositioned,ChartLayoutBuilder,ChartAxiswith widget labels andChartAxisMarker. - Painting:
ChartPaintwithChartPainterandChartSeriesPainter. - Series:
LineSeries,BarSeries,ScatterSeriesandCandlestickSeries. - Behaviors:
ChartPanZoom,ChartCrosshair,ChartTooltip,ChartLoaderandAnimatedChartData. Custom ones useChartGestureDetector. ChartData: typed columns that grow at both ends, with an index for fast extent queries.- An example gallery with one demo for each of 26 aspects.