-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove space from border to pie chart #107
Labels
question
Further information is requested
Comments
You should set the size manually, width: (radius * 2) + (centerSpace * 2),
height: (radius * 2) + (centerSpace * 2), check it out with this code: import 'package:fl_chart/fl_chart.dart';
import 'package:flutter/material.dart';
class PieChartPage extends StatefulWidget {
@override
_PieChartPageState createState() => _PieChartPageState();
}
class _PieChartPageState extends State<PieChartPage> {
double radius = 80;
double centerSpace = 20;
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.white,
body: Center(
child: SizedBox(
width: (radius * 2) + (centerSpace * 2),
height: (radius * 2) + (centerSpace * 2),
child: PieChart(
PieChartData(
sectionsSpace: 12,
centerSpaceRadius: centerSpace,
sections: [
PieChartSectionData(
color: const Color(0xff0293ee),
value: 25,
title: '',
radius: radius,
titleStyle: TextStyle(
fontSize: 18, fontWeight: FontWeight.bold, color: const Color(
0xff044d7c)),
titlePositionPercentageOffset: 0.55,
),
PieChartSectionData(
color: const Color(0xfff8b250),
value: 25,
title: '',
radius: radius,
titleStyle: TextStyle(
fontSize: 18, fontWeight: FontWeight.bold, color: const Color(
0xff90672d)),
titlePositionPercentageOffset: 0.55,
),
PieChartSectionData(
color: const Color(0xff845bef),
value: 25,
title: '',
radius: radius,
titleStyle: TextStyle(
fontSize: 18, fontWeight: FontWeight.bold, color: const Color(
0xff4c3788)),
titlePositionPercentageOffset: 0.6,
),
PieChartSectionData(
color: const Color(0xff13d38e),
value: 25,
title: '',
radius: radius,
titleStyle: TextStyle(
fontSize: 18, fontWeight: FontWeight.bold, color: const Color(
0xff0c7f55)),
titlePositionPercentageOffset: 0.55,
),
],
),
),
),
),
);
}
} |
Thanks so much. It verry useful. |
You're welcome! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When i create piechart it has a space from chart to border ( i paint it red color). Can i remove that space.
The text was updated successfully, but these errors were encountered: