xueminlee / pie_chart

Flutter Pie chart with animation

Home Page:https://pub.dev/packages/pie_chart

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Pie Chart Cirrus CI - Base Branch Build Status GitHub stars Twitter Follow GitHub last commit Website shields.ioOpen Source Love

This Flutter package provides a Pie Chart Widget with cool animation.

Live Demo: https://apgapg.github.io/pie_chart/

πŸ’» Try LIVE Demo

Live Demo: https://apgapg.github.io/pie_chart/

piechart

πŸ’» Installation

In the dependencies: section of your pubspec.yaml, add the following line:

Version

dependencies:
  pie_chart: <latest version>

❔ Usage

Import this class

import 'package:pie_chart/pie_chart.dart';

Usage is simple. Pie Chart is a widget and it just need a Map<String,double> as its data input.

PieChart

Map<String, double> dataMap = {
    "Flutter": 5,
    "React": 3,
    "Xamarin": 2,
    "Ionic": 2,
  };

- Simple Implementation

PieChart(dataMap: dataMap) 

- Full Implementation

PieChart(
      dataMap: dataMap,
      animationDuration: Duration(milliseconds: 800),
      chartLegendSpacing: 32,
      chartRadius: MediaQuery.of(context).size.width / 3.2,
      colorList: colorList,
      initialAngleInDegree: 0,
      chartType: ChartType.ring,
      ringStrokeWidth: 32,
      centerText: "HYBRID",
      legendOptions: LegendOptions(
        showLegendsInRow: false,
        legendPosition: LegendPosition.right,
        showLegends: true,
        legendShape: _BoxShape.circle,
        legendTextStyle: TextStyle(
          fontWeight: FontWeight.bold,
        ),
      ),
      chartValuesOptions: ChartValuesOptions(
        showChartValueBackground: true,
        showChartValues: true,
        showChartValuesInPercentage: false,
        showChartValuesOutside: false,
      ),
    )

Change legend position with 'legendPosition'

PieChart PieChart PieChart PieChart

Change Chart shape to ring

chartType: ChartType.ring,

PieChart

chartType: ChartType.ring,
showChartValuesOutside: true,

PieChart

⭐ My Flutter Packages

  • json_table GitHub stars Create Flutter Json Table from json map directly.
  • avatar_glow GitHub stars Flutter Avatar Glow Widget with glowing animation.
  • search_widget GitHub stars Flutter Search Widget for selecting an option from list.
  • animating_location_pin GitHub stars Flutter Animating Location Pin Widget providing Animating Location Pin Widget which can be used while fetching device location.

⭐ My Flutter Apps

πŸ‘ Contribution

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -m 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

About

Flutter Pie chart with animation

https://pub.dev/packages/pie_chart

License:MIT License


Languages

Language:Dart 73.6%Language:CMake 15.8%Language:C++ 4.9%Language:HTML 2.7%Language:C 1.6%Language:Swift 1.0%Language:Kotlin 0.3%Language:Objective-C 0.1%