chartificial 0.0.1
chartificial: ^0.0.1 copied to clipboard
Cartesian charts for Flutter on the two-dimensional viewport: lazy paged loading, recycled widget axis labels, scrolling time axes, pluggable series.
Changelog #
0.0.1 #
Initial release.
Chart #
Chartificial— a cartesian chart built on Flutter's two-dimensional viewport, withChartificialControllerowning data and scroll-domain state andChartificialThemefor chrome defaults.- Bounded-constraint viewport semantics: the chart composes inside
SizedBox,Expandedand friends rather than sizing itself to its content.
Series #
LineSeries— straight, cardinal and monotone-half-x curves; below-line solid or gradient fill; dashed strokes; position-space stroke gradients; point markers and anendMarkerthat overflows the plot; explicit gap handling viaGapPolicy.BarSeries— floating bars (fromY/toY), per-point styles, gradients, rounded corners, borders,BarBackgroundtracks, cumulativeBarStackSegmentstacks, and clustering viaxOffsetPx+barClusterOffset. Widths in pixels or in x-domain span.ChartSeriesis an open base class:BarSeriesis built on the same public interface a consumer would use, andChartPointcan be subclassed (yExtentkeeps auto-ranging correct for range-like data).
Axes #
NumericAxis,DateTimeAxisandLogarithmicAxis, over pluggableAxisScaletransforms (LinearScale,LogScale).- Range policies:
AxisRange.auto,.fixed, and.visible(the y axis follows the visible x window).AxisRangeis open for implementation and the built-ins compose by delegation. - Tick strategies: fixed interval, time interval, target count, pixel-spaced,
automatic (numeric and calendar-aware), and decades.
AxisTicksis open for implementation. - Axis labels are recycled widgets via
AxisLabelConfig.builder, with edge clamping, configurable band extent, and an opposed (right) y axis.
Scrolling and lazy loading #
AxisResolution.perUnit/.intervalmake an axis scrollable by fixing pixels-per-unit;AxisAnchor.endpins the newest point to the right edge and scrolls into the past.ChartLoaderpages data in as the user approaches either loaded edge, with a prefetch margin, single-flight requests, and latched exhaustion.- Prepending history keeps the on-screen pixels stable;
followLatestpins a chart resting at the newest edge to incoming points.
Interaction #
TrackballBehavior— tap, long-press or hover activation, a snapping tracker line, per-series markers, and a widget tooltip builder.- Series own what a pointer snaps to via
ChartSeries.snap, so clustered bars snap in visual space and custom series can redefine "nearest" or opt out. - Raw
onTap/onLongPress/onHovercallbacks carryingChartHitInfo, plusonVisibleRangeChanged.
Painting #
ChartDecorationlayers behind or above the series; the default grid (GridDecoration) is one of them and can be removed or replaced.ChartColorScale.stops/.bandsdefine color in value space, so band edges stay exact through any axis transform.SeriesRenderSnapshot.geometrylets a series publish per-frame paint products to decorations painted above it.- Public geometry and path helpers for custom painters:
effectiveSegments,verticalLineCrossings,addCardinal,addMonotoneHalfX,dashPath,belowFillRect,boundsOf.