pie_chart
pie_chart copied to clipboard
How do I change PieChart when the data changes.
I’m changing the data but piechart still doesn’t change even i use the setState, how can i do it?
you manage to solve that?? :(
no i couldn't :( no i started using fl_chart 0.11.0
I already added this method
@override
void didUpdateWidget(PieChart oldWidget) {
initData();
super.didUpdateWidget(oldWidget);
}
Looks like this doesn't work. Will check it
For the time being one can add ValueKey to pie chart like this:
key: ValueKey(key),
and on changing data you can update the key like:
RaisedButton(
onPressed: () {
setState(() {
key = key + 1;
});
},
child: Text("Reload".toUpperCase()),
),