Skip to content
All packages

// Package

nichart

Animated, theme-aware charts for Flutter with considered defaults. Line, area, bar, scatter, donut and sparkline charts, drawn in pure Dart on every platform.

likes
1
pub points
150/160
downloads in 30 days
44

Platforms

  • Android
  • iOS
  • Web
  • macOS
  • Windows
  • Linux

What it does

nichart draws charts in a Flutter app from very little code. Every styling option has a default, so three lines give you a smooth, themed chart. Deeper customisation is there when you want it, and never required.

Features

  • Chart types: line, area, bar (grouped or stacked), scatter, donut and sparkline.
  • No required configuration: every styling parameter has a default, including smoothing that never overshoots the data, a hairline grid and an eight-colour palette.
  • Automatic dark mode: gridlines, labels and palettes follow Theme.of(context). Override a subtree with ChartThemeScope, or build a theme from your ColorScheme.
  • Motion built in: series animate in on first layout, and when the data changes the chart morphs from the old values to the new ones. It respects reduced-motion settings. The screenshots below are stills; the README on pub.dev shows the same charts in motion.
  • Interaction: a crosshair and tooltip on every chart, with pan and zoom as an option.
  • Your own models: series accept any element type through xAccessor and yAccessor.
  • Large data: long series are downsampled automatically while keeping their shape, and the raw data is left untouched.
  • Accessible: each chart composes a label for screen readers, which you can override.
  • Pure Dart: no platform channels and no native code.

Install

flutter pub add nichart

Use it

A line chart is one call:

import 'package:nichart/nichart.dart';

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

Compose axes and several series when you need more:

Chart(
  axes: const ChartAxes.cartesian(
    x: TimeAxis(),
    y: NumericAxis(label: 'Users'),
  ),
  series: [
    LineSeries(
      data: thisWeek,
      style: const LineStyle(area: AreaFill.gradient()),
    ),
    LineSeries(
      data: lastWeek,
      style: const LineStyle.context(), // muted, dashed comparison series
    ),
  ],
)

Bars, donuts and sparklines are just as short:

Chart(series: [BarSeries(data: weekCounts)])
DonutChart(data: shares, center: Text('84%'))
Sparkline(data: last30Days)

The full API is documented on pub.dev.

Screenshots

  • A gradient area chart with a muted context series behind it
  • A crosshair and a tooltip following the pointer along a line chart
  • A bar chart with the default styling