nichart library

Beautiful, animated, theme-aware charts for Flutter with gorgeous defaults.

A chart is three lines of code:

import 'package:nichart/nichart.dart';

Chart.line(data: [DataPoint(0, 2), DataPoint(1, 5), DataPoint(2, 3)])

Everything is customizable — series styles, axes, themes, palettes — but nothing is required: every chart renders beautifully with only data provided, and adapts to light/dark mode automatically.

Classes

AreaFill
The fill under a line — used by AreaSeries and LineStyle.area.
AreaSeries<T>
A line series with the signature gradient fill below it.
BandAnnotation
A filled band between two values on one axis, spanning the full plot along the other. Painted beneath the grid, so gridlines stay visible through the wash.
BarSeries<T>
A bar series. Renders on a CategoryAxis band per category (inferred automatically for CategoryPoint data), or on numeric/time axes using the smallest x gap as the band.
BarStyle
Visual style for a BarSeries.
CategoryAxis
A categorical (band) axis — one equal-width band per category.
CategoryPoint
A labeled value, for categorical charts (bars, donuts).
CategoryScale
A band scale over an ordered list of categories.
Chart
A beautiful, animated, interactive, theme-aware chart.
ChartAnimation
Motion configuration for a chart.
ChartAnnotation
A decoration drawn in the plot's domain space — reference bands and lines that give data context (a target range, a threshold, an event moment) without being data themselves.
ChartAxes
The pair of axes for a cartesian chart.
ChartAxis
Configuration for one chart axis.
ChartController
Programmatic control of a chart's visible domain.
ChartHoverInfo
Everything known about the current crosshair position — passed to tooltip builders and hover listeners.
ChartInteraction
A chart interaction behavior.
ChartLegend
A legend for a chart's series (or a donut's segments).
ChartPalettes
Built-in color palettes.
ChartTheme
Visual styling for charts: grid, labels, palette and surface colors.
ChartThemeScope
Provides a ChartTheme to all charts below it in the tree.
ChartTooltip
A tooltip listing every series' value at the crosshair position.
Crosshair
A vertical crosshair that snaps to the nearest data x across all series (index mode), with hover markers on the matched points.
DataPoint
An (x, y) pair on a numeric domain.
DomainWindow
A visible-domain window: [min, max] in domain units (numeric values, epoch milliseconds for time axes).
DonutChart
A donut chart with an optional hero widget in the cutout.
DonutSeries<T>
A donut (or pie) series: one annular segment per datum, palette colors assigned in display order.
DonutStyle
Visual style for a DonutSeries.
Downsampling
Downsampling policy for line and area series.
HoveredPoint
One series' data point under the crosshair.
LineAnnotation
A reference line at one value on one axis, spanning the full plot along the other. Painted over the series, beneath interaction chrome.
LineSeries<T>
A line series: points connected by a smooth monotone stroke.
LineStyle
Visual style for a LineSeries or AreaSeries.
NumericAxis
A continuous numeric axis.
NumericScale
A continuous linear scale over a double domain.
PanZoom
Pan and zoom of the visible domain.
Scale<D>
Maps values from a data domain onto the unit interval [0, 1].
ScatterSeries<T>
A scatter series: one circular marker per datum.
ScatterStyle
Visual style for a ScatterSeries.
Series<T>
A dataset drawn on a chart.
SeriesEmphasis
Highlights one series and mutes the rest.
Sparkline
An axis-less mini chart for stat cards, table cells and list tiles.
TimeAxis
A time axis over a DateTime domain.
TimePoint
A timestamped value, for time-series charts.
TimeScale
A continuous scale over a DateTime domain.

Enums

AreaFillMode
How an area fill is painted.
BarArrangement
How multiple BarSeries share a category band.
LineInterpolation
How consecutive points of a line series are connected.
PanZoomAxis
Which axes pan and zoom apply to.
ScrollZoomModifier
Keyboard modifier required for scroll-wheel zoom.
TimeGranularity
Calendar granularity of generated time ticks — drives label formatting.

Functions

formatTickLabel(double value, double step) String
Formats a tick value for display, using step to pick the number of decimals and compacting large magnitudes (12k, 3.4M, 1.2B).
formatTimeTick(DateTime tick, TimeGranularity granularity) String
Formats a time tick for display, matched to the tick granularity (English month abbreviations, 24-hour clock, no locale dependency).
lttbDownsample(List<Offset> points, int threshold) List<Offset>
Largest-Triangle-Three-Buckets downsampling.
niceDomain(double min, double max, {int targetTickCount = 5}) NiceDomain
Expands [min, max] to bounds that land on nice tick values.
niceNum(double range, {required bool round}) double
Rounds range to a "nice" number (1, 2, 5 × 10ⁿ).
tickStepFor(double min, double max, {int targetTickCount = 5}) double
Step used by ticksWithin for the given extent — exposed so label formatting can match tick precision.
ticksWithin(double min, double max, {int targetTickCount = 5}) List<double>
Generates nice tick values that fall inside [min, max] (inclusive, with a small tolerance for floating-point drift).
timeTicks(DateTime min, DateTime max, {int targetTickCount = 6}) TimeTicks
Generates calendar-aligned ticks inside [min, max].

Typedefs

CategoryAccessor<T> = String Function(T datum)
Extracts a category label from a datum of type T.
ChartAccessor<T> = double Function(T datum)
Extracts a numeric axis value from a datum of type T.
NiceDomain = ({double max, double min, double step})
A "nice" numeric domain: rounded bounds and the tick step that produced them.
TimeTicks = ({TimeGranularity granularity, List<DateTime> ticks})
The result of timeTicks: tick instants plus the granularity that produced them (needed to format labels consistently).