custom_pie_chart_label

A customizable Pie Chart widget for Flutter with hover effects, labels, and legend support.
This library makes it easy to display data in a visually appealing pie chart with animated hover expansions.

Example Screenshot

Custom Pie Chart label Example

Features

  • Fully customizable pie chart radius and spacing.
  • Hover effect to highlight slices.
  • Custom label lines with values and names.
  • Legend support.
  • Responsive design.

Installation

Add this to your pubspec.yaml:

dependencies:
  custom_pie_chart_label: ^1.0.0


## Usage

class ChartScreen extends StatefulWidget {
  const ChartScreen({super.key});

  @override
  State<ChartScreen> createState() => _ChartScreenState();
}

class _ChartScreenState extends State<ChartScreen> {
  final ScrollController _hScroll = ScrollController();
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: const Text('Custom Pie Chart Label Example')),
      body: Center(
        child: SizedBox(
          child: Scrollbar(
            controller: _hScroll,
            thumbVisibility: true,
            trackVisibility: true,
            interactive: true,
            thickness: 6,
            notificationPredicate: (notif) =>
            notif.metrics.axis == Axis.horizontal,
            child: SingleChildScrollView(
              scrollDirection: Axis.horizontal,
              controller: _hScroll,
              primary: false,
              child: SizedBox(
                width: MediaQuery.of(context).size.width,
                child: CustomChartWithLabel(
                  space: 2,
                  data: const [
                    PieData("Flutter", 171.06, Color(0xFF8979FF)),
                    PieData("Dart", 223.09, Color(0xFFFF928A)),
                    PieData("Firebase", 191.76, Color(0xFF3CC3DF)),
                    PieData("Other", 231.04, Color(0xFFFFAE4C)),
                  ],
                ),
              ),
            ),
          ),
        ),

      ),
    );
  }
}