패키지, 저장소 및 앱 카테고리 검색

pie_chart 표지
패키지 상세v5.4.0

pie_chart

아름다운 파이 차트를 만들고 멋진 애니메이션을 제공하는 Flutter 패키지입니다.

AndroidiOSWebmacOSWindowsLinux
30일 다운로드
3.1만
좋아요
440
Pub 점수
140

패키지 설치

flutter pub add pie_chart

패키지 개요

공개 정보를 바탕으로 생성한 선택 가이드입니다.

부드러운 애니메이션을 갖춘 시각적으로 매력적인 파이 차트를 생성하기 위해 설계된 플러터 패키지입니다. 개발자가 여러 플랫폼에서 상호작용 가능하고 사용자 정의 가능한 파이 차트를 쉽게 앱에 통합할 수 있도록 합니다. 동적 데이터 업데이트, 다양한 차트 스타일 및 반응형 디자인을 지원하여 대시보드, 보고서 또는 분석 인터페이스에서 비율 데이터를 표시하는 데 이상적입니다. 간단한 API 통합을 통해 몰입감 있는 시각 피드백을 제공하여 사용자 경험을 향상시킵니다.

사용 사례

  • 데이터 비율 표시
  • 대시보드 위젯 만들기
  • 설문 조사 결과 시각화
  • 보고서 그래픽 생성
  • 분석 인터페이스 구축

주요 기능

  • 부드러운 애니메이션 효과
  • 사용자 정의 가능한 차트 색상
  • 반응형 레이아웃 지원
  • 동적 데이터 업데이트
  • 인터랙티브 터치 반응

적합한 대상

  • 앱 내 데이터 시각화
  • 교육 도구
  • 비즈니스 분석 대시보드
  • 모바일 및 웹 애플리케이션
  • 간단한 통계 보고서

고려 사항

  • 2차원 파이 차트에 한정
  • 대규모 데이터 세트에 적합하지 않습니다
  • 많은 슬라이스가 있을 경우 성능에 영향을 미칠 수 있음
  • 가독성을 위해 색상 선택에 신중해야 합니다
  • 작은부터 중간 규모의 데이터 세트에 가장 적합

원본 README

연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.

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

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

More discussions on Discord: https://discord.gg/7byeCn7MGF

💻 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,
        decimalPlaces: 1,
      ),
      // gradientList: ---To add gradient colors---
      // emptyColorGradient: ---Empty Color gradient---
    )

⭐ Features

Control decimal places 'decimalPlaces'
chartValuesOptions: ChartValuesOptions(
  decimalPlaces: 1,
),
Change legend position with 'legendPosition'

PieChart PieChart PieChart PieChart

Change Chart shape to ring
chartType: ChartType.ring,
PieChart
chartType: ChartType.ring,
showChartValuesOutside: true,
PieChart
Gradient Colors

Pie Chart supports gradient as colors. Just pass gradientList instead of colorList to add gradient to chart colors.

final gradientList = <List<Color>>[
  [
    Color.fromRGBO(223, 250, 92, 1),
    Color.fromRGBO(129, 250, 112, 1),
  ],
  [
    Color.fromRGBO(129, 182, 205, 1),
    Color.fromRGBO(91, 253, 199, 1),
  ],
  [
    Color.fromRGBO(175, 63, 62, 1.0),
    Color.fromRGBO(254, 154, 92, 1),
  ]
];

// Pass gradient to PieChart
gradientList: gradientList,
emptyColorGradient: [
 Color(0xff6c5ce7),
 Colors.blue,
],
PieChart
Base Chart Color

Add a base pie-chart color via:

baseChartColor: Colors.grey

Full code:

class HomePage2 extends StatelessWidget {
  HomePage2({Key? key}) : super(key: key);

  final dataMap = <String, double>{
    "Flutter": 5,
  };

  final colorList = <Color>[
    Colors.greenAccent,
  ];

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text("Pie Chart 1"),
      ),
      body: Container(
        padding: EdgeInsets.symmetric(horizontal: 16),
        child: PieChart(
          dataMap: dataMap,
          chartType: ChartType.ring,
          baseChartColor: Colors.grey[300]!,
          colorList: colorList,
        ),
      ),
    );
  }
}
Total Value

To show chart arcs based on your total value, add totalValue option.

class HomePage2 extends StatelessWidget {
  HomePage2({Key? key}) : super(key: key);

  final dataMap = <String, double>{
    "Flutter": 5,
  };

  final colorList = <Color>[
    Colors.greenAccent,
  ];

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text("Pie Chart 1"),
      ),
      body: Container(
        padding: EdgeInsets.symmetric(horizontal: 16),
        child: PieChart(
          dataMap: dataMap,
          chartType: ChartType.ring,
          baseChartColor: Colors.grey[50]!.withOpacity(0.15),
          colorList: colorList,
          chartValuesOptions: ChartValuesOptions(
            showChartValuesInPercentage: true,
          ),
          totalValue: 20,
        ),
      ),
    );
  }
}
PieChart
Center Widget

Creates a new widget placed at pie chart center

centerWidget: Container(color: Colors.red, child: const Text("Center"))
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

카테고리

소스 저장소

이 패키지를 사용하는 프로젝트