Pie Chart
This Flutter package provides a Pie Chart Widget with cool animation.
???? Installation
In the dependencies:
section of your pubspec.yaml
, add the following line:
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 needs a Map<String, double> as its data input.
Map<String, double> dataMap = new Map(); dataMap.putIfAbsent("Flutter", () => 5); dataMap.putIfAbsent("React", () => 3); dataMap.putIfAbsent("Xamarin", () => 2); dataMap.putIfAbsent("Ionic", () => 2);
– Simple Implementation
PieChart(dataMap: dataMap)
– Full Implementation
PieChart( dataMap: dataMap, animationDuration: Duration(milliseconds: 800), chartLegendSpacing: 32.0, chartRadius: MediaQuery.of(context).size.width / 2.7, showChartValuesInPercentage: true, showChartValues: true, showChartValuesOutside: false, chartValueBackgroundColor: Colors.grey[200], colorList: colorList, showLegends: true, legendPosition: LegendPosition.right, decimalPlaces: 1, showChartValueLabel: true, initialAngle: 0, chartValueStyle: defaultChartValueStyle.copyWith( color: Colors.blueGrey[900].withOpacity(0.9), ), chartType: ChartType.disc, )
Change legend position with ‘legendPosition’
Change Chart shape to the ring
chartType: ChartType.ring,
chartType: ChartType.ring, showChartValuesOutside: true,
???? Contribution
- Fork it
- Create your feature branch (git checkout -b my-new-feature)
- Commit your changes (git commit -m ‘Add some feature’)
- Push to the branch (git push origin my-new-feature)
- Create a new Pull Request
Download Source Code for Flutter Pie Chart on GitHub:
https://github.com/apgapg/pie_chart
Provides the list of the opensource Flutter apps collection with GitHub repository.