All Projects → xqwzts → Flutter_circular_chart

xqwzts / Flutter_circular_chart

Licence: mit
Animated radial and pie charts for Flutter

Programming Languages

dart
5743 projects

Projects that are alternatives of or similar to Flutter circular chart

Event
The Hoa\Event library
Stars: ✭ 319 (-3.33%)
Mutual labels:  library
Structopt
Parse command line arguments by defining a struct
Stars: ✭ 323 (-2.12%)
Mutual labels:  library
Cordova Plugin Device
Apache Cordova Plugin device
Stars: ✭ 327 (-0.91%)
Mutual labels:  library
React Component Library
A project skeleton to get your very own React Component Library up and running using Rollup, Typescript, SASS + Storybook
Stars: ✭ 313 (-5.15%)
Mutual labels:  library
Mirror
Easy reflection for Java and Android
Stars: ✭ 324 (-1.82%)
Mutual labels:  library
Reproc
A cross-platform (C99/C++11) process library
Stars: ✭ 325 (-1.52%)
Mutual labels:  library
Bem Components
Set of components for sites development
Stars: ✭ 318 (-3.64%)
Mutual labels:  library
Libplist
A library to handle Apple Property List format in binary or XML
Stars: ✭ 330 (+0%)
Mutual labels:  library
Kiimagepager
The KIImagePager is inspired by foursquare's ImageSlideshow, the user may scroll through images loaded from the Web
Stars: ✭ 324 (-1.82%)
Mutual labels:  library
Ccxt
A JavaScript / Python / PHP cryptocurrency trading API with support for more than 100 bitcoin/altcoin exchanges
Stars: ✭ 22,501 (+6718.48%)
Mutual labels:  library
Tintlayout
This library help you to achieve popular drop shadow effect from view.
Stars: ✭ 322 (-2.42%)
Mutual labels:  library
File
The Hoa\File library.
Stars: ✭ 322 (-2.42%)
Mutual labels:  library
Clojure.java Time
Java 8 Date-Time API for Clojure
Stars: ✭ 323 (-2.12%)
Mutual labels:  library
Jackrabbit Oak
Mirror of Apache Jackrabbit Oak
Stars: ✭ 321 (-2.73%)
Mutual labels:  library
Easyvalidation
✔️ A text and input validation library in Kotlin for Android
Stars: ✭ 328 (-0.61%)
Mutual labels:  library
Fcharts
📊 [wip] Create beautiful, responsive, animated charts using a simple and intuitive API.
Stars: ✭ 318 (-3.64%)
Mutual labels:  library
Hoplite
A boilerplate-free library for loading configuration files as data classes in Kotlin
Stars: ✭ 322 (-2.42%)
Mutual labels:  library
Metrics Clojure
A thin façade around Coda Hale's metrics library.
Stars: ✭ 330 (+0%)
Mutual labels:  library
Crashreporter
CrashReporter is a handy tool to capture app crashes and save them in a file.
Stars: ✭ 327 (-0.91%)
Mutual labels:  library
Unstated Next
200 bytes to never think about React state management libraries ever again
Stars: ✭ 3,784 (+1046.67%)
Mutual labels:  library

pub package

Flutter Circular Chart

A library for creating animated circular chart widgets with Flutter, inspired by Zero to One with Flutter.

Overview

Create easily animated pie charts and radial charts by providing them with data objects they can plot into charts and animate between.

animated_random_radial_chart

animated pie chart animated radial chart

Check the examples folder for the source code for the above screenshots.

Contents:

Installation

Install the latest version from pub.

Getting Started

Import the package:

import 'package:flutter_circular_chart/flutter_circular_chart.dart';

Create a GlobalKey to be able to access the chart and update its data:

final GlobalKey<AnimatedCircularChartState> _chartKey = new GlobalKey<AnimatedCircularChartState>();

Create chart data entry objects:

List<CircularStackEntry> data = <CircularStackEntry>[
  new CircularStackEntry(
    <CircularSegmentEntry>[
      new CircularSegmentEntry(500.0, Colors.red[200], rankKey: 'Q1'),
      new CircularSegmentEntry(1000.0, Colors.green[200], rankKey: 'Q2'),
      new CircularSegmentEntry(2000.0, Colors.blue[200], rankKey: 'Q3'),
      new CircularSegmentEntry(1000.0, Colors.yellow[200], rankKey: 'Q4'),
    ],
    rankKey: 'Quarterly Profits',
  ),
];

Create an AnimatedCircularChart, passing it the _chartKey and initial data:

@override
Widget build(BuildContext context) {
  return new AnimatedCircularChart(
    key: _chartKey,
    size: const Size(300.0, 300.0),
    initialChartData: data,
    chartType: CircularChartType.Pie,
  );
}

Call updateData to animate the chart:

void _cycleSamples() {
  List<CircularStackEntry> nextData = <CircularStackEntry>[
    new CircularStackEntry(
      <CircularSegmentEntry>[
        new CircularSegmentEntry(1500.0, Colors.red[200], rankKey: 'Q1'),
        new CircularSegmentEntry(750.0, Colors.green[200], rankKey: 'Q2'),
        new CircularSegmentEntry(2000.0, Colors.blue[200], rankKey: 'Q3'),
        new CircularSegmentEntry(1000.0, Colors.yellow[200], rankKey: 'Q4'),
      ],
      rankKey: 'Quarterly Profits',
    ),
  ];
  setState(() {
    _chartKey.currentState.updateData(nextData);
  });
}

Customization

Hole Label:

Property Default
holeLabel null
labelStyle Theme.of(context).textTheme.body2

Example:

new AnimatedCircularChart(
  key: _chartKey,
  size: _chartSize,
  initialChartData: <CircularStackEntry>[
    new CircularStackEntry(
      <CircularSegmentEntry>[
        new CircularSegmentEntry(
          33.33,
          Colors.blue[400],
          rankKey: 'completed',
        ),
        new CircularSegmentEntry(
          66.67,
          Colors.blueGrey[600],
          rankKey: 'remaining',
        ),
      ],
      rankKey: 'progress',
    ),
  ],
  chartType: CircularChartType.Radial,
  percentageValues: true,
  holeLabel: '1/3',
  labelStyle: new TextStyle(
    color: Colors.blueGrey[600],
    fontWeight: FontWeight.bold,
    fontSize: 24.0,
  ),
)

hole label example screenshot


Segment Edge Style:

Property Default
edgeStyle SegmentEdgeStyle.flat
SegmentEdgeStyle Description
flat (default) Segments begin and end with a flat edge.
round Segments begin and end with a semi-circle.

Example:

new AnimatedCircularChart(
  key: _chartKey,
  size: _chartSize,
  initialChartData: <CircularStackEntry>[
    new CircularStackEntry(
      <CircularSegmentEntry>[
        new CircularSegmentEntry(
          33.33,
          Colors.blue[400],
          rankKey: 'completed',
        ),
        new CircularSegmentEntry(
          66.67,
          Colors.blueGrey[600],
          rankKey: 'remaining',
        ),
      ],
      rankKey: 'progress',
    ),
  ],
  chartType: CircularChartType.Radial,
  edgeStyle: SegmentEdgeStyle.round,
  percentageValues: true,
)

round segment edge example screenshot

Details

Chart data entries:

Charts expect a list of CircularStackEntry objects containing the data they need to be drawn.

Each CircularStackEntry corresponds to a complete circle in the chart. For radial charts that is one of the rings, for pie charts it is the whole pie.

Radial charts with multiple CircularStackEntrys will display them as concentric circles.

Each CircularStackEntry is composed of multiple CircularSegmentEntrys containing the value of a data point. In radial charts a segment corresponds to an arc segment of the current ring, for pie charts it is an individual slice.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].