pie_chart
pie_chart copied to clipboard
[BUG] Random Angle on Repaint
Whenever Flutter repaints the PieChart angle will seemingly change to a random angle.
https://user-images.githubusercontent.com/2219074/170731588-70a5eae1-b8b1-461e-a348-7fccca7a118a.mov
This is how PieChart is used in my app:
PieChart(
initialAngleInDegree: 270.0,
dataMap: {
"water": value,
},
ringStrokeWidth: 6.0,
chartType: ChartType.ring,
totalValue: maxValue,
baseChartColor: Colors.black38,
colorList: const [
Colors.greenAccent,
],
chartValuesOptions: const ChartValuesOptions(
showChartValues: false,
),
legendOptions: const LegendOptions(
showLegends: false,
),
),
),
What could possibly be the issue? Is it a bug in PieChart self?
Wrapping the PieChart in a RepaintBoundary seems to fix the issue for me. Still, no clue why it happens?
Can you please provide what data you are passing in data object?
Also what about total value parameter. Currently it makes value rendered as 100% without total value parameter
I wrapped it into RepaintBoundary and it worked well for me. But I was invoking it like:
PieChart(
dataMap: {"Title": 5},
totalValue: 10,
baseChartColor: const Color(0xAAD6DADA),
animationDuration: const Duration(milliseconds: 800),
chartLegendSpacing: 32,
initialAngleInDegree: 0,
chartType: ChartType.ring,
legendOptions: const LegendOptions(showLegends: false),
chartValuesOptions: const ChartValuesOptions(showChartValues: false),
ringStrokeWidth: 3,
chartRadius: 15
colorList: const [
Color.fromRGBO(67, 221, 166, 1),
],
)
Let me just try this sample code
Same thing happened on
pie_chart: ^5.3.2
Wrapping with RepaintBoundary fixed it
Happend to me too, but happend only when the provided Data is not 100% from the defined totalValue.