SliceData
The data class that constructs the Pie Slices in a Pie/Donut Chart.
...
import 'package:chart_it/chart_it.dart';
class TestPieCharts extends StatefulWidget {
const TestPieCharts({Key? key}) : super(key: key);
@override
State<TestPieCharts> createState() => _TestPieChartsState();
}
class _TestPieChartsState extends State<TestPieCharts> {
@override
Widget build(BuildContext context) {
return PieChart(
data: PieSeries(
slices: <SliceData>[
SliceData(
label: (_, value) => 'Quarter 1',
style: SliceDataStyle(
color: Colors.pink,
radius: 90,
),
value: 18,
),
SliceData(
label: (_, value) => 'Quarter 2',
style: SliceDataStyle(
color: Colors.orange,
radius: 130,
),
value: 32,
),
SliceData(
label: (_, value) => 'Quarter 3',
style: SliceDataStyle(
color: Colors.cyanAccent,
radius: 100,
),
value: 48,
),
SliceData(
label: (_, value) => 'Quarter 4',
style: SliceDataStyle(
color: Colors.blueAccent,
radius: 110,
),
value: 76,
),
],
),
);
}
}
Class Properties
Name
Type
Required
Default Value
Last updated